PDA

View Full Version : How to call a function with empty optional parameters



Martin
09-14-2010, 08:52 AM
Hi,

I was wondering how to call a function with empty optional parameters in Python

Example:

strNewLayerName = = Rhino.AddLayer ("ChildLayer",currentRGB,,,"ParentLayer")
'This Works



strNewLayerName = rs.AddLayer("ChildLayer",currentRGB,,,"ParentLayer")
#This way of writing it, throws an error in Python


Thanks for your help
Martin

Martin
09-14-2010, 08:58 AM
Well,

and here is the solution to the Problem.
Calling the Attribute by name:


strNewLayerName = rs.AddLayer(name="ChildLayer",color=currentRGB, parent="ParentLayer")

#The Parameter is only needed, if you are missing out on arguments not in the right order:
strNewLayerName = rs.AddLayer("ChildLayer",currentRGB, parent="ParentLayer")


The name of the parameter can be found in the help file.

Martin