Jump to content
Developer Wiki and Function Reference Links Read more... ×
Sign in to follow this  

possible to display result of GetLScale as "feet only, rounded"?

Recommended Posts

I use a little PIO to display scale inside Viewports that includes this...

layScale:= GetLScale(ActLayer);

HowManyFeet := Num2StrF(layScale);

DescriptionOfScale := Concat('1" = ',HowManyFeet);


this currently creates 1" = 4'0" or 1" = 23'10"

What snippet of code would change that to 1" = 4' or even 1" = 24' (close enough for estimating cable runs, seriously).

*would like to do this without changing the Units... of the document; hoping there is something that will round the numbers and drop the inches.



Edited by AEChadwick

Share this post

Link to post

Hmm. Answering my own question, just coerce it out of Num2Str in a different way:

layScale:= GetLScale(ActLayer);

HowManyFeet := Num2Str(0,(layscale/12));

DescriptionOfScale := Concat('1" = ',HowManyFeet,'?');


...that's using a fado as feet because I can't figure out how to get a hatch in there; don?t judge me.

Of course, that /12 assumes imperial units (which I generally use, but that seems like sloppy code). I?m open to improvement...

Share this post

Link to post

Going further, here is my sloppy attempt to remove the trailing 0.

I am posting this in the hopes that someone might reveal how to use the actual feet character in a string instead of my silly fado-workaround.

theNumber := (layscale/12);

HowManyFeet := Concat(Num2Str(0, theNumber),'?');

if theNumber - ROUND(theNumber) <> 0 then HowManyFeet := Num2StrF(layscale);

DescriptionOfScale := Concat('1? = ',HowManyFeet);


take pity on my tortured code...

Edited by AEChadwick

Share this post

Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  


7150 Riverwood Drive, Columbia, Maryland 21046, USA   |   Contact Us:   410-290-5114


© 2018 Vectorworks, Inc. All Rights Reserved. Vectorworks, Inc. is part of the Nemetschek Group.