UserParameters Object

Derived from: Base Object
Defined in namespace "adsk::fusion" and the header file is <Fusion/Fusion/UserParameters.h>

Description

Provides access to the User Parameters within a design and provides methods to create new user parameters.

Methods

Name Description
add Adds a new user parameter to the collection.
asArray Returns the user parameters in the design as an array.
classType Static function that all classes support that returns the type of the class as a string. The returned string matches the string returned by the objectType property. For example if you have a reference to an object and you want to check if it's a SketchLine you can use myObject.objectType == fusion.SketchLine.classType().
exportUserParameters Function that exports a list of user parameters to a csv file.
importUserParameters Function that imports a list of user parameters from a csv file.

The format of the csv file is as follows: It must have at least two rows - Header followed by a row of parameter. It must be encoded in UTF8 format. It must contain at least six columns - name, unit, expression, value, comment, and favorite where favorite is either true or false. The columns must only have a comma delimiter. Any locale will work but no thousands. expression column support double quotes. comment can either be single line or multi line. If multi line, it must be in double quotes.

Here is an example of a csv file with two rows Name,Unit,Expression,Value,Comments,Favourite p1,mm,32 mm,32,the first parameter,FALSE

The function exportUserParameters could be used to see what a csv file looks like.
item Function that returns the specified User Parameter using an index into the collection.
itemByName Function that returns the specified User Parameter using the name of the parameter as it is displayed in the parameters dialog.

Properties

Name Description
count Returns the number of parameters in the collection.
design Returns the design that owns the user parameters collection.
isValid Indicates if this object is still valid, i.e. hasn't been deleted or some other action done to invalidate the reference.
objectType This property is supported by all objects in the API and returns a string that contains the full name (namespace::objecttype) describing the type of the object.

It's often useful to use this in combination with the classType method to see if an object is a certain type. For example: if obj.objectType == adsk.core.Point3D.classType():

Accessed From

Design.userParameters, FlatPatternProduct.userParameters, UserParameter.userParameters, WorkingModel.userParameters

Samples

Name Description
Set parameters from a csv file and export to STEP Reads data from a .csv file and sets user parameters in the model and then exports the model to STEP. When setting parameters be aware that this sample is setting user parameters. It's also possible to set model parameters but that's not demonstrated here. Also when accessing parameters, it is case sensitive so the names you use in your program much exactly match the names in the model.

Version

Introduced in version August 2014