TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: uncoolperson on July 24, 2008, 11:15:22 AM

Title: Code request
Post by: uncoolperson on July 24, 2008, 11:15:22 AM
normally i'd jump at the chance to write something up, but right now i just don't have the time to deal with screwing it up, and fixing it.

anyone have some lisp out there that will grab all the insertion points and end points of the entities in a selection set?

Thanks
Title: Re: Code request
Post by: ronjonp on July 24, 2008, 11:21:21 AM
What entity types are in the ss?
Title: Re: Code request
Post by: Jeff_M on July 24, 2008, 11:21:38 AM
More specific???? Insertion points of Text, Mtext, Attributes, Blocks, all of these? End points of lines, arcs, plines, splines, all of these?
Title: Re: Code request
Post by: T.Willey on July 24, 2008, 11:36:18 AM
Here is one way.

Code: [Select]
(defun c:Test (/ ss Ent PtList EntData EntType)
   
    (if (setq ss (ssget))
        (while (setq Ent (ssname ss 0))
            (setq EntData (entget Ent))
            (setq EntType (cdr (assoc 0 EntData)))
            (setq PtList
                (cond
                    (
                        (or
                            (= EntType "INSERT")
                            (= EntType "MTEXT")
                        )
                        (cons (cdr (assoc 10 EntData)) PtList)
                    )
                    ((= EntType "TEXT")
                        (cons
                            (if
                                (and
                                    (equal (cdr (assoc 72 EntData)) 0)
                                    (equal (cdr (assoc 73 EntData)) 0)
                                )
                                (cdr (assoc 10 EntData))
                                (cdr (assoc 11 EntData))
                            )
                            PtList
                        )
                    )
                    (t
                        (cons
                            (vlax-curve-getStartPoint Ent)
                            (cons
                                (vlax-curve-getEndPoint Ent)
                                PtList
                            )
                        )
                    )
                )
            )
            (ssdel Ent ss)
        )
    )
    PtList
)
Title: Re: Code request
Post by: uncoolperson on July 24, 2008, 11:45:26 AM
I think that should cover it, thanks... new guy doesn't get "on the grid", and it's driving me insane.