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.SetPoint(0,c4d.Vector(14.202,475.695,0))
myPolygon.SetPoint(1,c4d.Vector(2.503,378.908,-42.934))
myPolygon.SetPoint(2,c4d.Vector(-250.225,-255.247,-42.934))
myPolygon.SetPoint(3,c4d.Vector(-288.184,-239.534,0))
myPolygon.SetPolygon(0, c4d.CPolygon(0,1,2,3))
pointTag= c4d.BaseTag(5674)
doc.SetSelection(pointTag, mode=c4d.SELECTION_ADD)
PointList=[1,2,3]
for i in PointList:
myPolygon.GetPointS().Select(i)
myPolygon.InsertTag(pointTag)
doc.InsertObject(myPolygon)
c4d.EventAdd()
if __name__=='__main__':
main()