Baber62 Posted June 17, 2016 Posted June 17, 2016 I am looking for a routine to that let's me know what the drawing's orignal units for measurement are. The reason being that we are working with several architects who sent us their drawings which are sometimes in inches or millimeters even had a drawing come in with measurement units as centimeters. This is taking up to much time when we need to use these as x-references as the drawing then comes in at different locations when inserted at coordinates 0,0. A lisp routine to determine the drawings units and then allow the user to change from say inches to meters. Quote
Tharwat Posted June 17, 2016 Posted June 17, 2016 Copy and paste the following code into your command line or just type the system variable lunits: (getvar 'lunits) Meanings: 1 Scientific 2 Decimal 3 Engineering 4 Architectural 5 Fractional Quote
Dadgad Posted June 17, 2016 Posted June 17, 2016 Have you ever used the -DWGUNITS command? Due Diligence is a good thing. It is always a good idea to know what you are working with. That is the commandline version, and you must include the "-" (hyphen) when calling the command. It will let you know what the current units are, and provide the opportunity to change them to something else. It will also reset insertion scaling factors as you need. It will scale the entire database to whatever units you wish to use, including paperspace entities, if you tell it to. It will also change the Measurement system variable so that appropriate Hatch files and Linetypes are used, be they Imperial or Metric. A very comprehensive tool, which should be used carefully. Create copies of a few drawings, and take it around the block to learn the drill. Read the prompts very carefully, and expand your commandline history window, so that you can better see the whole tool. Quote
Baber62 Posted June 17, 2016 Author Posted June 17, 2016 Thanks Tharwat and Dadgad. I found the following post on this forum http://www.cadtutor.net/forum/showthread.php?26434-Get-dwg-unit-in-lisp-(metric-imperial) Here Fuccaro suggested to use "(getvar "MEASUREMENT") will return 0 for imperial units and 1 for metric". This let's me know whether the drawing units are imperial or metric. This is fine, however, I would like to incorporate this into a lisp routine that after the (getvar "measurement") let's me know the units, something like "Units are imperial for this drawing" that then prompts me to ask me if I want to change something like "do you want to change the units" then proceeds to change the units via the -DWGUNITS. Any help would be appreciated. Quote
Dadgad Posted June 17, 2016 Posted June 17, 2016 When you start the -DWGUNITS command, the current measurement units will be displayed as Unit for length , as in my screenshot, indicating that the current units are mms, and at that point you can change them to whatever you want them to be, I entered 1 which means inches, so as to generate a series of commandline prompts, such as you might expect to receive. I have a ModeMacro which I have used in the past, as I work in mms, and would frequently receive drawings which had been done on Imperial templates. I placed it below my commandline, to keep an eye on such discrepancies. By glancing down at it I would either see "Cool!" , or if there appeared to be a problem, "Do you mean to be working in INCHES? Please run -dwgunits command" Quote
Baber62 Posted June 17, 2016 Author Posted June 17, 2016 Dadgad, that's seriously cool. I am using AutoCAD 3D MAP 2016. I have set up my original drawing using -dwgunits to be in metres and when I went an inserted a drawing (which was in inches) as an x-ref it came in at the correct location and scale. Thanks for all your advice. Quote
Dadgad Posted June 18, 2016 Posted June 18, 2016 (edited) Excellent, glad we could help you get back on the tracks. Might you have a personal default QNEW template, also set up for metres? Edited June 19, 2016 by Dadgad 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.