Recent Posts

Pages: [1] 2 3 ... 10
1
AutoLISP (Vanilla / Visual) / Re: broke (Lee Macs) ScriptWriterV1-2.lsp
« Last post by Lee Mac on Today at 06:29:01 PM »
You're more than welcome Lonnie - I'm delighted that it's still proving useful!  :-)
2
AutoLISP (Vanilla / Visual) / Re: Issue with Layout - Copy Command
« Last post by jnelson on Today at 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.
3
AutoLISP (Vanilla / Visual) / Re: Issue with Layout - Copy Command
« Last post by ribarm on Today at 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...
4
AutoLISP (Vanilla / Visual) / Re: Issue with Layout - Copy Command
« Last post by jnelson on Today at 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.

5
AutoLISP (Vanilla / Visual) / Re: Line between 2 endlines
« Last post by FS_AT12 on Today at 08:58:23 AM »
WOW!!!!

 :yay!:

THANK YOU VERY MUCH!

Everything is working as it should.

Franz
6
AutoLISP (Vanilla / Visual) / Re: Line between 2 endlines
« Last post by ribarm on Today at 08:47:26 AM »
Re-test it now... I missed to close one bracket in 3rd (cond) statement...
7
AutoLISP (Vanilla / Visual) / Re: Line between 2 endlines
« Last post by FS_AT12 on Today at 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)
8
AutoLISP (Vanilla / Visual) / Re: Line between 2 endlines
« Last post by ribarm on Today at 08:21:03 AM »
HI, it's me again...
I only mod. inputs for getting points - should work and with combinations (poly-poly; line-poly; poly-line; line-line)... But still you should check as I saw your *.mp4... You could mod. something you see and I overlooked...

Code - Auto/Visual Lisp: [Select]
  1. (defun c:connect_with_lines ( / *error* cmd es1 es2 curve1 curve2 pick1 pick2 pt1 pt2 pt3 pt4 )
  2.  
  3.  
  4.   (defun *error* ( m )
  5.     (while (= 8 (logand 8 (getvar (quote undoctl))))
  6.       (if command-s
  7.         (command-s "_.undo" "_e")
  8.         (vl-cmdf "_.undo" "_e")
  9.       )
  10.     )
  11.     (if cmd
  12.       (setvar (quote cmdecho) cmd)
  13.     )
  14.     (if m
  15.       (prompt m)
  16.     )
  17.     (princ)
  18.   )
  19.  
  20.   (setq cmd (getvar (quote cmdecho)))
  21.   (setvar (quote cmdecho) 0)
  22.   (while (= 8 (logand 8 (getvar (quote undoctl))))
  23.     (vl-cmdf "_.undo" "_e")
  24.   )
  25.   (vl-cmdf "_.undo" "_be")
  26.   (if
  27.     (and
  28.       (setq es1 (entsel "\nPick first curve (on desired segment of polyline) : "))
  29.       (setq es2 (entsel "\nPick second curve (on desired segment of polyline) : "))
  30.     )
  31.     (progn
  32.       (setq curve1 (car es1))
  33.       (setq curve2 (car es2))
  34.       (setq pick1 (cadr es1))
  35.       (setq pick2 (cadr es2))
  36.       (cond
  37.         (
  38.           (and
  39.             (wcmatch (cdr (assoc 0 (entget curve1))) "*POLYLINE")
  40.             (wcmatch (cdr (assoc 0 (entget curve2))) "*POLYLINE")
  41.           )
  42.           (setq pt1 (vlax-curve-getpointatparam curve1 (float (fix (vlax-curve-getparamatpoint curve1 (vlax-curve-getclosestpointto curve1 (trans pick1 1 0))))))
  43.                 pt2 (vlax-curve-getpointatparam curve1 (float (fix (1+ (vlax-curve-getparamatpoint curve1 (vlax-curve-getclosestpointto curve1 (trans pick1 1 0)))))))
  44.                 pt3 (vlax-curve-getpointatparam curve2 (float (fix (vlax-curve-getparamatpoint curve2 (vlax-curve-getclosestpointto curve2 (trans pick2 1 0))))))
  45.                 pt4 (vlax-curve-getpointatparam curve2 (float (fix (1+ (vlax-curve-getparamatpoint curve2 (vlax-curve-getclosestpointto curve2 (trans pick2 1 0)))))))
  46.           )
  47.         )
  48.         (
  49.           (wcmatch (cdr (assoc 0 (entget curve1))) "*POLYLINE")
  50.           (setq pt1 (vlax-curve-getpointatparam curve1 (float (fix (vlax-curve-getparamatpoint curve1 (vlax-curve-getclosestpointto curve1 (trans pick1 1 0))))))
  51.                 pt2 (vlax-curve-getpointatparam curve1 (float (fix (1+ (vlax-curve-getparamatpoint curve1 (vlax-curve-getclosestpointto curve1 (trans pick1 1 0)))))))
  52.                 pt3 (vlax-curve-getstartpoint curve2)
  53.                 pt4 (vlax-curve-getendpoint curve2)
  54.           )
  55.         )
  56.         (
  57.           (wcmatch (cdr (assoc 0 (entget curve2))) "*POLYLINE")
  58.           (setq pt1 (vlax-curve-getstartpoint curve1)
  59.                 pt2 (vlax-curve-getendpoint curve1)
  60.                 pt3 (vlax-curve-getpointatparam curve2 (float (fix (vlax-curve-getparamatpoint curve2 (vlax-curve-getclosestpointto curve2 (trans pick2 1 0))))))
  61.                 pt4 (vlax-curve-getpointatparam curve2 (float (fix (1+ (vlax-curve-getparamatpoint curve2 (vlax-curve-getclosestpointto curve2 (trans pick2 1 0)))))))
  62.           )
  63.         )
  64.         ( t
  65.           (setq pt1 (vlax-curve-getstartpoint curve1)
  66.                 pt2 (vlax-curve-getendpoint curve1)
  67.                 pt3 (vlax-curve-getstartpoint curve2)
  68.                 pt4 (vlax-curve-getendpoint curve2)
  69.           )
  70.         )
  71.       )
  72.       (if (> (+ (distance pt1 pt3) (distance pt2 pt4)) (+ (distance pt1 pt4) (distance pt2 pt3)))
  73.         (vl-cmdf "_.line" "_non" (trans pt1 0 1) "_non" (trans pt4 0 1) "" "_.line" "_non" (trans pt2 0 1) "_non" (trans pt3 0 1) "")
  74.         (vl-cmdf "_.line" "_non" (trans pt1 0 1) "_non" (trans pt3 0 1) "" "_.line" "_non" (trans pt2 0 1) "_non" (trans pt4 0 1) "")
  75.       )
  76.     )
  77.   )
  78.   (*error* nil)
  79. )
  80.  
