Jump to content
Developer Wiki and Function Reference Links ×

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);

CreateText(DescriptionOfScale);

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.

Thanks!

??

Edited by AEChadwick
Link to comment

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,'?');

CreateText(DescriptionOfScale);

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

Link to comment

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);

CreateText(DescriptionOfScale);

take pity on my tortured code...

Edited by AEChadwick
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...