| Author |
Message |
srinivasan
Guest
|
Posted:
Wed Feb 23, 2005 3:38 pm Post subject:
Previous selection set |
|
|
Dear all,
I am using the selection set to filter required objects,
which works well and good.The problem i have is after
making selection with this method the previous selection set
method selects only the filtered objects and not the exact previous set.but i want to retain the previous selection as in autocad.Is there any other method to do this, or is it possible to make any named selection set the previous one.
Thanks in advance.
Sri
|
|
| Back to top |
|
 |
Oberer
Guest
|
Posted:
Thu Feb 24, 2005 2:48 am Post subject:
Re: Previous selection set |
|
|
Could you explain this a little better? The way I read this is that you create a sel set via vba, then select the same sel set.
perhaps you could create two sel set objects. After processing, set thisdrawing.activeselectionset to the 1st... |
|
| Back to top |
|
 |
srinivasan
Guest
|
Posted:
Thu Feb 24, 2005 10:02 am Post subject:
Re: Previous selection set |
|
|
Thanks for your reply.
Actually i am creating a selection set filtering text objects and performing certain check operations on few texts.
After completing this check,when i say copy command and say previous it selects all the text objects.So i tried to store the previous selectionset before performing this operation and after completing the check process now i want to assign the selection set which i stored to the previous selection set.
I couldnt get this.I am looking for a solution for this problem.
Expecting your reply.
With regards
Sri
|
|
| Back to top |
|
 |
Oberer
Guest
|
Posted:
Thu Feb 24, 2005 5:32 pm Post subject:
Re: Previous selection set |
|
|
"Actually i am creating a selection set filtering text objects and performing certain check operations on few texts."
| Quote: | Let's call that OrigSS
|
After completing this check,when i say copy command and say previous it selects all the text objects.
| Quote: | without posting code srin, it's difficult to understand what you mean when you say "i say copy command and say previous"
|
"So i tried to store the previous selectionset before performing this operation and after completing the check process now i want to assign the selection set which i stored to the previous selection set.
I couldnt get this.I am looking for a solution for this problem."
Does this mean you want to copy the entire selection set, or the entities you modified?
is this similar to what you have?
| Code: |
'return a selection set of text & mtext
Public Sub test()
Dim oEnt As AcadEntity
Dim oEntCopy As AcadEntity
Dim ssetObj As AcadSelectionSet
Dim grpCode(0 To 3) As Integer
Dim dataVal(0 To 3) As Variant
ThisDrawing.StartUndoMark
'create a new selection set object
Set ssetObj = vbdPowerSet("SS01")
' Build a selection set of group codes and values to filter for: Text or Mtext.
grpCode(0) = -4
dataVal(0) = "<OR"
grpCode(1) = 0
dataVal(1) = "TEXT"
grpCode(2) = 0
dataVal(2) = "MTEXT"
grpCode(3) = -4
dataVal(3) = "OR>"
'prompt for user to select text
ssetObj.SelectOnScreen grpCode, dataVal
For Each oEnt In ssetObj
'your code here
Set oEntCopy = oEnt.Copy()
Next
End Sub
|
|
|
| Back to top |
|
 |
srinivasan
Guest
|
Posted:
Fri Feb 25, 2005 9:47 am Post subject:
Re: Previous selection set |
|
|
Thanks Oberer for your reply.
Yes i am performing a similar task as given by you with a small change.
Public Sub test()
Dim oEnt As AcadEntity
Dim oEntCopy As AcadEntity
Dim ssetObj As AcadSelectionSet
Dim grpCode(0 To 3) As Integer
Dim dataVal(0 To 3) As Variant ThisDrawing.StartUndoMark
'create a new selection set object
Set ssetObj = vbdPowerSet("SS01")
' Build a selection set of group codes and values to filter for: Text or Mtext.
grpCode(0) = -4 dataVal(0) = "<OR" grpCode(1) = 0 dataVal(1) = "TEXT" grpCode(2) = 0 dataVal(2) = "MTEXT" grpCode(3) = -4 dataVal(3) = "OR>"
'prompt for user to select text ssetObj.SelectOnScreen grpCode, dataVal
For Each oEnt In ssetObj
if objent.textstring="sample" then
objent.textstring="Sample object"
end if
Next
End Sub
after completing this procedure i just issue the command
copy and in the select objects prompt i just say "previous".
Now it selects all the text object which i selected using the test procedure.So what i did was stored all the text which satisfied my condition in a objectarray and tried to make that as the previous selection set.
Thisdrawing.activeselectionset.clear
Thisdrawing.activeselectionset.additems objectarray
But still i am not getting the previous selection as i expected,it selects all the text objects.
Expecting your solution.
thanks in advance.
With regards
Sri |
|
| Back to top |
|
 |
