Jump to content

I want help to make a lisp which change the drawing units from millimeters to meters without changing the coordinates


nafees

Recommended Posts

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
 

Link to comment
Share on other sites

Posted (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 by BIGAL
  • Like 1
Link to comment
Share on other sites

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)
)
 

Link to comment
Share on other sites

Posted (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 by BIGAL
  • Like 1
Link to comment
Share on other sites

; error: AutoCAD variable setting rejected: INSUNITSSCALING 2
THE ABOVE ERROR IS COMING WHILE I AM MAKING THIS LISP 

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Dont know what happened i edited the other day, but there was a space in the setvar the typo.

 

Resaved above

 

Link to comment
Share on other sites

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
"

Link to comment
Share on other sites

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)
 

Link to comment
Share on other sites

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...