AEChadwick Posted July 17, 2012 Share Posted July 17, 2012 (edited) 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 July 17, 2012 by AEChadwick Quote Link to comment
AEChadwick Posted July 17, 2012 Author Share Posted July 17, 2012 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... Quote Link to comment
AEChadwick Posted July 19, 2012 Author Share Posted July 19, 2012 (edited) 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 July 19, 2012 by AEChadwick Quote Link to comment
AEChadwick Posted July 19, 2012 Author Share Posted July 19, 2012 oh fer dumb. CHR(39) will insert a single quote. hope this saves some other poor bastard a search. ? Quote Link to comment
Recommended Posts
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.