Author Topic: Code request  (Read 1588 times)

0 Members and 1 Guest are viewing this topic.

uncoolperson

  • Guest
Code request
« 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

ronjonp

  • Needs a day job
  • Posts: 7526
Re: Code request
« Reply #1 on: July 24, 2008, 11:21:21 AM »
What entity types are in the ss?

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

Jeff_M

  • King Gator
  • Posts: 4088
  • C3D user & customizer
Re: Code request
« Reply #2 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?

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Code request
« Reply #3 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
)
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

uncoolperson

  • Guest
Re: Code request
« Reply #4 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.