The samples under the GetUserDataContainer () and RemoveUserData seem to be other way around. Not a big deal but..
Posts made by SteveJLV
-
Info GetUserDataContainer and RemoveUserData switched
-
RE: How to use FILEOPEN_APPEND in the HyperFile Class ?
I saved to a different directory and made shure that nothing was write protected, but still the "APPEND" mode throws an error.
-
RE: How to use FILEOPEN_APPEND in the HyperFile Class ?
Apparantly the file gets saved as a read-only file.
-
How to use FILEOPEN_APPEND in the HyperFile Class ?
if I replace the mode = c4d.FILEOPEN_WRITE with c4d.FILEOPEN_APPEND in the example as given in the SDK documentation I get a "cannot open file to write"- error.
What am I doing wrong? It works fine with the "mode = c4d.FILEOPEN_WRITE "and after running this I get:
-
RE: How to get to the str-value in a UserData Integer Cycle
@stevejlv I found a workaround: the value part in the value;string Cycle option list does not have to be 0,1,2 etc.
So I can give them the exact value as the string part (as long as they are int) and get the value I want the old fashioned way: [c4d.ID_USERDATA,1] -
RE: How to get to the str-value in a UserData Integer Cycle
@s_bach Thanks for your reply, So I guess there is no 'easy' way to get the label value.
I was working in a Python Generator's Object code and so filed my question under Python, my bad.
I'll try to get it right with my next question.
and yes I meant this one: -
How to get to the str-value in a UserData Integer Cycle
To get the USERDATA from op we simply use, for instance: op[c4d.ID_USERDATA,7]
this will give us the value from the chosen option index (7) in my USERDATA
Data Type : Integer, Interface : CycleTo get to the 'str' value which corresponds to this Option I constructed the following code:
op.GetUserDataContainer()[8][c4d.DESC_NAME].GetContainer(c4d.DESC_CYCLE).GetString(op[c4d.ID_USERDATA,7])
it works but this seems to me like a little overkill (understatement)
Is there a better/ correct way to get to the 'str'-value. Also I have to know the position in the GetUserDataContainer() (in my case [8]) to get to the value. -
RE: How to keep the point coordinates of a polygonObject up to date in Python code
I figured out how to do it.
It's fairly simple. I just have to reassing the pointvalues after the Update
so if I insert a new
puntenLijst = op.GetAllPoints() testPnt = puntenLijst[0]
the 'testPnt' has updated values.
-
How to keep the point coordinates of a polygonObject up to date in Python code
Hello, I try to manipulate a polygon point in Python with the SetPoint() command.
So for instance I want to double the Values for X,Y en Z of point[0] = testPnt (for instance Vector(1,1,1))
I use the values of the point to double them. (I used the '×' to indicate multiplication the '*' messes up the post)
op.SetPoint(0,c4d.Vector(testPnt.x×2,testPnt.y×2,testPnt.z×2))
If later somewhere else in my code I change these values again, say I triple them
op.SetPoint(0,c4d.Vector(testPnt.x×3,testPnt.y×3,testPnt.z×3))
and print the values I still get the unchanged values. i.e. Vector(1,1,1)
I want to get (6,6,6) at the end.Here my testing code:
def main(): op = doc.GetActiveObject() #select a polygon object with Point[0] at (1,1,1) as example puntenLijst = op.GetAllPoints() testPnt = puntenLijst[0] print 'pnt0 at start: ' ,testPnt # check the coordinates before manipulation *#prints: pnt0 at start: Vector(1,1,1) ok* op.SetPoint(0,c4d.Vector(testPnt.x*2,testPnt.y*2,testPnt.z*2)) print 'pnt0 after SetPoint:' ,testPnt *#prints: pnt0 after SetPoint: Vector(1,1,1) not ok, got to send Message(c4d.MSG_UPDATE)* op.Message (c4d.MSG_UPDATE) print 'pnt0 after MSG_UPDATE' ,testPnt *#prints: pnt0 after MSG_UPDATE: Vector(1,1,1) not ok, got to do the c4d.EventAdd()* c4d.EventAdd() print 'pnt0 after c4d.EventAdd():' ,testPnt *#prints: pnt0 after c4d.EventAdd(): Vector(1,1,1) not ok, got to do ??* op.SetPoint(0,c4d.Vector(testPnt.x*3,testPnt.y*3,testPnt.z*3)) print testPnt # hoping for Vector(6,6,6) but nope got Vector(1,1,1)
finaly in the Structure Manager after running this code the point has coordinates (3,3,3) and not (6,6,6) the last SetPoint used the startingpoint(1,1,1) and I want to continue with the changed values i.e. (2,2,2)