Oberer
Guest
|
Posted:
Fri Feb 25, 2005 6:06 pm Post subject:
Re: Previous selection set |
|
|
hopefully someone else can help you with this. i haven't tested it anything, but the help says:
"ActiveSelectionSet
SelectionSet object; read-only
The active selection set for the drawing.
" |
|
| Back to top |
|
 |
viswanathan
Guest
|
Posted:
Thu Mar 17, 2005 4:18 pm Post subject:
Re: Previous selection set |
|
|
Hi,
I am writing like this :
Public Sub selectionsettest()
Set sset1 = ThisDrawing.SelectionSets.Add("ss12")
Dim ssetcons(0) As Integer
Dim ssetvalue(0) As Variant
ssetcons(0) = 0
ssetvalue(0) = "LWPOLYLINE"
sset1.SelectOnScreen ssetcons, ssetvalue
For Each ent1 In sset1
MsgBox ent1.Handle
Next ent1
sset1.Select acSelectionSetPrevious, , , ssetcons, ssetvalue
For Each ent1 In sset1
ent1.Color = acYellow
Next ent1
sset1.Delete
End Sub
Test and Let me know
viswanathan.s |
|
| Back to top |
|
 |
srinivasan
Guest
|
Posted:
Fri Mar 18, 2005 3:13 pm Post subject:
Re: Previous selection set |
|
|
That is not what i was looking.
Actually you are selecting the same entity which was selected by the user.
Assume that i issued copy command and selected two objects from the drawing and copied it to some other location.
Now my previous selection set is those two objs i had selected previously.
I am storing this set in a selection set variable (sset1).
After which i run a vbafunction and making a selection set(sset2).
Now the previous elements goes to the selection set objects
selected by the vba function (sset2).
Now wanti need is make the sset1 as the previous one.
Regards
Sri |
|
| Back to top |
|
 |
James Belshan
Guest
|
Posted:
Sat Mar 19, 2005 3:27 am Post subject:
Re: Previous selection set |
|
|
Sri,
To paraphrase you, it sounds like you want the same items to be selected by
the "P" option AFTER your program runs as would have been selected BEFORE
your program ran. You don't want your program to change the "Previous"
selection set, correct?
I tried to find a solution and couldn't. The only idea I could think of was
to try to create a second selection set at the end of your program, so that
it would become the "P" selection set. I was going to store the handles of
the active selection set at the beginning of the macro, and then use a
filter on entity handles, to make a selection set of those same entities at
the macro's end. But VBA won't let you make a filter based on handles. And
neither will the LISP function (ssget), so I couldn't even use SendCommand
to make a filtered ss. I even tried using (ssget) followed by (handent),
but these don't work together.
Maybe someone else knows how to build a selection set of specific entities?
You could always create a new unique layer, move all the objects onto that
layer, filter by that layer at the end of your macro, and change the
entities all back to their original layers. But that's a lot of work.
James
"srinivasan" <nospam@address.withheld> wrote in message
news:7952788.1111140817422.JavaMail.jive@jiveforum1.autodesk.com...
| Quote: | That is not what i was looking.
Actually you are selecting the same entity which was selected by the user.
Assume that i issued copy command and selected two objects from the
drawing and copied it to some other location.
Now my previous selection set is those two objs i had selected previously.
I am storing this set in a selection set variable (sset1).
After which i run a vbafunction and making a selection set(sset2).
Now the previous elements goes to the selection set objects
selected by the vba function (sset2).
Now wanti need is make the sset1 as the previous one.
Regards
Sri |
|
|
| Back to top |
|
 |
|
|
|
|