Author Topic: exploding a ssget  (Read 2412 times)

0 Members and 1 Guest are viewing this topic.

DEVITG

  • Bull Frog
  • Posts: 481
exploding a ssget
« on: October 24, 2004, 02:12:24 PM »
I have this code parta to selecte all POINT on a drawing

Code: [Select]
(DEFUN SELECIONEPUNTOS ()

;;;  (SETQ PUNTOS-EJE-X (SSGET "X"

(setq PUNTOS-EJE-X (ssget "X" '((0 . "POINT"))) )
(SETQ CANT-PUNTOS (SSLENGTH PUNTOS-EJE-X))
 



So I have the selection set , and the number of point on that selection.

QUESTION

How do I get all the entitys names and the x,y,z coordinates of each poitn

Thanks
Location @ Córdoba Argentina Using ACAD 2019  at Window 10

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
exploding a ssget
« Reply #1 on: October 24, 2004, 02:28:33 PM »
You need to iterate through the selection set and get the insertion point from each one.
Code: [Select]

(setq index 0)
(repeat (sslength PUNTOS-EJE-X))
(setq DXF10 (cdr (assoc 10 (entget (ssname PUNTOS-EJE-X index)))))
;;;add your code here
(setq index (1+ index))
)
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

David Bethel

  • Swamp Rat
  • Posts: 656
exploding a ssget
« Reply #2 on: October 24, 2004, 04:05:23 PM »
I take a litlle different approach;

Code: [Select]


(defun SELECTPOINTS (/ ss i en ed ip fl)

(and (setq ss (ssget "X" '((0 . "POINT"))))
     (setq i (sslength ss))
     (while (not (minusp (setq i (1- i))))
            (setq en (ssname ss i)
                  ed (entget en)
                  ip (cdr (assoc 10 ed))
                  fl (cons (cons en ip) fl))))
fl)



-David
R12 Dos - A2K

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
exploding a ssget
« Reply #3 on: October 24, 2004, 06:28:05 PM »
And a little of both:
Code: [Select]
(defun selectpoints (/ ss en fl)
  (and (setq ss (ssget "X" '((0 . "POINT"))))
       (repeat (sslength ss)
         (setq fl (cons (cons (setq en (ssname ss 0))
                              (cdr (assoc 10 (entget en)))) fl))
         (ssdel en ss)))
  fl
)
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
exploding a ssget
« Reply #4 on: October 24, 2004, 07:26:46 PM »
And yet another:

Code: [Select]
(defun SelectPoints ( / ss i ename result )
    (if (setq ss (ssget "x" '((0 . "point"))))
        (repeat (setq i (sslength ss))
            (setq result
                (cons
                    (cons
                        (setq ename (ssname ss (setq i (1- i))))
                        (cdr (assoc 10 (entget ename)))
                    )
                    result
                )
            )
        )
    )
    result
)
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

daron

  • Guest
exploding a ssget
« Reply #5 on: October 25, 2004, 07:57:11 AM »
So DevitG, How do you like your code served up: Sunnyside up, Over-easy or over-hard?