Author Topic: xdata ssget  (Read 7181 times)

0 Members and 1 Guest are viewing this topic.

ronjonp

  • Needs a day job
  • Posts: 7529
xdata ssget
« on: October 12, 2005, 12:28:21 PM »
Why won't this work: 
Code: [Select]
(ssget "X" '((-3 ("WID_Node" (1005 . "0")))))
The block has this xdata in it:

Code: [Select]
(-3 ("WID_Node" (1005 . "0") (1040 . 42.1855)) ("WID_Sprinkler" (1071 . 2010)
(1005 . "0") (1070 . 0) (1070 . 0) (1070 . 0) (1070 . -1) (1040 . 1.5708) (1040
. 19.8122) (1070 . 0)) ("WID_ObjectType" (1070 . 3)))


But it won't make the sset?

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

Fatty

  • Guest
Re: xdata ssget
« Reply #1 on: October 12, 2005, 12:49:35 PM »
Why won't this work: 
Code: [Select]
(ssget "X" '((-3 ("WID_Node" (1005 . "0")))))
The block has this xdata in it:

Code: [Select]
(-3 ("WID_Node" (1005 . "0") (1040 . 42.1855)) ("WID_Sprinkler" (1071 . 2010)
(1005 . "0") (1070 . 0) (1070 . 0) (1070 . 0) (1070 . -1) (1040 . 1.5708) (1040
. 19.8122) (1070 . 0)) ("WID_ObjectType" (1070 . 3)))


But it won't make the sset?


Sorry I can't to test this but you will try something like this

(setq ss (ssget "_x" (list (list -3 (list 1005 . "0"))))



ronjonp

  • Needs a day job
  • Posts: 7529
Re: xdata ssget
« Reply #2 on: October 12, 2005, 12:54:09 PM »
fatty,

This is what i get:

; error: bad argument type: consp "0"

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: xdata ssget
« Reply #3 on: October 12, 2005, 12:57:31 PM »
If memory serves me correctly you cannot filter beyond the appid name.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

Fatty

  • Guest
Re: xdata ssget
« Reply #4 on: October 12, 2005, 03:51:50 PM »
Quote


Sorry I can't to test this but you will try something like this

(setq ss (ssget "_x" (list (list -3 (list 1005 . "0"))))




I think better yet:

Code: [Select]
(ssget "_X" (list(list -3(list "WID_Node" ))))

ronjonp

  • Needs a day job
  • Posts: 7529
Re: xdata ssget
« Reply #5 on: October 12, 2005, 04:50:46 PM »
That does the same as:

(ssget "X" '((-3 ("WID_Node"))))

I was trying to get the APPID and match data as well.

Thanks,

Ron

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

Serge J. Gianolla

  • Guest
Re: xdata ssget
« Reply #6 on: October 12, 2005, 07:40:47 PM »
Check Rakesh's site:
http://www.4d-technologies.com/techcenter/index.htm
in the Selection section, have a look at SSgetXD. It can always be modified to suit!

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: xdata ssget
« Reply #7 on: October 12, 2005, 10:24:33 PM »
In this post I penned this --

Code: [Select]
(defun RemoveFromPicksetIf ( ss func )
    ;;  The supplied func must take one
    ;;  argument, an ename. What it does
    ;;  we don't care, but if it returns
    ;;  a non nil result remove the entity
    ;;  from the pickset
    (if (eq 'pickset (type ss))
        (repeat (setq i (sslength ss))
            (if
                (func
                    (setq ename
                        (ssname ss
                            (setq i (1- i))
                        )
                    )
                )
                (ssdel ename ss)
            )
        )
    )
    ss
)

Which you could then use thusly --

Code: [Select]
(setq ss
    (RemoveFromPicksetIf
        (ssget "X" '((-3 ("WID_Node"))))
        (lambda ( ename / xdata )
            (cond
                (   (null
                        (setq xdata
                            (assoc -3
                                (entget ename
                                   '("WID_Node")
                                )
                            )
                        )
                    )
                )
                (   (null
                        (member
                           '(1005 . "0")
                            (cdadr xdata)
                        )
                    )
                )
            )
        )
    )
)

Coded blind but gotta be close.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

ronjonp

  • Needs a day job
  • Posts: 7529
Re: xdata ssget
« Reply #8 on: October 13, 2005, 09:52:05 AM »
Thanks guys :). I'll take a look at this today and let you know how it works.

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: xdata ssget
« Reply #9 on: October 13, 2005, 10:16:55 AM »
This is a tad more succinct --

Code: [Select]
(setq ss
    (RemoveFromPicksetIf
        (ssget "X" '((-3 ("WID_Node"))))
        (lambda ( ename / xdata )
            (or
                (null
                    (setq xdata
                        (assoc -3
                            (entget ename
                               '("WID_Node")
                            )
                        )
                    )
                )
                (null
                    (member
                       '(1005 . "0")
                        (cdadr xdata)
                    )
                )
            )
        )
    )
)
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

Andrea

  • Water Moccasin
  • Posts: 2372
Re: xdata ssget
« Reply #10 on: October 13, 2005, 01:40:38 PM »
can you send us the file...so we can test..
Keep smile...