News:

Please note new Forum URL: forum.designcad.com

Main Menu
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.

metric conversion & display

Started by bobarthur, January 26, 2012, 07:29:50 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

bobarthur

OK!  I have figured out how to write a macro that converts an inputed number into metric and how to print this number.  Is BasicCAD capable of reading a text number and determing its value, its height and printing its metric value inside parenthesis, center justified in the original number's text height?

DrollTroll

Yes, that should be doable.
First you neet to select the text.
There are Sys() functions to get the corners of its bounding box. These will give you the length and height. You could also use the points of the text itself, using the Entity statement, but I can't recall offhand if the points are different for 2D text and 3D text. Either way, you can get that info.
There's a Sys$() function to get the string associated with an entity "loaded" by the Entity statement. That will be the contents of the text object.
Use the Val function to get the numeric value.
Then do your conversion, figure out the new location, and draw the new text.
25 years with DesignCAD

bobarthur

OK!
I am using DCAD 2000LT.
I will select the text before I run the macro.
How do I use the Entity command?
Then  this? Sys(t$)?
and n=Val(t$)?
then print out t$? (once I have t$, I know how to print it out)

dcadRob

Assuming you have selected 1 text entity:
GETSELECT 1,E
ENTITY E
T$=SYS$(1)
N=VAL(T$)

bobarthur

I got it
IT WORKS, THANX!
This is a great start!