9
AutoLISP (Vanilla / Visual) / Re: Line between 2 endlines
« Last post by FS_AT12 on Today at 07:49:10 AM »
Hi Marko,

Thank you very very much, for the effort you are making here.
It already help me a lot, so thank you again.


I have tested the new version,
see here a Video of how it works.

-the simple line connections get crossed,
-the more complex polylines are working
-the combination of line and polyline is producing wrong connections.

Regards Franz
10
AutoLISP (Vanilla / Visual) / Re: Line between 2 endlines
« Last post by ribarm on Today at 07:06:40 AM »
I see it...
Try this lisp and see if now is all OK...

Code - Auto/Visual Lisp: [Select]
  1. (defun c:connect_with_lines ( / *error* cmd es1 es2 curve1 curve2 pick1 pick2 pt1 pt2 pt3 pt4 )
  2.  
  3.  
  4.   (defun *error* ( m )
  5.     (while (= 8 (logand 8 (getvar (quote undoctl))))
  6.       (if command-s
  7.         (command-s "_.undo" "_e")
  8.         (vl-cmdf "_.undo" "_e")
  9.       )
  10.     )
  11.     (if cmd
  12.       (setvar (quote cmdecho) cmd)
  13.     )
  14.     (if m
  15.       (prompt m)
  16.     )
  17.     (princ)
  18.   )
  19.  
  20.   (setq cmd (getvar (quote cmdecho)))
  21.   (setvar (quote cmdecho) 0)
  22.   (while (= 8 (logand 8 (getvar (quote undoctl))))
  23.     (command "_.undo" "_e")
  24.   )
  25.   (command "_.undo" "_be")
  26.   (if
  27.     (and
  28.       (setq es1 (entsel "\nPick first curve (on desired segment of polyline) : "))
  29.       (setq es2 (entsel "\nPick second curve (on desired segment of polyline) : "))
  30.     )
  31.     (progn
  32.       (setq curve1 (car es1))
  33.       (setq curve2 (car es2))
  34.       (setq pick1 (cadr es1))
  35.       (setq pick2 (cadr es2))
  36.       (if
  37.         (and
  38.           (wcmatch (cdr (assoc 0 (entget curve1))) "*POLYLINE")
  39.           (wcmatch (cdr (assoc 0 (entget curve2))) "*POLYLINE")
  40.         )
  41.         (setq pt1 (vlax-curve-getpointatparam curve1 (float (fix (vlax-curve-getparamatpoint curve1 (vlax-curve-getclosestpointto curve1 (trans pick1 1 0))))))
  42.               pt2 (vlax-curve-getpointatparam curve1 (float (fix (1+ (vlax-curve-getparamatpoint curve1 (vlax-curve-getclosestpointto curve1 (trans pick1 1 0)))))))
  43.               pt3 (vlax-curve-getpointatparam curve2 (float (fix (vlax-curve-getparamatpoint curve2 (vlax-curve-getclosestpointto curve2 (trans pick2 1 0))))))
  44.               pt4 (vlax-curve-getpointatparam curve2 (float (fix (1+ (vlax-curve-getparamatpoint curve2 (vlax-curve-getclosestpointto curve2 (trans pick2 1 0)))))))
  45.         )
  46.         (setq pt1 (vlax-curve-getstartpoint curve1)
  47.               pt2 (vlax-curve-getendpoint curve1)
  48.               pt3 (vlax-curve-getstartpoint curve2)
  49.               pt4 (vlax-curve-getendpoint curve2)
  50.         )
  51.       )
  52.       (if (> (+ (distance pt1 pt3) (distance pt2 pt4)) (+ (distance pt1 pt4) (distance pt2 pt3)))
  53.         (vl-cmdf "_.line" "_non" (trans pt1 0 1) "_non" (trans pt4 0 1) "" "_.line" "_non" (trans pt2 0 1) "_non" (trans pt3 0 1) "")
  54.         (vl-cmdf "_.line" "_non" (trans pt1 0 1) "_non" (trans pt3 0 1) "" "_.line" "_non" (trans pt2 0 1) "_non" (trans pt4 0 1) "")
  55.       )
  56.     )
  57.   )
  58.   (*error* nil)
  59. )
  60.  

Regards, M.R.
Pages: [1] 2 3 ... 10