Feature Functions Reference (iLogic)

iLogic provides functions that set or read feature suppression states, colors, and thread designations.

Use the Feature functions for threads to set or read properties of thread features or tapped holes. These properties also appear in the editing dialog box for a thread feature or tapped hole.

To access the feature functions, expand the Features node on the System tab in the Snippets area of the iLogic Edit Rule dialog.

Feature.IsActive (with feature name)

Sets or reads the suppression state for a part or assembly feature. Use this function to suppress or unsuppress any feature of an Inventor part or assembly. When you change the activation state of a feature, you also change dependent features. This effect eliminates the need to specify dependent features in your rule.

Note: Manually changing the activation state of a feature does not cause rules referencing them to fire automatically. In a part, you can make such rules fire automatically by adding them to the list of rules triggered by the Feature Suppression Change event. This event is accessed with the Event Triggers command.

If you change the name of a feature after writing a rule that includes this function, edit the rule. Replace the old name with the new name. Change feature names (if necessary) before writing rules.

Feature names must always be enclosed in quotation marks.

Syntax

Feature.IsActive(“featurename”)

Example

if bracket_width >= 3 then
Feature.IsActive("flange_hole_pattern") = true
Feature.IsActive("base_hole_pattern") = true
else
Feature.IsActive("flange_hole_pattern") = false
end if

Feature.IsActive (with component and feature name)

This variation of the Feature.IsActive function sets or reads the suppression state of features in a part or subassembly by specifying the component and feature name. Use this syntax to control the activation state of features in parts from within a rule at the assembly level.

Syntax

Feature.IsActive(“componentname”, “featurename”)

Examples

Set the suppression state:

Feature.IsActive("PartA:1", "Hole:1") = false

Read the suppression state:

MyBooleanParameter = Feature.IsActive("PartA:1","Hole:1")

Feature.Color

Sets or reads the color of a part feature by specifying the feature name. This function does not work for assembly features.

The color value is a text string. The text must be enclosed in quotation marks. It must also match the exact spelling and case of the colors available in the active standard of the current Autodesk Inventor document.

Syntax

Feature.Color("featurename")

Examples

To set the color:

Feature.Color("Hole:1") = "Green"
Feature.Color("Hole:2") = "Aluminum (Cast)
"Feature.Color("Hole:3") = "As Material"

To read the color:

MyStringParameter = Feature.Color("Chamfer:1")

Set or read the color of subassembly or part features by specifying the component name and feature name:

Feature.Color("componentName", "featurename")

Feature.ThreadDesignation

Sets or reads the thread designation of a thread feature in a part or assembly document. The thread designation is a text string. It must be specified with the exact string as it appears in the Designation field of the threaded feature editing dialog box.

For a tapered thread, specify the value that would show up in the Size field of the Thread dialog box. This value is usually a shortened version of the full thread designation.

Syntax

Feature.ThreadDesignation("featurename") = "<designation value>"

Optionally, use the following syntax to show the current thread designation, in the format necessary to set it:

threadDes = Feature.ThreadDesignation("Thread1")

When you set the thread designation for a hole with a rule, the hole size adjusts automatically.

For a threaded rod, you can use a rule to change the rod diameter and the thread designation at the same time. The rod diameter must be compatible with the thread designation.

Example

If rod_type = "small" Then
Feature.ThreadDesignation("Thread1") = "3/8-16 UNC"
rod_diameter = 0.375
ElseIf rod_type = "large" Then
Feature.ThreadDesignation("Thread1") = "1/2-13 UNC"
rod_diameter = 0.500
End If

You can also set or read the thread designation of a thread feature in a part or assembly document from a rule at the assembly level. Specify the component or filename and the threaded feature name:

Feature.ThreadDesignation("PartA.ipt", "featurename") = "1/2-13UNC"
Feature.ThreadDesignation("PartA:1", "featurename") = "1/2-13UNC"

Feature.SetThread

Makes major changes to a hole or threaded feature. Sets the type, designation, and class. Use this function to switch between inch and metric threads. You cannot switch between a straight and a tapered thread.

Note: For a tapered thread, substitute an empty string ("") for the thread class. Also, use the Size instead of the Designation.

Syntax

Feature.SetThread("featurename", "thread type", "thread designation", "thread class")

Alternatively, use the following syntax to make major changes to a hole or threaded feature in a component:

Feature.SetThread("componentName", "featurename", "thread type", "thread designation", "thread class")

Feature.ThreadType

Get the thread type of a hole or threaded feature. Examples include "ANSI Unified Screw Threads", "ANSI Metric M Profile", and so on. To change the type, use SetThread, and set the designation and class at the same time.

Syntax

currentType = Feature.ThreadType("featurename")

Alternatively, use this syntax to get the thread type of a hole or threaded feature in a component:

currentType = Feature.ThreadType("componentName", "featurename")

Feature.ThreadClass

Set the thread class of a hole or threaded feature. The greater the number, the higher the degree of accuracy.

Syntax

Feature.ThreadClass("featurename") = "3B"

Use this syntax to get the thread class of a hole or threaded feature:

currentClass = Feature.ThreadClass("featurename")

Use this syntax to set the thread class of a hole or threaded feature in a component:

Feature.ThreadClass("componentName", "featurename") = "3B"

Note: Does not apply to a tapered thread.

Get the thread class of a hole or threaded feature in a component.

currentClass = Feature.ThreadClass("componentName", "featurename")