Recent Posts

Pages: [1] 2 3 ... 10
1
AutoLISP (Vanilla / Visual) / Re: Modify DWGUNITS
« Last post by JasonB on Today at 01:54:55 AM »
The command is -DWGUNITS and not INSUNITS or LUNITS.

Please pay more attention before responding.

-DWGUNITS is a command.

INSUNITS and LUNITS are system variables

As others have pointed out, -DWGUNITS looks to be related to an AutoCAD Vertical. It's not documented anywhere that I could find in the HELP. Also, from other posts it seems geared more towards converting a drawing from one set of units to another. Further to this, the prompting of the command changes depending on whether you've run the command previously in a drawing. So simply calling
Code - Auto/Visual Lisp: [Select]
  1. (command "._-DWGUNITS" 6 2 3 "_N" "_Y")
may not work in all cases.

If you're simply trying to set the drawing units, then it would be better to explore the -UNITS command.

How to do it without COMMAND to look elegant within a program?

All the settings of the -UNITS command can be set via a system variable, which allows you to avoid making a command call from lisp. This is a more elegant approach. e.g
Code - Auto/Visual Lisp: [Select]
  1. (setvar 'INSUNITS 6)
  2. (setvar 'LUNITS 2)
  3. (setvar 'LUPREC 4)
3
I mod. CAB's version in spare time...
I added GrSnap and few other options - calling OSNAP command during dragging...

Here is the link : https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/need-help-to-modify-code-quot-rotate-block-for-preview-prior/m-p/12782519/highlight/true#M466237
4
AutoLISP (Vanilla / Visual) / Re: Modify DWGUNITS
« Last post by FELIX on May 18, 2024, 09:13:17 PM »
The command is -DWGUNITS and not INSUNITS or LUNITS.

Please pay more attention before responding.
5
AutoLISP (Vanilla / Visual) / Re: Modify DWGUNITS
« Last post by JasonB on May 18, 2024, 04:58:21 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

This part of the command relates to INSUNITS
https://help.autodesk.com/view/ACDLT/2025/ENU/?guid=GUID-A58A87BB-482B-4042-A00A-EEF55A2B4FD8
Code - Auto/Visual Lisp: [Select]
  1. (setvar 'INSUNITS 6)

PKENEWELL has listed this and the other system variables related to this command.

6
AutoLISP (Vanilla / Visual) / Re: Modify DWGUNITS
« Last post by FELIX on May 17, 2024, 11:46:23 PM »
Something like this

Code: [Select]
(command "-dwgunits" 6 2 3 "N" "Y")

How to do it without COMMAND to look elegant within a program?
7
AutoLISP (Vanilla / Visual) / Re: Modify DWGUNITS
« Last post by FELIX on May 17, 2024, 11:44:21 PM »
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

The command is -DWGUNITS and LUNITS does not accept =6
8
I found Lee Mac's code at this link:
https://www.theswamp.org/index.php?topic=40686.0
but I can't execute the block rotation function when pressing the ESC key (when I press ESC it exits the command)
Can someone please help me if possible: Change the block rotation function to the R key
9
AutoLISP (Vanilla / Visual) / Re: broke (Lee Macs) ScriptWriterV1-2.lsp
« Last post by Lee Mac on May 17, 2024, 06:29:01 PM »
You're more than welcome Lonnie - I'm delighted that it's still proving useful!  :-)
10
AutoLISP (Vanilla / Visual) / Re: Issue with Layout - Copy Command
« Last post by jnelson on May 17, 2024, 02:00:31 PM »
Thank you for testing on another version of AutoCAD.  I get the same results as you with ACAD2019, but not ACAD2024.
Pages: [1] 2 3 ... 10