BuDuS
Guest
I'm trying to do vba commands to create a selection based on a certain criterion.
for example "select according to a certain layer"; In particular, I would like the user to have the possibility to select the geometries according to the feature of the pre-selected one (or, if he has not selected anything, let him select it after ... a little like many of the autocad commands).
I can already create a "selectionset" with stuff like this:
had, the geometries are represented as selected but, in fact, they are not: any command I take - manually -successively is how I had not selected anything.
for example "select according to a certain layer"; In particular, I would like the user to have the possibility to select the geometries according to the feature of the pre-selected one (or, if he has not selected anything, let him select it after ... a little like many of the autocad commands).
I can already create a "selectionset" with stuff like this:
Code:
' seleziona per layer
public sub selectlayer()
dim acobject as object
set acobject = udagetselection
set objselcol = thisdrawing.selectionsets
for each objselset in objselcol
if objselset.name = "udapower" then
objselcol.item("udapower").delete
exit for
end if
next
on error goto exit_sub
dim objlayername as string
objlayername = acobject.layer
dim ssett as acadselectionset
set ssett = thisdrawing.selectionsets.add("udapower")
dim filtertype(0 to 1) as integer
dim filterdata(0 to 1) as variant
'filtertype(0) = 0: filterdata(0) = "line"
filtertype(0) = 8: filterdata(0) = objlayername
filtertype(1) = 8: filterdata(1) = objlayername
ssett.select acselectionsetall, , , filtertype, filterdata
if ssett.count < 1 then
msgbox "errore: non è stato selezionato nulla.", vbcritical, "selection error"
else
ssett.highlight true
end if
exit_sub:
end sub
What's the problem?the call to:it is necessary to return the pre-selected object (the one that exploits to create the next selection, according to its characteristics, in this case the layer name) or in any case select one to the user.Code:set acobject = udagetselection
had, the geometries are represented as selected but, in fact, they are not: any command I take - manually -successively is how I had not selected anything.
Does anyone have a right to give me to make sure that he can convert this "internal to vba" selection into something that can use the user?selection works if I use it with some vba routine and this indicates that the code above somehow creates a selection.