Announcements
Due to scheduled maintenance, the Autodesk Community will be inaccessible from 10:00PM PDT on Oct 16th for approximately 1 hour. We appreciate your patience during this time.
Visual LISP, AutoLISP and General Customization
cancel
Showing results forย 
Showย ย onlyย  | Search instead forย 
Did you mean:ย 

Lisp - Draw points at object intersections between 2 selections sets

8 REPLIES 8
SOLVED
Reply
Message 1 of 9
cool.stuff
237 Views, 8 Replies

Lisp - Draw points at object intersections between 2 selections sets

Hi ๐Ÿ™‚

 

I' ve found several lists that draws points at object intersections from a object selection set.

Is there any lisp that would draw points at intersections of 2 selections sets objects?

An example would be the first selection of lines and a second selection of another lines. Thus only lines intersections between those 2 selections sets will have points drawn and not on lines intersections belonging to the same selection set.

 

Could anyone help please?

Many thanks in advance

Labels (1)
8 REPLIES 8
Message 2 of 9
Moshe-A
in reply to: cool.stuff

@cool.stuff  hi,

 

Would share us what is the engineering purpose?

post sample drawing.

 

Moshe

 

 

 

 

Message 3 of 9
cool.stuff
in reply to: Moshe-A

Get the intersection points between some structural elements and solids edges.
I'll get a sample. Thanks
Message 4 of 9
Moshe-A
in reply to: cool.stuff

@cool.stuff ,

 

check this CROSS command

you need to define point type (like pdmode = 3)

 

this could not be done without (LM:intersections) function from great mr Lee Mac - thank you ๐Ÿ™

 

enjoy

Moshe

 

;; Intersections  -  Lee Mac
;; Returns a list of all points of intersection between two objects
;; for the given intersection mode.
;; ob1,ob2 - [vla] VLA-Objects
;;     mod - [int] acextendoption enum of intersectwith method

(defun LM:intersections ( ob1 ob2 mod / lst rtn )
    (if (and (vlax-method-applicable-p ob1 'intersectwith)
             (vlax-method-applicable-p ob2 'intersectwith)
             (setq lst (vlax-invoke ob1 'intersectwith ob2 mod))
        )
        (repeat (/ (length lst) 3)
            (setq rtn (cons (list (car lst) (cadr lst) (caddr lst)) rtn)
                  lst (cdddr lst)
            )
        )
    )
    (reverse rtn)
)


(defun c:cross (/ OBJPATT ss0 ss1 AcDbEntity0 AcDbEntity1 pt)
 (setq OBJPATT "*line,circle,arc,ray")
  
 (if (and
       (not (prompt "\nSelect group objects #1: "))
       (setq ss0 (ssget (list (cons '0 OBJPATT))))
       (not (prompt "\nSelect group objects #2: "))
       (setq ss1 (ssget (list (cons '0 OBJPATT))))
     )
  (progn
   (foreach AcDbEntity0 (mapcar 'vlax-ename->vla-object (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss0))))
    (foreach AcDbEntity1 (mapcar 'vlax-ename->vla-object (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss1))))
     (foreach pt (LM:intersections AcDbEntity0 AcDbEntity1 acExtendNone)
      (entmake (list '(0 . "POINT") (cons 10 (trans pt 1 0))))
     )  
    ); foreach
   ); foreach
  ); progn
 ); if

 (princ)
); c:cross

 

Message 5 of 9
cool.stuff
in reply to: Moshe-A

I've attached a sample dwg. If I select all red lines (continuous and dashed) as first selection set and then all green lines as second selection set, it would be possible to get the common nodes between red lines and green lines intersection? Just the common nodes between those two selection sets?

 

Many thanks in advance

Message 6 of 9
cool.stuff
in reply to: Moshe-A

Many many thanks ๐Ÿ™‚
Works like a charm ๐Ÿ™‚
Saved many hours!!!
Message 7 of 9
Moshe-A
in reply to: cool.stuff

@cool.stuff ,

 

 


@cool.stuff wrote:
Get the intersection points between some structural elements and solids edges.
I'll get a sample. Thanks

what do you mean by solid edges? the lisp supports only curve lines not solid objects

 

 

Message 8 of 9
cool.stuff
in reply to: Moshe-A

Ok, but they all are represented as lines, so ok ๐Ÿ™‚
since you asked the engineering purpose, I just stated it ๐Ÿ™‚
Thanks again ๐Ÿ™‚
Message 9 of 9
Moshe-A
in reply to: cool.stuff

note the lisp supports picking:

all kinds of line forms + arcs, circles, xline, rays

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

AutoCAD Inside the Factory


Autodesk Design & Make Report