Change Area Label lisp code from mm2 to m2

Change Area Label lisp code from mm2 to m2

asyraf_msuhaimi
Participant Participant
774 Views
9 Replies
Message 1 of 10

Change Area Label lisp code from mm2 to m2

asyraf_msuhaimi
Participant
Participant

Hi. I excited to use the lisp from Lee Mac which is Area Label but I want to change the code from using area mm2 to m2.  I did change the line below but when I load into the cad, nothing happen, its still appear as mm2. How eh?

 


(setq h1 "Area Table" ;; Heading
t1 "Number" ;; Number Title
t2 "Area" ;; Area Title
pf "" ;; Number Prefix (optional, "" if none)
sf "" ;; Number Suffix (optional, "" if none)
ap "" ;; Area Prefix (optional, "" if none)
as "m2" ;; Area Suffix (optional, "" if none)
cf 0.000001 ;; Area Conversion Factor (e.g. 1e-6 = mm2->m2)
fd t ;; Use fields to link numbers/objects to table (t=yes, nil=no)
fo "%lu6%qf1" ;; Area field formatting

0 Likes
Accepted solutions (2)
775 Views
9 Replies
  • Lisp
Replies (9)
Message 2 of 10

paullimapa
Mentor
Mentor

works for me:

paullimapa_0-1742356898568.pngpaullimapa_1-1742356907055.png

 


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 3 of 10

asyraf_msuhaimi
Participant
Participant

How? i am okay with the unit to appear or not but my consern is more on the area number. In my cad, its appear 1234567 and not 1.23. I want it to be 1.23 m2.

0 Likes
Message 4 of 10

paullimapa
Mentor
Mentor

Looks like the problem is when you select the object it does not honor the suffix value or the conversion factor when using the AT command:

paullimapa_0-1742364088945.png

You may want to contact Lee Mac to see if he can update this code.

Contact | Lee Mac Programming


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 5 of 10

cadffm
Consultant
Consultant
Accepted solution

Hi,

 

the PICK mode creates a stupid Text, the OBJECT mode creates a (linked) Field.

So if possible, the object mode is prefered.

 

For pickmode, it uses the cf option and your current luprec (and dimzin) setting

For objectmode, it uses the fo (format) option!

 

Check out what the right fieldcode is, for your needs, and change the fo value.

 

SAMPLE

cadffm_0-1742390801559.png

 

Sebastian

Message 6 of 10

paullimapa
Mentor
Mentor

Good catch on changing fo to get the correct Area field vs “stupid Text” lol


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 7 of 10

paullimapa
Mentor
Mentor
Accepted solution

in addtion to @cadffm if you want to also include suffix m2:

fo "%lu6%qf1%ps[, m2]%ct8[1.000000000000000E-006]"    ;; Area field formatting 

Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
Message 8 of 10

asyraf_msuhaimi
Participant
Participant

Thanks bro! its worked now.

0 Likes
Message 9 of 10

asyraf_msuhaimi
Participant
Participant

Thank you! all good now. I just need to figure out how to round off the number to 2 decimal place. 

0 Likes
Message 10 of 10

paullimapa
Mentor
Mentor

"I just need to figure out how to round off the number to 2 decimal place. "

Just follow @cadffm example.

Double click on the Field to see what the Field expression window at the bottom shows now...

specifically the section in between \f and >%

paullimapa_1-1742443228850.png

Then under Format: select Decimal 

And under Precision: change Current precision to two decimal places ie: 0.00

paullimapa_2-1742443419684.png

Now copy the section in between \f and >%:

"%lu2%pr2%ps[, m2]%ct8[1.000000000000000E-006]"

Finally paste this next to fo as the area format:

paullimapa_3-1742443528487.png

paullimapa_4-1742443673810.png

...cheers!!!

 

 

 


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes