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.

Reading out DC-version

Started by charly-bochum, January 29, 2012, 05:32:51 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

charly-bochum

Is it possible to read out the version number of the macro calling DC-program by sys-function or on other way with BasicCAD?

This could help to write only one macro with query of version mumber instead of making different macros for different DC-versions.

I couldn't find it out.

charly-bochum

Rob S

#1
Yes, possible

The code and various ways of using it is contained in my DSS07 macro posted here, short version below

http://forum.designcad.com/index.php?topic=1047.msg20397#msg20397

Parse Sys$(105), "%d.%d.%d", major, minor, build
do while minor >= 1
minor = minor *.1
loop
dcver = major + minor
Message dcver
End
User since forever

charly-bochum

Fantastic, such a quick and excellent answer, Rob!

Thank you very much

charly-bochum

DrollTroll

Depending on what changes need to be made for specific versions, however, that may not entirely solve the problem. For example, if you have a macro that is supposed to work in both DC21 and DC17, but your dimension commands use properties that are only in V21, V17 will throw an error as soon as it reads the macro, even if you intend those to be just for V21. DesignCAD parses and syntax-checks the entire macro before actually running it, so any "if v17 do this, else do this" type clauses won't affect the syntax check.
25 years with DesignCAD

Bob P

What about branching to another macro with a conditional run statement?

Rob S

Could this not be dealt with by using variables for those statements that need different values depending on the version installed?

The dss macro uses statements that are only processed for the applicable version, and this has not caused any trouble.

>DimChamfer
{
<Format [fmt]
<Precision [Prcn]
<Axis 0
<Arrowhead [at2]
<Arrowsize [aptf]
<Size [ts]
if dcver = 18.1  then
<Offset [optf]
end if
if dcver > 18.1  then
<OptDimTextOffset [optf]
end if

<null

}
User since forever

charly-bochum

Hello DrollTroll,

the first recommendation of Rob had been immediately successful for me.
With IF ABS(dcver) = 17 .... ENDIF I could write a part without the disturbing <DimUnits-command
and with IF ABS(dcver) = 20 or 21 ... ENDIF I wrote the other part of the macro, just as
Rob proposed it now in his second mail.

The syntax-check therefore seems to accept this procedure - luckily for me

But thank you for pointing out this problem - though it was not more.

charly-bochum