Recent Posts

Pages: [1] 2 3 ... 10
1
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?
2
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
3
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
4
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!  :-)
5
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.
6
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...
7
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.

8
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
9
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...
10
AutoLISP (Vanilla / Visual) / Re: Line between 2 endlines
« Last post by FS_AT12 on May 17, 2024, 08:29:54 AM »
 Error: ;-(

; ----- Error around expression -----
; (DEFUN C:CONNECT_WITH_LINES_OLD NIL (AL_LEAVEDEFUN (AL_ENTERDEFUN 'C:CONNECT_WITH_LINES_OLD 'NIL '((PT4) (PT3) (PT2) (PT1) (CURVE2) (CURVE1))) (LET ((CURVE1) (CURVE2) (PT1) (PT2) (PT3) (PT4)) (OR (NOT (VL-CATCH-ALL-ERROR-P (VL-CATCH-ALL-APPLY #'VLAX-GET-ACAD-OBJECT NIL))) (VL-LOAD-COM)) (SETQ CURVE1 (CAR (ENTSEL "
Select first curve: "))) (SETQ CURVE2 (CAR (ENTSEL "
Select second curve: "))) (SETQ PT1 (VLAX-CURVE-GETSTARTPOINT CURVE1) PT2 (VLAX-CURVE-GETENDPOINT CURVE1) PT3 (VLAX-CURVE-GETSTARTPOINT CURVE2) PT4 (VLAX-CURVE-GETENDPOINT CURVE2)) (IF (< (DISTANCE PT2 PT3) (DISTANCE PT2 PT4)) (MAPCAR #'SET (LIST 'PT3 'PT4) (LIST PT4 PT3))) (COMMAND "_.line" "_non" (TRANS PT1 0 1) "_non" (TRANS PT3 0 1) "" "_.line" "_non" (TRANS PT2 0 1) "_non" (TRANS PT4 0 1) "") (PRINC))))
;
; error : malformed list on input at [read] : File <C:/Users/../user/connect_with_lines.lsp>
C:\Users\..\user\connect_with_lines.lsp loading failed.

EDIT:

I think There is a ")" missing in line 80

i restart the lisp but no line is created at all
this appears in the commandline
: CONNECT_WITH_LINES
Pick first curve (on desired segment of polyline) :
Pick second curve (on desired segment of polyline) : (809.073066301129 25427.1548283457 0.0)
Pages: [1] 2 3 ... 10