Adding points to point selection tag in python

On 08/11/2015 at 05:44, xxxxxxxx wrote:

Hi everyone,
I'm a beginner at python (scripting) trying to make a script which would create polygons and let the user adjust certain points.
So my solution is pre-set a points selection tag then setup a user data interface and connect it in xpresso.
I have the code below and it create and insert point selection tag to the object but the tag is empty.
Could anyone one tell me why please?

import c4d
from c4d import documents
def main() :
    doc = documents.GetActiveDocument()
    myPolygon = c4d.BaseObject(c4d.Opolygon)
    myPolygon.ResizeObject(4,1) #New number of points, New number of polygons
    myPolygon.SetPolygon(0, c4d.CPolygon(0,1,2,3))
    pointTag= c4d.BaseTag(5674) 
    doc.SetSelection(pointTag, mode=c4d.SELECTION_ADD)
    for i in PointList:

if __name__=='__main__':

On 08/11/2015 at 06:53, xxxxxxxx wrote:

You never add any points to the selection tag. You select points on the object itself, but that doesn't fill a selection tag with data.

doc.SetSelection() deals with objects, not points. (I'm actually not sure what happens in your case because the pointTag is not in the document at the execution time at all...)

Use GetBaseSelect() on your tag to retrieve a BaseSelect which you can then fill with your selected points.

On 09/11/2015 at 01:54, xxxxxxxx wrote:


as Cairyn already stated, you don't edit the Point Selection Tag but the point selection of the polygon object. To access the BaseSelect object storing the selection of the tag use GetBaseSelect().

You find a related topic with example code how to handle selections here:

Also, please do not cross post on different online boards or at least include links to already existing threads on the topic.

Best wishes,

On 20/11/2015 at 09:12, xxxxxxxx wrote:

Hello online,

was your question answered?

Best wishes,