Recent Posts

Pages: [1] 2 3 ... 10
1
AutoLISP (Vanilla / Visual) / Re: Modify DWGUNITS
« Last post by JasonB on Today at 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.

2
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?
3
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
4
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
5
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!  :-)
6
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.
7
AutoLISP (Vanilla / Visual) / Re: Issue with Layout - Copy Command
« Last post by ribarm on May 17, 2024, 10:55:15 AM »
I deleted all Layouts and left Model and Layout1 as CAD could not remove Layout1, then I renamed it to "TEMPLATE" and then I run your sub routine...
I am using AutoCAD 2022 and I got this results shown in picture...
8
AutoLISP (Vanilla / Visual) / Re: Issue with Layout - Copy Command
« Last post by jnelson on May 17, 2024, 10:10:45 AM »
Thank you for the suggestions BIGAL.  Using the code below, I get different results in AutoCAD 2019 vs AutoCAD 2024.

Code: [Select]
(defun laytest (/ LAYLIST TBLAYOUT)
  (setq LAYLIST (list "A" "B" "C" "D" "E" "F" "G"))
  (setq TBLAYOUT "TEMPLATE")
  (foreach MAP laylist (command "LAYOUT" "C" TBLAYOUT MAP))
)

This isn't the code I'm using in my program, but it demonstrates the issue in case anyone wants to try it.  Open a new drawing, rename one of the layouts to be "TEMPLATE", and give it a try (or change the "TEMPLATE" assignment to be "Layout1", etc.).  I've gotten consistently correct results in AutoCAD 2019, and consistently odd results in AutoCAD 2024.  I'm assuming Autodesk changed something along the way that is causing this effect.

9
AutoLISP (Vanilla / Visual) / Re: Line between 2 endlines
« Last post by FS_AT12 on May 17, 2024, 08:58:23 AM »
WOW!!!!

 :yay!:

THANK YOU VERY MUCH!

Everything is working as it should.

Franz
10
AutoLISP (Vanilla / Visual) / Re: Line between 2 endlines
« Last post by ribarm on May 17, 2024, 08:47:26 AM »
Re-test it now... I missed to close one bracket in 3rd (cond) statement...
Pages: [1] 2 3 ... 10