Get settings of a Cinema function
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 09/07/2011 at 12:09, xxxxxxxx wrote:
Hy there,
is it possible to access the settings of a Cinema function like "Optimize"?
There I would like to read out for example the Tolerance value. I found the
DialogResource and could maybe create an ID, but how would I get the container?Thank you,
maxx -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 09/07/2011 at 14:44, xxxxxxxx wrote:
Optimize can be accessed through the SendModelingCommand.
import c4d from c4d import gui,utils def main() : obj = doc.GetActiveObject() bc = c4d.BaseContainer() bc.SetData(c4d.MDATA_OPTIMIZE_TOLERANCE, 30) #Sets the Tolerance value to 30 bc.SetData(c4d.MDATA_OPTIMIZE_POINTS, True) #Optimize the points of the object utils.SendModelingCommand(c4d.MCOMMAND_OPTIMIZE, list = [obj], mode = c4d.MODIFY_ALL, bc=bc, doc = doc) c4d.EventAdd() print bc.GetData(c4d.MDATA_OPTIMIZE_TOLERANCE) #Gets the current Tolerance value if desired if __name__=='__main__': main()
-ScottA
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 09/07/2011 at 16:49, xxxxxxxx wrote:
Hy Scott,
unfortunately that part is clear to me
What I want is to read out the current values that where set through the optimize function. So, I want to retrieve the container and read out the values, not create one.
Regards,
maxx -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 09/07/2011 at 17:48, xxxxxxxx wrote:
That's what the GetData() function does.
If you want to loop through the container of an object and get all the container items you can do this:
import c4d from c4d import gui def main() : obj = doc.GetActiveObject() bc = obj.GetData() #Get the object's container data for i in bc: print i if __name__=='__main__': main()
And if you have your own custom container you can loop through it like this:
import c4d from c4d import gui def main() : bc = c4d.BaseContainer() bc.SetData(c4d.MDATA_OPTIMIZE_TOLERANCE, 30) bc.SetData(c4d.MDATA_OPTIMIZE_POINTS, True) for i in bc: print i if __name__=='__main__': main()
I can't think of anything else you would do with a container. Other than getting and setting.
-ScottA
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 10/07/2011 at 06:13, xxxxxxxx wrote:
Hy Scott,
thank you for the answer. We are not yet there
It is still not clear to me, how I would retrieve the current threshold for the optimize function. I understand how to get and set values, but where is the container of the optimize-function?
So, I do not want just to set the values for the command, that part is clear. I want to first read out the values which the user has set the last time using the Cinema optimize function.
Thank you for your efforts,
maxx -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 10/07/2011 at 08:35, xxxxxxxx wrote:
Oh. I see.
You want to get at the original container for it?I'm not sure if that's possible.
In the C++ docs it mentions a GetToolData() function. Then under it it says not available. Or something along those lines. I forget the exact wording.Trying to access the document's container in python like this:
import c4d from c4d import gui def main() : bc = doc.GetData() for i in bc: print i if __name__=='__main__': main()
Results in the error: Parameter value not accessible(object unknown in Python)
So as far as I know.
The only way to get at that value is to set the value yourself in a custom container(bc). Then use GetData() to get it's value.
I don't see any way to get at the original container.
But maybe someone else will know the answer.-ScottA
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 10/07/2011 at 10:22, xxxxxxxx wrote:
Hey Scott,
now we are there!
I found the GetToolData() method in Python, I will check it out now. But I am pretty certain that this solves my problem!
Thank you very much,
maxx