Author Topic: ssget filter objects  (Read 3906 times)

0 Members and 1 Guest are viewing this topic.

TopoWAR

  • Newt
  • Posts: 135
ssget filter objects
« on: January 14, 2012, 11:27:57 AM »
hello to all the teachers for help.
Code: [Select]
name of the entity
(setq name (car (entsel)))

;create "Projects" to add names of projects
(vlax-ldata-put name "Proyectos" (list '("Proyecto1")))

;records data on projects
(vlax-ldata-put name "Proyecto1" (list '("datos de proyecto1 bla bala bla etc")))


Now the question: ŋ how I can filter only using ssget project1 objects ?

« Last Edit: January 14, 2012, 11:34:22 AM by TopoWAR »
Thanks for help

ribarm

  • Gator
  • Posts: 3309
  • Marko Ribar, architect
Re: ssget filter objects
« Reply #1 on: January 14, 2012, 12:50:30 PM »
Maybe this :

Code: [Select]
(defun ssldatabyent (projfilter filter / ent ss sss k)
  (vl-load-com)
  (setq ss (ssget "_X"))
  (setq sss (ssadd))
  (repeat (setq k (sslength ss))
    (if (equal (vlax-ldata-get (setq ent (ssname ss (setq k (1- k)))) projfilter) filter) (ssadd ent sss))
  )
  sss
)

(sssetfirst nil (ssldatabyent "Proyectos" (list '("Proyecto1"))))

M.R.
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

Lee Mac

  • Seagull
  • Posts: 12926
  • London, England
Re: ssget filter objects
« Reply #2 on: January 14, 2012, 12:56:32 PM »
I would use xData over lData, since you can then filter for the xData AppID in the ssget filter list; also, lData has been known to corrupt drawings in some cases.

TopoWAR

  • Newt
  • Posts: 135
Re: ssget filter objects
« Reply #3 on: January 14, 2012, 01:05:23 PM »
Thanks ribarm.
Lee Mac, I recommend using better xdata, but you have an example of how to record and retrieve data using xdata? also the example of filtering using ssget xdata?
by teacher
Thanks for help

TopoWAR

  • Newt
  • Posts: 135
Re: ssget filter objects
« Reply #4 on: January 14, 2012, 05:18:52 PM »
create extended data objects

Code: [Select]
(regapp "TopoWAR")

(Setq oldlist (entget (car (entsel))))

(setq thedata '((-3 ("TopoWAR" (1000 . "ESTO ES UNA PRUEBA") (1000 . "SEGUNDA PRUEBA")))))

(setq newlist (append oldlist thedata))

(entmod newlist)

(setq elist (entget (car (entsel)) '("TopoWAR")))

I do not want to store data in objects, as I do? I can use (namedobjdict)?
Thanks for help

Lee Mac

  • Seagull
  • Posts: 12926
  • London, England
Re: ssget filter objects
« Reply #5 on: January 14, 2012, 07:14:52 PM »
xData can be filtered using the AppID in the ssget filter list:

Code: [Select]
(ssget "_X" '((-3 ("TopoWAR"))))
However, you cannot filter lower than the AppID from an ssget filter list, if you wanted to filter lower, you would need to iterate over the set and operate on only those entities matching a certain criteria.

However, as I'm sure you can see, even filtering the initial set by an xData AppID significantly reduces the number of objects to be checked so you are left with few, if none, that are not required.

Amsterdammed

  • Guest
Re: ssget filter objects
« Reply #6 on: April 02, 2013, 01:31:08 PM »
I know this tread is old but for me it is a thing i work on right now.

Lee says you can't filter down the appid. but i have an example code:

Code: [Select]
  (SETQ FLT '((-4 . "<AND")




              (0 . "lwpolyline")

              (8 . "0-scs-et-ruimtelijnen")
              (-3 ("scs-ruimte-data" (1000 . "")))
;;;             (8 . "klasse ruimte")
;;;

              (-4 . "AND>")
              )
        ) ;_ end of SETQ



  (setq flt (subst (cons -3
                         (list (list "scs-ruimte-data"
                                     (cons 1000 rn)
                                     ) ;_ end of list
                               ) ;_ end of list
                         ) ;_ end of cons
                   (assoc -3 flt)
                   flt
                   ) ;_ end of subst
        ) ;_ end of setq
  (setq ss (ssget "x" flt))



Rn is a variable with a room number. that works in a drawing finding polylines with xdata like that:

Code: [Select]
(("scs-ruimte-data"
   (1002 . "{")
   (1000 . "RN")
   (1000 .
"Na-006"
   )
   (1000 . "RO")
   (1000 . "traumakamer 2")
   (1000 . "RD")
   (1000 . "00 /
283-669")
   (1000 . "RA")
   (1000 . "70.27 mē")
   (1000 . "PLAFOND")
   (1000 . "plafond
 3000+")
   (1000 . "KLASSE")
   (1000 . "K3")
   (1002 . "}")
 )
)

but why does then


 
Code: [Select]
(SETQ FLT '((-4 . "<AND")




    (0 . "insert")

   
    (-3 ("scs-pl-info" (1000 . "51C634")))



    (-4 . "AND>")
   )
)
(setq ss (ssget "x" flt))



not work on that xdata
Code: [Select]
(("scs-pl-info"
   (1002 . "{")
   (1000 . "handle")
   (1000 .
"51C634"
   )
   (1002 . "}")
 )
  ("Nordined.Technics"
    (1002 . "{")
    (1000 . "Length")
    (1040 . 0.0)
    (1000 . "Segment")
    (1070 . 0)
    (1000 . "Flexible")
    (1070 . 0)
    (1000
      .
      "Section"
    )
    (1071 . 0)
    (1002 . "}")
  )
  ("Nordined.Technics.PipeSys"
    (1002 . "{")
    (1000 . "Code")
    (1000 . "LS-1")
    (1000 . "Descr")
    (1000 . "Vlampijp
Fit-Ril-Boren")
    (1000 . "PipeDef.Code")
    (1000 . "CVA")
    (1000 . "PipeDef.Descr")
    (1000 . "CV-Leidingen A")
    (1000 . "Discipline.Code")
    (1000 . "56")
    (1000 .
  "Discipline.Descr"
    )
    (1000 . "Warmtedistributie")
    (1000 . "NlSfb.Code")
    (1000 .
  "CVA"
    )
    (1000 . "NlSfb.Formulier")
    (1071 . 0)
    (1000 . "NlSfb.NlSfbCode")
    (1000 .
  "5611"
    )
    (1000 . "AppCode.Code")
    (1000 . "LEI")
    (1000 . "AppCode.Descr")
    (1000 .
  "Leiding"
    )
    (1000 . "Flexible")
    (1070 . 0)
    (1000 . "Slope")
    (1040 . 0.0)
    (1000 .
  "AlwaysAddPipeToTwo45"
    )
    (1070 . 0)
    (1000 . "BranchAsSewer")
    (1070 . 0)
    (1002 .
  "}"
    )
  )
  ("Nordined.Technics.Part"
    (1002 . "{")
    (1000 . "Descr")
    (1000 . "DN65")
    (1000 . "DisplayModule")
    (1000 . "Handle")
    (1000 . "DisplayApp")
    (1000 . "C#")
    (1000 . "LengthVariable")
    (1000 . "False")
    (1000 . "DisplayImage")
    (1000 .
  "HND_BED"
    )
    (1000 . "Angle")
    (1040 . 0.0)
    (1000 . "ArticleNr")
    (1000 .
  "X5CrNi18"
    )
    (1000 . "Domain.Code")
    (1000 . "APD")
    (1000 .
  "Interpretation.Code"
    )
    (1000 . "C")
    (1000 . "Manufacturer.Code")
    (1000 .
  "ERIKS"
    )
    (1000 . "Manufacturer.Descr")
    (1000 . "Eriks")
    (1000 .
  "Material.Code"
    )
    (1000 . "S")
    (1000 . "Material.Descr")
    (1000 . "Staal")
    (1000
      .
      "SubType.Code"
    )
    (1000 . "HND")
    (1000 . "SubType.Descr")
    (1000 . "Handgreep")
    (1000 . "NodeImpl.Code")
    (1000 . "BED")
    (1000 . "NodeImpl.Descr")
    (1000 .
  "Bediening"
    )
    (1000 . "Type.Code")
    (1000 . "BED")
    (1000 . "Type.Descr")
    (1000 .
  "Bediening"
    )
    (1000 . "UseBlock")
    (1000 . "False")
    (1000 . "SizeDescr")
    (1000 .
  "65"
    )
    (1000 . "IsDBPart")
    (1070 . 1)
    (1000 . "IsUserContent")
    (1070 . 0)
    (1002
      .
      "}"
    )
  )
  ("Nordined.Technics.DP"
    (1002 . "{")
    (1000 . "BDTYP:>Descr")
    (1000 .
  "Bediening - Type"
    )
    (1000 . "BDTYP:>DoubleVal")
    (1040 . 1.0)
    (1000 .
  "BDL:>Descr"
    )
    (1000 . "Bediening - Lengte")
    (1000 . "BDL:>DoubleVal")
    (1040 .
  200.0
    )
    (1000 . "BDD:>Descr")
    (1000 . "Bediening - Diameter")
    (1000 .
  "BDD:>DoubleVal"
    )
    (1040 . 65.0)
    (1000 . "BDH:>Descr")
    (1000 . "Bediening -
Hoogte")
    (1000 . "BDH:>DoubleVal")
    (1040 . 74.0)
    (1002 . "}")
  )
)


? i don't get it.... :cry:

Lee Mac

  • Seagull
  • Posts: 12926
  • London, England
Re: ssget filter objects
« Reply #7 on: April 02, 2013, 02:50:50 PM »
Lee says you can't filter down the appid.

So does the documentation  :-P

Selection Set Filter Lists
Quote
The ssget function recognizes all group codes except entity names (group -1), handles (group 5), and xdata codes (groups greater than 1000)

See also: Filtering for Extended Data

Amsterdammed

  • Guest
Re: ssget filter objects
« Reply #8 on: April 02, 2013, 06:42:43 PM »
i don't see anything  in those two links that explains why example 1 works and 2 does not :|

Lee Mac

  • Seagull
  • Posts: 12926
  • London, England
Re: ssget filter objects
« Reply #9 on: April 02, 2013, 06:44:42 PM »
i don't see anything  in those two links that explains why example 1 works and 2 does not :|

I don't see that 'example 1' works since the DXF group 1000 filter ("") has not actually been matched.

Amsterdammed

  • Guest
Re: ssget filter objects
« Reply #10 on: April 02, 2013, 08:19:24 PM »
I substitute that in later in the code shown with the rn variable i read out some text....



Code: [Select]
(setq flt (subst (cons -3
                         (list (list "scs-ruimte-data"
                                     (cons 1000 rn)
                                     ) ;_ end of list
                               ) ;_ end of list
                         ) ;_ end of cons
                   (assoc -3 flt)
                   flt
                   ) ;_ end of subst
        ) ;_ end of setq

Amsterdammed

  • Guest
Re: ssget filter objects
« Reply #11 on: April 02, 2013, 08:21:27 PM »
believe me, example 1 works here, so i got all exited!!
 :laugh:

then example 2 didn't and i was back to foreach the ss converted to a list  :-(