DesignCAD 3D Max 2027 box
Now available

DesignCAD 2027

Hatches that follow their boundaries, an on-screen dial to turn your model, and a way to find any command by name, in a clean Windows 11 look.

Problems with relative Path and storing of negativ data in DesignCAD V18

Started by charly-bochum, September 03, 2008, 02:27:46 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

charly-bochum

Hi, guys.

Is my discovery really true that DesignCAD 3D MAX 18 contrary to former versions dosn't anymore recognize the "*\" for the relative path of the mean directory in which DesignCAD is installed?  That would be a very strong and negativ restriction for offering macros that should run on other peoples computer!

Is it also true that negativ values written with print# into a disk file not only come out by input# with wrong sign (like allready in V17) but now in V18 even change the other stored values?. Then signs must be stored and read separately and additionally!

Thank You for a clearing answer that this isn't true!

Charly-Bochum





DrollTroll

Hi Charly,

Regarding */
Since Windows Vista essentially prevents most users from doing any file operations in the Program Files folder, all samples and user drawings now are stored in the user's Documents folder, and this is also where */ points now.

So long as your macros and associated files are now stored in your Documents folder, instead of Program Files/IMSIDesign/DesignCAD 3D Max 18, things should still work pretty much as they used to.

As for the problems with sign values that you are talking about, it's the first I recall hearing of it. Got a sample macro to demonstrate the problem?
25 years with DesignCAD

charly-bochum

Dear Mr. DrollTroll,

many thanks for your quick and helpfull answer to the changes in *\, which also concerns SYS$(6) for the actual path, as I noticed besides.

Not so good as bevore is however, that tooltips don't show the name of the macro, if they were assigned by text button. Assigned with bitmaps they run correctly as usual. What can be done against that instead of creating dozens of new bitmaps?

Now to the data-problem, that I had posted. A simple macro for testing input and output of data-storing, you have asked for, is here:

A = 5
B = -6
open "o", 1, "*\TEST.DAT"
print #1, A,B
close    
open "i", 1 , "*\TEST.DAT"
input #1, A,B
close
Message A,B


Result will be -1 and -6.

I hope You will have a help for that problem too.

Charly-Bochum


bdeck

Hi CB,

The input # statement reads comma delimited files, so try this:

print #1, A,",",B

BD


charly-bochum

Hi Mr. BD,

many thanks, your recomendation was very good!

But who on earth has introduced this in BasicCAD? In DC 12, I used bevore DC 17, blank was used for delimiting, and that was produced automatically with PRINT #file, { list of expressions } as it should be in Basic.

Charly-Bochum

bdeck

Hi CB,

This appears to be a carry-over from the input statment, which can read algebraic expressions (a very cool feature).

I see no reason for input # to have that capability, but it does.

Consequently, it reads the "-" as an operator, not a sign, and performs a subtraction.

Otherwise, without the operator, the input # statement reads space delimited lines as well.

The ability to evaluate expressions in an input # statement seems excessive, given that an expression can always  be read explicitly using string input, ie:

input #1 , a$,
a=a$


Anyone else have ideas on this?

BD

Dempsey

Allowing expressions as a single numerical input in input statements is a neat feature. However, to avoid CB's problems input expressions should not be allow embedded blanks. In that way we can have the best of both worlds.
Dempsey

dcadRob

The problems with the INPUT# statement break one of the rules of files which is that you should get back out exactly what you put into the file.

The results produced now are 'interesting'. Consider this:
a=-5
a$="a"
b=-7
c=-10
print #1,a,a$,b,c
input #1,a,a$,b,c

Should give :
-5 a -7 -10

but actually produces :
-5 5 -7 -10

If a=5,a$="a",b=7,c=10 then you get :
5 5 7 10

If you have :
a=-5
b=-7
c=-10
print #1,a,b,c
input #1,a,b,c
you get :
-22 -7 -10
Why is only the first variable the result of a formula?

bdeck

Hi Rob,

DC's input # statement appears to be working as documented, except there is no warning to the unwary about the pitfalls of automatic expression evaluation. Also, "as-documented" is extremely non-standard and unintuitive.

Your example has further convinced me that expression evaluation in input# is a terrible idea.

At least a sys() variable to turn it off would be an improvement. That would allow input of string values without quote marks, and use of space as a delimiter.

For now, if you want to input strings without hassle, you must have only one string per line in you file.

Here are some variations on your code. Move the comment markers around to see the diff.

Regards,

BD


q$=chr$(34)   ' Quote mark

open "o", 1, "test.dat"

a=-5
a$=q$+"a"+q$       ' DC input# requires strings embedded in a line to be enclosed in quotes
'a$="a"
b=-7
c=-10

'print #1,a,a$,b,c                    ' input# fails with this line if a$ has embedded quote marks
print #1, a,",",a$,",",b,",",c

close 1

open "i", 1, "test.dat"
input #1 a1,a1$,b1,c1
close 1

open "i", 1, "test.dat"
input #1,a,a$,b,c
close 1

open "i", 1, "test.dat"
input #1, xx$               ' a single string input reads the entire line
close 1

print "xx$", xx$
anykey x


print "a,a$,b,c", a,a$,b,c
anykey x

print "a1,a1$,b1,c1", a1,a1$,b1,c1
anykey x


open "o", 1, "test1.dat"

a=-5
b=-7
c=-10
'print #1,a,b,c
print #1, a,",",b,",",c
close 1

open "i", 1, "test1.dat"
input #1 a1,b1,c1
close 1

open "i", 1, "test1.dat"
input #1,a,b,c
close 1

print "a,b,c",a,b,c
anykey x

print "a1,b1,c1",a1,b1,c1
anykey x

dcadRob

bdeck,

There may be a warning about enclosing strings in quotes, if there is more than one item per line, in the documentation but that is typically what someone would expect to do. What is more natural than writing pairs of variables to a file?

print #1,Item$,quantity

Evaluation in INPUT# should be turned off unless explicitly turned on in a macro.

Interestingly strings and numbers on the line behave differently:
print #1,a$,b$
input #1,a$,b$
will error because there is not enough data to read (it all gets picked up by a$) but
print #1,a$,b
input #1,a$,b
will evaluate something, sometimes wrong and sometimes right.



DrollTroll

Ambiguities such as these were among the motivations behind the Format and Parse statements.

As I recall, we had expression evaluation out for a while, then someone raised a hullabaloo because their macros depended on it. You can please some of the people some of the time...
25 years with DesignCAD

charly-bochum

Hi Mr DrollTroll,

your remarks were for me as not nativ englisch speaker barely understandable and they disappoint me from their substance!

The contributions of Rob and bdeck showed clearly as allready my example did, that storing of data, as is done now with input# statemant, is not only inconsequent, but evidently and really incorrect. Therefore bdeck expressively said, that in his oppinion expression evaluation in input# is a terrible idea. And Rob called the actual method extremely non-standard and unintuitive. All that is unfortunately true.

But there would be nothing to say against the actual practiced method, if for one thing the results were correct and for the other thing also the old method, which existed since the beginning of Basic, would still work as before. The last item should come first. 

And for that I want to remind some words of the DesignCAD Macro Reference:

INPUT #file is used to read - separated by commas - a line from a disk file and assign it to a numeric variable or to a string variable.

Only this sort variables should be stored, and that with blanks as separator between the single values.There is nothing said in the Reference about evaluation of expressions. This should be restricted to the INPUT statement, for what it is a very usefull feature, or be changed so, that it works with INPUT# also correctly.

I hope I wasn't too emotional in my words, which may sound as hullabaloo (a word, that I did not know, but what pleased me), but emphasised enough, that they effect a change to good old time - not for politics and president, but for DesingCAD, which in combination with BasicCAD in my opinion is the best program on earth for 2D-Drawing. Since more than 10 years I like the work with it and nearly 50 bureaus in Germany meanwhile followed me.  It would be a pity, if that wouldn't continue.

Charly-Bochum


DrollTroll

Update: Found the source of the Input# negative values problem, and fixed it. This fix will be present in the next available DesignCAD. So your space-delimited numeric values should again be parsed properly from an input file.

Those few users who need to parse expressions using Input# will simply have to read them in as strings.

This appears to have been lurking in the bushes since the days of DesignCAD 14!
25 years with DesignCAD

bdeck