CAD Forum ► EN ► AutoCAD ► LISP to display aligned segments
Display full version of the post: LISP to display aligned segments
Edouard Lambert
05.07.2023, 09:49
Hello everyone,I'm a beginner in LISP, I started looking for myself but I'm stuck.I want to create a LISP which takes into account the polylines (or lines) of a given layer in my dwg drawing, and which displays in color (red for example) those which are aligned between them.My approach for this is the following: the code will decompose the polylines of my layer in order to make of them lines (segments), then it will analyze the properties of these lines, and change the color of those whose coordinates XY " start of line" and/or "end" are identical, AND whose angle is similar to 0.005 £ 200 grads (or 0.00008 £ ?? rad).I have attached the properties of the lines in AutoCAD.I work on AutoCAD MAP 2014, with Covadis 14. I hope that this is not a big constraint for this code...So far I have code that explodes my polylines and changes the color of the resulting lines to red (lsp attached).uploads/937907/test.lspuploads/937907/propri£t£s_ligne.pdf
Thanks in advance for your help ??Edouard
Edouard Lambert2023-07-05 09:50:27
Kent Cooper
06.07.2023, 14:28
[I get a 404 not-found error with the link for the PDF file.]Can you illustrate what you're talking about?I think [in the English-language page] the British-Pound-symbol character must be a substitution for something else, which makes it hard to understand what your "whose angle is similar to 0.005 ? 200 grads (or 0.00008 ? ?? rad)" means. [And since that same character is part of the link to the PDF, it may be the cause of its not being found.]EDIT: And after posting, I see the British-Pound symbols as I copied and pasted from the original post got re-substituted and became question marks. That makes me also suspect the original double question marks are also character substitutions.
Kent Cooper2023-07-06 14:35:21
Edouard Lambert
06.07.2023, 14:46
Hey,Sorry for the character issues.Here is the properties window for a line in AutoCAD.I would like the LISP to use X,Y Start and End, and Angle.I added an example, in which the lines colored in red are lines 2 and 3 (same start and/or end, same angle).Let me correct this sentence in my original message :"AND whose angle is similar to 0.005 more or less 200 grads (or 0.00008 more or less pi rad)."My question marks were actually exclamation point...Thanks
Kent Cooper
07.07.2023, 14:49
What do you want to do with the things that you want made red? If you want to identify them just so you can join them across the place where they meet, you can do that without Exploding Polylines, using OVERKILL with the right options -- blue for your 2 & 3 still as a Polyline, yellow for your 2 & 3 as separate Lines:
Kent Cooper2023-07-07 14:51:55