ConfigurationRule Object Preview

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

PreviewThis functionality is provided as a preview of intended future API capabilities. You are encouraged to use it and report any problems or suggestions using the Fusion API and Scripts forum.

Because this is a preview of future functionality, there is the possibility that it will change, which will possibly break any existing programs that use this functionality. Because of that, you should never deliver any programs that use any preview capabilities. For a distributed program, you should wait until it has moved from preview to released state.

Description

One configuration rule on a configured design. ConfigurationRule is a mutable view: the same instance returned from ConfigurationRulesManager.itemById or getRules can be placed in ConfigurationRulesModifyInput.rules to update the rule on the server. An empty id means a rule that has not yet been submitted (including it in the rules array creates a new rule on submit); a non-empty id means an existing rule (including it in the rules array updates it).

name / comment / isActive are individually mergeable on update: changing just isActive on a fetched rule, for example, will only update the active flag server-side. The body is an atomic replacement — the body sent on the rule replaces the existing server-side body wholesale. To change a single block inside an existing rule, fetch it first, mutate its body, and resend the full rule.

To delete a rule, use ConfigurationRulesManager.deleteRule or add the id to ConfigurationRulesModifyInput.deleteRuleIds. Deletion is not a method on the rule itself because rules are remote-state snapshots; a fetched ConfigurationRule does not hold a live server handle. To duplicate a rule, serialise via toJson, parse with fromJson, and call clearId on the parsed copy before submitting.

Methods

Name Description
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().

clearId

Clears this rule's id so the next modifyRules call treats it as a new rule. Useful when reusing a fetched rule as a template, or when duplicating a rule by parsing toJson output with fromJson.

create

Creates a new, detached ConfigurationRule with empty fields and isActive = true. Populate it via the setters, add it to a ConfigurationRulesModifyInput batch, and submit via ConfigurationRulesManager.modifyRules.

fromJson

Creates a ConfigurationRule by parsing a JSON object string in the wire schema. Useful for round-tripping a rule through external tooling (e.g. an MCP agent) that produced JSON directly. Unknown block types in the body are preserved as ConfigurationRuleRawStatement entries.

toJson

Serialises the full rule (id, name, comment, isActive, body) to a JSON object string matching the wire schema. Pairs with ConfigurationRule.fromJson for the inverse direction. Useful for round-tripping a rule through external tooling such as an MCP agent.

Properties

Name Description
body Gets and sets the body statements in order. Construct blocks via the create factories on the concrete statement classes (ConfigurationRuleSetBlock.create / ConfigurationRuleIfBlock.create / ConfigurationRuleCommentBlock.create) and assign the array.

Rules evaluate top-to-bottom within the body. Order matters when multiple blocks affect the same column.

To avoid cyclic evaluation problems, do not get and set the same column within one rule unless the set value is guaranteed to satisfy the get condition on the next pass (making the rule immediately inert). Watch for cycles across rules too: rule A writes column X, rule B reads X and writes Y, rule A reads Y — values can oscillate.
comment Gets and sets the optional comment attached to this rule. Empty when no comment has been set. Use this for the rule's purpose; use ConfigurationRuleCommentBlock entries inside the body to document individual sections of the body.
id The unique id that identifies this rule on the server. Empty for rules that have not yet been submitted; non-empty for rules read from getRules / itemById / itemByIds and for rules returned from a successful modifyRules call. The id is stable for the lifetime of the rule.
isActive Gets and sets whether this rule is enabled. Inactive rules are stored but not evaluated as part of the rules pipeline. Useful for staging a rule before it goes live, or for keeping a disabled variant around for reference.
isValid Indicates if this object is still valid, i.e. hasn't been deleted or some other action done to invalidate the reference.
name Gets and sets the user-visible name of this rule. Prefer short imperative or constraint phrasing ("Power requires table"; not "Rule 1") so the rule list is browsable in the UI. Duplicate names are auto-disambiguated on submit (a second "B" becomes "B 2").
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

ConfigurationRule.create, ConfigurationRule.fromJson, ConfigurationRuleResult.rule, ConfigurationRulesModifyInput.rules, ConfigurationRulesResult.rules

Samples

Name Description
Configuration Rules API Sample

Demonstrates reading and modifying configuration rules using the typed ConfigurationRules API.

Before running: Run in the DESIGN workspace from Scripts and Add-Ins (Python, C++, or TypeScript), unless the script states otherwise.

Version

Introduced in version October 2026