Jump to content

Recommended Posts

Posted

Hi,

 

I saw a function "val-get-units" from this forum, but anyone know how to use this function. Actually, I want to check the drawing units by lisp in the CAD file.

 

Thanks !

Posted

For drawing units you may use LUNITS system variable that store linear units, respectively LUPREC that set their precision. For angles there is AUNITS & AUPREC pair.

 

(nth (getvar “LUNITS”)
    ‘("" "Scientific" "Decimal" "Engineering" "Architectural" "Fractional"))

 

Regards,

Mircea

Posted

Thanks for your fast response ! When I change Lunits variable to 4, the drawing type changed to "Architectural". But the drawing units is the same (e.g. feet). The drawing units are (inches, feet, millimeters, centimeters, decimeters, meters). How can I get this from lisp or others variable ? I'm unable to found the variable to check the drawing units. So I'm consider to use the function of "vla-get-units".

 

For drawing units you may use LUNITS system variable that store linear units, respectively LUPREC that set their precision. For angles there is AUNITS & AUPREC pair.

 

(nth (getvar “LUNITS”)
    ‘("" "Scientific" "Decimal" "Engineering" "Architectural" "Fractional"))

 

Regards,

Mircea

Posted

In standard (vanilla) AutoCAD you can control only the input/display format for units - the unit itself is just a convention and is decided by you.

Saw now that you are using Architecture, so maybe there is a difference from standard AutoCAD; please call the help for the command that allow you do that input and under "Quick Reference" may find the variables that store that settings.

 

Regards,

Mircea

Posted (edited)

I may be wrong, but to my knowledge, the VLA-GET-UNITS function is applicable to entities (i.e. blocks), not to the drawing itself. The excerpt below will generate an error:

 

[s](vlax-get-units (vla-get-ActiveDocument (vlax-get-acad-object)))[/s]
(vla-get-units (vla-get-ActiveDocument (vlax-get-acad-object)))

 

This is because drawing doesn’t have a “Units” property - you may list the features of drawing:

 

 (vlax-dump-object (vla-get-ActiveDocument (vlax-get-acad-object)))

 

Regards,

Mircea

Edited by MSasu
Code example fixed
Posted

AFAIK, vla-get-units (and not vlax-get-units) is a function to get a "Block Reference" object's unit.

 

(vla-get-Units
(vla-item
 (vla-get-Blocks
  (vla-get-ActiveDocument
   (vlax-get-acad-object)
  )
 )
 BlockName
)
)

Posted

@Ahankhah: You are right, I misspelled the name of the function in my example. Thank you for spotting that - is fixed now.

 

Regards,

Mircea

Posted
@Ahankhah: You are right, I misspelled the name of the function in my example. Thank you for spotting that - is fixed now.

 

Regards,

Mircea

You are welcome Mircea. So far, I have learned many useful things from you. :)

Posted
Thanks Ahankhah and Mircea.

You are welcome ahyin.

I know your problem exists yet, but just know you must look for any function other than vla-get-Units. :roll:

Posted

@ahyin: Just curios, in Architecture you can specify the type of units, along the format? Can you please post a screen-shot with that setting? Maybe we miss something in your question.

 

 

Regards,

Mircea

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
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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...