On 12/01/2015 at 18:39, xxxxxxxx wrote:
For some reason, I just cannot create a selection from a selection tag.
selTag = op.GetTag ( 5673 ) # Selection Tag ID = 5673
selection = selTag.GetBaseSelect ()
selection.Select ( selection.GetSegments () )
I've looked into SendModelingCommand, BaseSelect, GetPolygonS..
I just can't seem to get the polygon ID's from the Selection Tag in order to select them.
I'm not sure what I'm missing..
On 13/01/2015 at 06:43, xxxxxxxx wrote:
Select() is used to set the selection of an element with the given index, GetSegments() gets the number of segments. So these two functions should not be combined.
A object of the type BaseSelect stores a selection. You can manage multiple selections. So what you have to do is to get the selection stored in the selection tag and apply this selection to the selection of a polygon object. This can look like this:
if op == None:
# get the selection from the selection tag
selectionTag = op.GetTag(5673)
if selectionTag == None:
selection = selectionTag.GetBaseSelect()
# check the object and get the object poly selection
if op.GetType() != c4d.Opolygon:
polySelection = op.GetPolygonS()
if polySelection == None:
# deselect all and select all polygons marked in the tag's selection
count = op.GetPolygonCount()
for i in xrange(count) :
if selection.IsSelected(i) :
Technically, you should also check if the count of elements in the BaseSelect is the same as the count of polygons in the poly object.
On 13/01/2015 at 10:05, xxxxxxxx wrote:
Hello again and thank you!
I see where my confusion was. I had tried a lot of things last night and there was always a disconnect.
So a BaseSelect object is actually a virtual object with it's own selection, as opposed to holding just the selected parts.
For example, if you have a committed cube, it stores the entire state of the cube. I was under the impression that it was storing just the selected parts. Because of this, you're able to match the actual object to the BaseSelect object by looping through all the polygons.
Also, why do you have to have op.Message (c4d.MSG_UPDATE) AND c4d.EventAdd()?
Does c4d.EventAdd() not update the object correctly?
Again, thank you for your help! Slowly but surely I'm starting to get this!
On 14/01/2015 at 01:33, xxxxxxxx wrote:
a BaseSelect object holds an array of elements with the information if this element is selected or not. So the information stored is if a given index is selected or not. This index may refer to a polygon, point or edge.
When you edit a polygon object's selection given by GetPolygonS() you edit something of that polygon object but the object may not be aware of that change. Sending MSG_UPDATE will inform the object that something has changed and gives the object the opportunity to react accordingly.
EventAdd() will inform Cinema that something has changed. In this case it will cause a redraw of the viewport so you will see the new selection.
On 23/01/2015 at 08:18, xxxxxxxx wrote:
was your question answered?
On 29/01/2015 at 15:33, xxxxxxxx wrote:
Sorry for not responding sooner, but yes, my question has been answered.
Thank you again for all of your help and taking the time to explain the why as well.