Filtro de Entidades con SelectionSets

#1
Buenas tardes...
Me encuentro desarrollando una rutina que me permita seleccionar un conjunto de entidades con características específicas.
Estoy trabajando con SelectionSet de VBA para consegir las entidades LWPOLYLINE cerrados y abiertos que hay en un dibujo, pero los filtros de esta instrucción no funcionan para obtener sólo las entidades cerradas o sólo las abiertas. Conocen otra forma de hacer esto???
Gracias...

[This message has been edited by darwin (edited 08-10-2006).]

[This message has been edited by darwin (edited 08-10-2006).]

#2
I have translated this to:

Good afternoon... I am developing a routine that allows to select a set me of organizations with specific characteristics. I am working with SelectionSet of VBA to consegir closed and opened organizations LWPOLYLINE that there is in a drawing, but the filters of this instruction do not work to obtain only the closed or only the open ones organizations. They know another form to do this? Thanks...

------------------
Regards
John Finlay

#3
Quiero utilizar SelectionSet de VBA para seleccionar un grupo de entidades LWPolyline. Este es el código:

Dim sel As SelectionSet
Dim filtro As Integer, valor As Variant
Dim doc As Document
Set doc = ActiveDocument

ReDim filtro(3)
ReDim valor(3)

filtro(0) = -4: valor(0) = "<AND"
filtro(1) = 0 : valor(1) = "LWPOLYLINE"
filtro(2) = 70: valor(2) = 1
filtro(3) = -4: valor(3) = "AND>"

Set sel = doc.SelectionSets.Add("select")
sel.Select vicSelectionSetAll, , , filtro, valor

...

Esto no selecciona las entidades Closed = True, selecciona TODAS las entidades LWPOLYLINE..

Gracias...

[This message has been edited by darwin (edited 08-11-2006).]

[This message has been edited by darwin (edited 08-11-2006).]

#4
Try this

Dim doc As Document
Set doc = ActiveDocument
Dim ssetObj As SelectionSet
Dim mode As Integer
Dim grpCode(1) As Integer
Dim dataVal(1) As Variant
'
Set ssetObj = doc.SelectionSets.Add("SS1")
grpCode(0) = 0: dataVal(0) = "LWPOLYLINE"
grpCode(1) = 70: dataVal(1) = 1
'
ssetObj.Select vicSelectionSetAll, , , grpCode, dataVal
'
'doc.Utility.Prompt vbLf + "Number of Objects Selected: " + CStr(ssetObj.Count)

#5
Muchas gracias amigo...
El problema está en IntelliCAD, el código no tiene errores, pero no arroja los resultados que se piden.
Se quiere conseguir las entidades LWPOLYLINE que estén cerradas (obj.Closed = True), pero no es lo que genera el resultado, este código agrupa todos las entidades LWPOLYLINE, pero no las agrupa por el Status Open Or Closed.

Muchas gracias por tu ayuda.

PD: Por favor reporta este error a los programadores de IntelliCAD.

#6
here is a work around It's ugly but it works

Sub SelectAllClosedPolylines()
Dim doc As Document
Set doc = ActiveDocument
Dim ssetObj As SelectionSet
Dim lispstr As String 'vbCRLF
lispstr = "(setq ss1 (ssget" & Chr(34) & "X" & Chr(34) & _
" '((0 . " & Chr(34) & "LWPOLYLINE" & Chr(34) & "))))" & _
"(setq ss2 (ssadd))(if ss1(progn(setq cnt (sslength ss1))" & _
"(while (> cnt 0)" & _
"(setq cnt (1- cnt))(setq el (entget (ssname ss1 cnt)))" & _
"(if (= (cdr (assoc 70 el)) 1)" & _
"(setq ss2 (ssadd (cdr (car el)) ss2))))" & _
"(command " & Chr(34) & "_select" & _
Chr(34) & " ss2" & Chr(34) & Chr(34) & ")))"
RunCommand (lispstr)
RunCommand ("(setq ss1 nil)")
RunCommand ("(setq ss2 nil)")
RunCommand ("(setq cnt nil)")
RunCommand ("(setq el nil)")
Set ssetObj = doc.SelectionSets.Add("SS1")
ssetObj.Select vicSelectionSetPrevious
End Sub
cron