Recent Posts

Pages: [1] 2 3 ... 10
1
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 (inters pt1 pt3 pt2 pt4 nil)
  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.
2
AutoLISP (Vanilla / Visual) / Re: Line between 2 endlines
« Last post by FS_AT12 on Today at 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.



3
OpenDCL / Re: HTML Opens in Internet Explorer, not Edge
« Last post by DW on Today at 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/
4
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.
5
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





6
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  :|
7
AutoLISP (Vanilla / Visual) / broke (Lee Macs) ScriptWriterV1-2.lsp
« Last post by Lonnie on May 16, 2024, 04:46:27 PM »
I was attempting to run off a UNC and I crashed my modified lisp. I now can not get his original to run (Even when I download a new file). It loads fine but here is what happens.

Command: WSCRIPT

** Error: bad argument type: stringp nil **

I went so far as to remove autocad from my registry and recreate it. Still no joy.

I also tried setting all the local vars back to ""
8
AutoLISP (Vanilla / Visual) / Re: Line between 2 endlines
« Last post by ribarm on May 16, 2024, 01:21:40 PM »
...so I end up with crossing lines instead of parallel lines...

I can not replicate this situation... Can you post *.DWG where this occur... Only small segment, not entire *.DWG as it could be forbidden sharing - if you work at such position in your organisation...
9
AutoLISP (Vanilla / Visual) / Re: Line between 2 endlines
« Last post by FS_AT12 on May 16, 2024, 12:59:43 PM »
It could be that I made mistake with (set) function... It requires symbols instead of lists... Corrected now and it should work...
OP, what do you mean - not create any lines at all? It's clearly written in my code : (command "_.line" ... )

Hi Ribarm, this was a reaction to the post of dexus.

Nevertheless, after your edit, it works fine as I tested it in some cases.
I do not get the error any more, it works on lines and on polylines (great!).
In some situations I get a wrong connection, so I end up with crossing lines instead of parallel lines, and 4 points are created.

Thank you!
10
AutoLISP (Vanilla / Visual) / Re: Line between 2 endlines
« Last post by FS_AT12 on May 16, 2024, 12:46:13 PM »
Dear ribarm,

Thank you for your prompt reply.
In 99% of the selections I get this
I get this Error:

(LIST PT4 PT3)
; in file :
; C:\Users\...\connect_with_lines.lsp
;
; error : bad argument type <(301.187543505381 100.629323961606 0.0)> ; expected <SYMBOL> at [set]
:

the lisp is failing if the lines are not parallel, or the lines are  polylines,
I really dont know why it is not working.
The original lisp I have posted, works in every situation. Connect_with_lines & the test lisp (dexus) are failing in nearly every situation, I do not really understand why?

Pages: [1] 2 3 ... 10