nafees Posted May 25, 2024 Posted May 25, 2024 PLEASE HELP ME TO MAKE A LISP FOR SETTING DRWING UNITS FROM MILIMETER TO METERS TYPE COMMAD DWGUNITS DWGUNITS UNIT FOR LENGTH 6 (METER) DWGUNITS LINER DISPLAY FORMAT 2 DWGUNITS LINEAR DISPLAY PRECISION 3 DWGUNITS SCALE OBJECTS FROM OTHER DRAWINGS UPON INSERT? [YES NO] YES DWGUNITS MATCH INSUNITS TO DRAWING UNITS? [YES NO] YES DWGUNITS SCALE OBJECTS IN CURRENT DRAWING TO REFLECT CHANGE IN UNITS? [YES NO] YES DWGUNITS INCLUDE OBJECTS IN PAPER SPACE? [YES NO] YES Quote
BIGAL Posted May 26, 2024 Posted May 26, 2024 (edited) Hidden behind DWGUNITS is various variables, length (setvar 'insunits 6) Format (setvar 'lunits 2) precision (setvar 'Luprec 3) maybe, not sure (setvar 'INSUNITSDEFSOURCE 6) (setvar ' INSUNITSDEFTARGET 6) (setvar ' INSUNITSSCALING 2) maybe also (setvar 'measurement 1) Edited May 26, 2024 by BIGAL 1 Quote
nafees Posted May 26, 2024 Author Posted May 26, 2024 i am very new for making lisp i make like the following codes but its not working (defun c:dwgunit () (command "_.DWGUNIT") (command "6" "") (command "Yes" "") (command "Yes" "") (command "Yes" "") (command "Yes" "") (princ) ) Quote
BIGAL Posted May 26, 2024 Posted May 26, 2024 (edited) yeah problems with "(command dwgunit" (defun c:dwgu ( / ) (setvar 'insunits 6) (setvar 'lunits 2) (setvar 'Luprec 3) (setvar 'INSUNITSDEFSOURCE 6) (setvar 'INSUNITSDEFTARGET 6) (setvar 'INSUNITSSCALING 2) (princ) ) Edited May 29, 2024 by BIGAL 1 Quote
nafees Posted May 26, 2024 Author Posted May 26, 2024 ; error: AutoCAD variable setting rejected: INSUNITSSCALING 2 THE ABOVE ERROR IS COMING WHILE I AM MAKING THIS LISP Quote
SLW210 Posted May 26, 2024 Posted May 26, 2024 I moved your thread to the AutoLISP, Visual LISP & DCL Forum. Please post in the most appropriate forum. Quote
nafees Posted May 27, 2024 Author Posted May 27, 2024 MY BAD, STILL I AM NOT ABLE TO MAKE THE LISP Quote
SLW210 Posted May 27, 2024 Posted May 27, 2024 AutoCAD may not have INSUNITSSCALING. I removed that and it ran on AutoCAD 2000i on my home computer. Perhaps you should look through the related System Variables (sysvar) for yourself and see what value you need. You could also do all of this with an ACADDOC.lsp, I set all of my relevant system variables that way. You could also set up a drawing template and or create this as a Script file and run in a batch process. Quote
BIGAL Posted May 29, 2024 Posted May 29, 2024 Dont know what happened i edited the other day, but there was a space in the setvar the typo. Resaved above Quote
nafees Posted May 30, 2024 Author Posted May 30, 2024 i removed extra spaces (defun c:dwgu ( / ) (setvar 'insunits 6) (setvar 'lunits 2) (setvar 'Luprec 3) (setvar 'INSUNITSDEFSOURCE 6) (setvar 'INSUNITSDEFTARGET 6) (setvar 'INSUNITSSCALING 2) (princ) ) but result is still the same "Command: DWGU ; error: AutoCAD variable setting rejected: INSUNITSSCALING 2" Quote
nafees Posted May 30, 2024 Author Posted May 30, 2024 or should it be like this but still it is not working (defun set-dwgunits () (command "DWGUNITS" "UNIT" "6" "METER") (command "DWGUNITS" "LINER" "DISPLAY" "FORMAT" "2") (command "DWGUNITS" "LINEAR" "DISPLAY" "PRECISION" "3") (command "DWGUNITS" "SCALE" "OBJECTS" "FROM" "OTHER" "DRAWINGS" "UPON" "INSERT?" "YES") (command "DWGUNITS" "MATCH" "INSUNITS" "TO" "DRAWING" "UNITS?" "YES") (command "DWGUNITS" "SCALE" "OBJECTS" "IN" "CURRENT" "DRAWING" "TO" "REFLECT" "CHANGE" "IN" "UNITS?" "YES") (command "DWGUNITS" "INCLUDE" "OBJECTS" "IN" "PAPER" "SPACE?" "YES") ) ; Run the function (set-dwgunits) 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.