ahyin Posted February 21, 2012 Posted February 21, 2012 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 ! Quote
MSasu Posted February 21, 2012 Posted February 21, 2012 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 Quote
ahyin Posted February 21, 2012 Author Posted February 21, 2012 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 Quote
MSasu Posted February 21, 2012 Posted February 21, 2012 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 Quote
MSasu Posted February 21, 2012 Posted February 21, 2012 (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 February 21, 2012 by MSasu Code example fixed Quote
Ahankhah Posted February 21, 2012 Posted February 21, 2012 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 ) ) Quote
MSasu Posted February 21, 2012 Posted February 21, 2012 @Ahankhah: You are right, I misspelled the name of the function in my example. Thank you for spotting that - is fixed now. Regards, Mircea Quote
Ahankhah Posted February 21, 2012 Posted February 21, 2012 @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. Quote
Ahankhah Posted February 21, 2012 Posted February 21, 2012 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. Quote
MSasu Posted February 21, 2012 Posted February 21, 2012 @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 Quote
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.