[Search tip detail and code files using keywords, tip number, author name, etc ]
 
Insert Units
Tip# 3436 By Leonid Nemirovsky On 07-Jun-2010
4
Rated By 1 users
Categories : Units
Software type : AutoCAD 2011
Rename File To : No Files to download.
This routine will display current drawing units and prompt you for your desired insertion units.

Frequent tipster Leonid Nemirovskywrote a short LISP routine to help himself deal with the Insert Units variable in AutoCAD.

"I often forget all about the Insert Units setting that AutoCAD has now. To make my life easier I wrote a very simple routine:
 
(defun c:inun ()
(setq qun (getvar "lunits"))
(cond
 ((= qun 2)(setq line1 "Drawing units are DECIMAL"))
 ((= qun 4)(setq line1 "Drawing Units are ARCHITECTURAL"))
)
(prompt line1)
(initget 1 "Inch Feet")
(setq key (getkword " Source Block Units <Inch or Feet>: "))
(if (= key "Inch")(setq inu 1))
(if (= key "Feet")(setq inu 2))
 
(SETVAR "INSUNITS" INU)
(princ)
)
 
As usual, you can add it to mnl or ACADDOC.LSP, or just load it by dragging it into your drawing area. Once it is loaded, type INUN at the Command prompt. The current drawing units will be displayed at the Command prompt, and you will be prompted for your desired insertion units."
 
Notes from Cadalyst Tip Patrol: Units can be a tricky issue, especially in the United States, where you never know which units a person will be using. The rest of the world is much simpler, because they are using the metric system! There are five units settings: 1=scientific, 2=decimal, 3=engineering, 4=architectural, and 5=fractional. You can alter this code to include them all if you want to. Just add more lines as:

((= qun 5)(setq line1 "Drawing Units are FRACTIONAL"))

and so on. You can also add more options to set your insert units to more than just feet or inches. Add a line such as:

(if (= key "Miles")(setq inu 3))

and so on.

The Insert Units setting allows a user to insert a block or other DWG file to scale, regardless of the drawing's units. It is a very good idea to make sure this is set correctly. If I am drawing in feet, I can insert a drawing made in meters without having to scale anything. If your Insert Units setting is set to Unitless, or is incorrect, this process won't work. Make sure it is set properly in your template file, and then you won't have to worry about it.

 

 

Average Rating:
4


User comments


Log In