Dayananda Posted December 7, 2023 Posted December 7, 2023 (command "-block""ZWLEADERRF" "non"(list 0 0) ssarrow"" ) When I creating a block using a selection set; How can I set the block units In this code ssarrow is the selection set. Quote
mhupp Posted December 7, 2023 Posted December 7, 2023 (edited) I think it pulls from the drawing? so having that set before you make the block should work. https://help.autodesk.com/view/ACD/2024/ENU/?guid=GUID-A58A87BB-482B-4042-A00A-EEF55A2B4FD8 (setvar "insunits" 4) ;4 is mm if not did a little rewrite of this lisp for less spam ;;----------------------------------------------------------------------------------------;; ;; Update all Block definions units in drawing (defun C:blkunits (/ u untlst) (vl-load-com) (setq untlst '(("0" "Unitless) ("1" "Inches") ("2" "Feet") ("3" "Miles") ("4" "Millimeters") ("5" "Cenimeters") ("6" "Meters") ("7" "Kilometers") ("8" "Microinches") ("9" "Mils") ("10" "Yards") ("11" "Angstroms" ("12" "Nanometers") ("13" "Microns") ("14" "Decimeters") ("15" "Dekameters") ("16" "Hectometers" ("17" "Gigameters") ("18" "Astronomical") ("19" "Light Years" ("20" "Parsecs") ) (prompt "\nEnter Number to Change Block Units:") (prompt "\n0:Unitless, 1:Inches, 2:Feet, 3:Miles, 4:Millimeters, 5:Cenimeters") (prompt "\n6:Meters, 7:Kilometers, 8:Microinches, 9:Mils, 10:Yards") (prompt "\n11:Angstroms, 12:Nanometers, 13:Microns, 14:Decimeters, 15:Dekameters") (prompt "\n16:Hectometers ,17:Gigameters, 18:Astronomical, 19:Light Years, 20:Parsecs") (initget "0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20") (setq u (getkword "\nEnter New Block Units <0>: ")) (cond ((= u nil) (vlax-for blk (vla-get-Blocks (vla-get-activedocument (vlax-get-acad-object))) (vlax-put-property blk "Units" 0) ) ) (t (vlax-for blk (vla-get-Blocks (vla-get-activedocument (vlax-get-acad-object))) (vlax-put-property blk "Units" u) ) ) ) (prompt (strcat "\nBlock Units Updated to " (cdr (assoc u untlst)))) (princ) ) *untested and written in notepad. Edited December 7, 2023 by mhupp 1 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.