Recent Posts

Pages: 1 ... 8 9 [10]
91
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...
92
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)
93
AutoLISP (Vanilla / Visual) / Re: Line between 2 endlines
« Last post by ribarm on May 17, 2024, 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.  
94
AutoLISP (Vanilla / Visual) / Re: Line between 2 endlines
« Last post by FS_AT12 on May 17, 2024, 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
95
AutoLISP (Vanilla / Visual) / Re: Line between 2 endlines
« Last post by ribarm on May 17, 2024, 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.
96
AutoLISP (Vanilla / Visual) / Re: Line between 2 endlines
« Last post by FS_AT12 on May 17, 2024, 03:27:25 AM »
dear ribarm,

If the two lines are not parallel, like this situation, I end up with crossing lines.
The 4 points do not appear again.



A big help would be if the connection of the selected lines are part of a closed or open polyline,
so the connection would filter out just the segments of the whole polyline.
Currently, the connection is made from the first and the last vertex of the polyline, somewhere else than the selected segments.



97
OpenDCL / Re: HTML Opens in Internet Explorer, not Edge
« Last post by DW on May 17, 2024, 12:59:26 AM »
You could try setting an Internet Explorer registry entry to specify the MSIE User-Agent. Not sure if this will clear up issues on a sharepoint page but prevents a lot of script errors which would otherwise pop up.

By default it's not set when AutoCAD is installed (but is for BricsCAD).

The key can be checked and set with the following code:
CodeSelect
(if (not (vl-registry-read "HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\Main\\FeatureControl\\FEATURE_BROWSER_EMULATION" (strcat (getvar "program") ".exe")))
      (vl-registry-write "HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\Main\\FeatureControl\\FEATURE_BROWSER_EMULATION" (strcat (getvar "program") ".exe") 11001)
  )

Where the 11001 DWord value will force IE11 emulation instead of an older IE emulation.

More info here: https://www.devhut.net/webbrowser-activex-control-google-maps-invalid-character-scripting-error/
98
AutoLISP (Vanilla / Visual) / Re: Issue with Layout - Copy Command
« Last post by BIGAL on May 16, 2024, 09:33:25 PM »
No idea use copy layout a lot, but I am not on 2025, maybe (setvar 'ctab "Template") 1st then do copy layout.
99
AutoLISP (Vanilla / Visual) / Re: broke (Lee Macs) ScriptWriterV1-2.lsp
« Last post by Lonnie on May 16, 2024, 06:39:06 PM »
Tell me do you ever get tired of thanks?

(getvar 'ROAMABLEROOTPREFIX)
"C:\\Users\\lshaw\\AppData\\Roaming\\Autodesk\\AutoCAD 2025\\R25.0\\enu\\"


Removed
LMAC_WScript_V1.2.cfg
LMAC_WScript_V1.2.dcl
Reloaded and it works.


Thank you.


Double thank you.
"\\\\DT-LSHAW2\\dcapps"

works just fine in the cfg file.

PS it may be old but it's still a great tool





100
AutoLISP (Vanilla / Visual) / Re: broke (Lee Macs) ScriptWriterV1-2.lsp
« Last post by Lee Mac on May 16, 2024, 06:06:49 PM »
Try removing the corresponding LMAC_ prefixed files from the Support folder under ROAMABLEROOTPREFIX.

I must say the program is old and in dire need of improvement  :|
Pages: 1 ... 8 9 [10]