Visual LISP, AutoLISP and General Customization
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Insert block at intersecti on
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Does anyone know of a lisp that will insert a block at the intersection points of multiple lines or polylines? Basically it would ask you to select polylines or lines, then check to see where their intersections are with each other and insert a block at those points. See the attached image for what I am looking for.
Solved! Go to Solution.
Re: Insert block at intersecti on
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Two ways, starting with ssget "c" or "f":
1. Close the pline, by pedit if the ends are close enough, or add a pline to do so, and use it to ssget the crossing 'yellow' lines, and find the on-seg intersections of them with the pline; or
2. process each segment of the pline with a narrow ssget to find the crossing lines in that segment, so on.
Re: Insert block at intersecti on
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
one demonstration...
I use this file ( who attached) for make you program requested LISP/ARX..
Thanks...........
Re: Insert block at intersecti on
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
How's about this? Pick the main line (red), pick the crossing lines (yellow) and Bob's your aunty.
S
(defun c:sbx ( / )
(progn
(setq ent (car (entsel "\nSelect main line: ")))
(if ent
(progn
(princ "\nSelect crossing line(s): ")
(if (setq ss (ssget))
(progn
(setq count 0
obj (vlax-ename->vla-object ent)
pointlist nil
)
(repeat (sslength ss)
(setq xent (ssname ss count)
xobj (vlax-ename->vla-object xent)
)
(if (setq int (vla-IntersectWith obj xobj acExtendNone))
(progn
(setq int (vlax-safearray->list (vlax-variant-value int))
pointlist (append pointlist (list int))
)
)
)
(setq count (1+ count))
)
(if (null (tblobjname "BLOCK" "SBblock"))
(progn
(entmake (list (cons 0 "BLOCK") (cons 2 "SBblock") (cons 70 0) (list 10 0.0 0.0 0.0)))
(entmake '((0 . "LWPOLYLINE") (100 . "AcDbEntity") (8 . "0") (100 . "AcDbPolyline") (90 . 2) (70 . 1) (43 . 1.0) (38 . 0.0) (39 . 0.0)
(10 2.5 0.0) (40 . 1.0) (41 . 1.0) (42 . 1.0) (91 . 0)
(10 -2.5 0.0) (40 . 1.0) (41 . 1.0) (42 . 1.0) (91 . 0)
(210 0.0 0.0 1.0)
)
)
(setq blockname (entmake '((0 . "ENDBLK"))))
)
)
(foreach pt_nth pointlist
(entmake (append
'((0 . "INSERT") (100 . "AcDbEntity") (8 . "0") (100 . "AcDbBlockReference") (2 . "SBblock"))
(list (cons 10 pt_nth))
'((41 . 1.0) (42 . 1.0) (43 . 1.0) (50 . 0.0) (70 . 0) (71 . 0) (44 . 0.0) (45 . 0.0) (210 0.0 0.0 1.0))
)
)
)
)
)
)
)
)
(princ)
)
Re: Insert block at intersecti on
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Good work,
Just forgot to add
(vl-load-com) at the start of code,
do edition, please,
Regards
![]()
C6309D9E0751D165D0934D0621DFF27919
Re: Insert block at intersecti on
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Thanks scottbolton, that works great. I simiply changed the block name in the lisp and added (vl-load-com) to the beginning as Hallex pointed out and it worked. Thanks for the help.
Re: Insert block at intersecti on
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
You're welcome.
I use many vl-commands in many routines and so I have (vl-load-com) in my acaddoc.lsp.
S
