Author Topic: Modify DWGUNITS  (Read 340 times)

0 Members and 1 Guest are viewing this topic.

FELIX

  • Bull Frog
  • Posts: 242
Modify DWGUNITS
« on: April 25, 2024, 05:40:35 PM »
How to modify the value in -DWGUNITS from 3 to 6 by AutoLISP?

Command: -DWGUNITS

Drawing units:
  1. Inches
  2. Feet
  3. Millimeters
  4. Centimeters
  5. Decimeters
  6. Meters
Unit for length <3>: 6
OK.

BIGAL

  • Swamp Rat
  • Posts: 1421
  • 40 + years of using Autocad
Re: Modify DWGUNITS
« Reply #1 on: April 25, 2024, 08:16:33 PM »
Something like this

Code: [Select]
(command "-dwgunits" 6 2 3 "N" "Y")
A man who never made a mistake never made anything

ScottMC

  • Newt
  • Posts: 193
Re: Modify DWGUNITS
« Reply #2 on: April 26, 2024, 09:55:58 AM »
With my ancient A2K, this works: (setvar "LUNITS" 2) <- for decimal

Lonnie

  • Newt
  • Posts: 177
Re: Modify DWGUNITS
« Reply #3 on: April 26, 2024, 11:45:03 AM »
With my ancient A2K, this works: (setvar "LUNITS" 2) <- for decimal

Untested but?

Code: [Select]
(defun check-and-set-lunits ()
  (if (/= (getvar "LUNITS") 6) ; Check if LUNITS is not already set to 6
      (progn
        (setq change_units (strcat "\nLUNITS is currently set to " (itoa (getvar "LUNITS")) ", do you want to change it to 6? [Y/N]: "))
        (if (equal (getstring change_units) "Y")
            (setvar "LUNITS" 6) ; Change LUNITS to 6
            (prompt "\nLUNITS remains unchanged.")))))
           
(check-and-set-lunits)

Change for meters
« Last Edit: April 26, 2024, 11:56:06 AM by Lonnie »

huiz

  • Swamp Rat
  • Posts: 919
  • Certified Prof C3D
Re: Modify DWGUNITS
« Reply #4 on: April 26, 2024, 03:52:42 PM »
With my ancient A2K, this works: (setvar "LUNITS" 2) <- for decimal
DWGUNITS can have another setting, it is optional to match AutoCAD units settings.
The conclusion is justified that the initialization of the development of critical subsystem optimizes the probability of success to the development of the technical behavior over a given period.

PKENEWELL

  • Bull Frog
  • Posts: 320
Re: Modify DWGUNITS
« Reply #5 on: April 26, 2024, 04:37:07 PM »
With my ancient A2K, this works: (setvar "LUNITS" 2) <- for decimal
DWGUNITS can have another setting, it is optional to match AutoCAD units settings.

I would rather note that LUNITS is a sub-setting within the UNITS command, along with ANGDIR, AUNITS, ANGBASE, INSUNITS, LUPREC and AUPREC. Other system Variables that effect units are MEASUREINIT, MEASUREMENT and UNITMODE.
"When you are asked if you can do a job, tell 'em, 'Certainly I can!' Then get busy and find out how to do it." - Theodore Roosevelt

huiz

  • Swamp Rat
  • Posts: 919
  • Certified Prof C3D
Re: Modify DWGUNITS
« Reply #6 on: April 27, 2024, 03:39:39 AM »
I did't say it isn't. DWGUNITS is something different. From origin it comes from a vertical, AutoCAD Architecture I think. Within DWGUNITS you can set some unit settings and it is optional to match them with the AutoCAD units.
Normally you don't notice the DWGUNITS stuff but there are cases you do.
The best setting is to match AutoCAD units and then forget all about DWGUNITS.
The conclusion is justified that the initialization of the development of critical subsystem optimizes the probability of success to the development of the technical behavior over a given period.