Measure Functions Reference (iLogic)

Use Measure functions to find and return values for distance, angle, area, perimeter, and extents dimensions.

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

Measure Distance and Angle

You can measure the distance or angle between two (or three for angle) entities. You specify the entities on either end of the measurement by name. A name can refer to:

The entities can be in the same part or assembly, or in different components within an assembly.

You can also measure between two components in an assembly by finding the closest points on each component and reporting the distance between them.

Include the RuleParametersOutput and InventorVb.DocumentUpdate() functions (in that order) before the Measure functions in a rule. The use of these functions ensures that the Measure function is examining an updated version of the Inventor model.

Measure.MinimumDistance

Measures the minimum distance between two points, planes or axes. The function can also measure the distance between a plane and a point, a plane and an axis, or a point and an axis.

Syntax

Measure.MinimumDistance("entityName1","entityName2")

Examples

To measure Point to Point:

distance = Measure.MinimumDistance("Work Point1", "Work Point2")

(1) Work Point1 (2) Work Point2

To measure Point to Axis:

distance = Measure.MinimumDistance(“Work Point1”, “Work Axis1”)

(1) Work Point1 (2) Work Axis1

To measure Axis to Axis:

distance = Measure.MinimumDistance("Work Axis1", "Work Axis2")

(1) Work Axis1 (2) Work Axis2

To measure Plane to Plane:

distance = Measure.MinimumDistance(“Work Plane1”, “Work Plane2”)

(1) Work Plane1 (2) Work Plane2

Measure.MinimumDistance("componentName1", "entityName1", "componentName2", "entityName2")

Measures the distance between entities within two components in an assembly. These entities can be points, planes, or axes.

For example, to measure the distance between planes in two components in an assembly:

distance = Measure.MinimumDistance(“Wheel1”, “Workplane1”, “Wheel2”, Workplane2”)

(1) Wheel1 Workplane1 (2) Wheel2 Work Plane2

Measure.MinimumDistance("componentName1", "componentName2")

Measures the minimum distance between the two components of an assembly. It looks at the components as a whole, and finds the closest points anywhere on the components, as shown in the following examples:

distance = Measure.MinimumDistance("partA:1", "partB:1")
distance = Measure.MinimumDistance("Wheel1", "Wheel2")

(1) Wheel1 (2) Wheel2

Use caution when measuring non-parallel axes!

Suppose your assembly consists of two blocks. The angle between the faces of the blocks is 60 degrees. Each block has a hole on the side facing the other block. The axes of these two holes are non-parallel coplanar lines which intersect. You write your function as:

distance = Measure.MinimumDistance("Block1","Axis1","Block2","Axis1")

You could expect the measurement to be made as if the lines had an infinite length, which would result in a distance of zero. However, when the Measure.MinimumDistance function is used, the distance is measured from the closest end points of the two markers used to represent the axes locations. Therefore, the measurement is made on the finite lines, and the value returned is 1.36 inches.

(1) Axis1 (2) Block1 (3) Axis2 (4) Block2

To produce a different result, you can manually extend the lines representing the axes of the holes. The Measure.MinimumDistance function now returns a value of 0 inches, as expected for lines that intersect.

(1) Block1 (2) Axis1 (3) Axis2 (4) Block2

Measure.Angle

Measures the angle between two entities or as defined by three points.

angle = Measure.Angle("entityName1", "entityName2")

Measures the angle between two entities in a part or assembly. It can measure the angle between two axes, two planes, or an axis and a plane. The entities can be work features or iMates.

angle = Measure.Angle("componentName1", "entityName1", "componentName2", "entityName2")

Measures the angle between two entities in two components at the assembly level. It can measure the angle between two axes, two planes, or an axis and a plane.

angle = Measure.Angle("point1", "point2", "point3")

Measures the angle defined by three points. This value is equivalent to the angle between two lines:

In this case, "point2" is the vertex of the angle. For example:

angle = Measure.Angle("Work Point1", "Work Point2", "Work Point3")

(1) Work Point1 (2) Work Point2 (vertex) (3) Work Point3

angle = Measure.Angle("componentName1", "point1", "componentName2", "point2", "componentName3", "point3")

Measures the angle defined by three points. "point2" defines the vertex of the angle. Each point can be in a different component.

(1) Work Point1 Component1 (2) Work Point2 Component 2 (vertex of angle) (3) Work Point3 Component3 (4) 74.02 degrees

Measure.Area

Measures the area of a sketch. This function measures the sum of the areas of the regions enclosed by the closed profiles in a sketch.

Syntax

Measure.Area(“SketchName”)

Examples

For a single closed profile, the function calculates the area enclosed by the profile:

Area: 3.14 = sq. in.

If the sketch contains multiple closed profiles, the function calculates the sum of the areas enclosed by the profiles:

Area: 6.28 = sq. in.

If the closed profiles intersect, then the function calculates the sum of the enclosed areas, regardless of whether the areas overlap:

Area: 6.28 = sq. in.

If the sketch contains multiple profiles, with one of the profiles contained completely in the other one, the Measure.Area function returns the difference between the two areas:

Area: 1.37 = sq. in.

Measure.Perimeter

Measure.Perimeter(“SketchName”)

Measures the sum of the perimeters of the closed profiles in a sketch. For a sketch containing a single closed profile, this function calculates the length of the perimeter of the profile.

Syntax

size = Measure.Perimeter("Sketch1")

Examples

For a sketch containing a single closed profile, this function calculates the length of the perimeter of the profile.

Perimeter: 6 inches

For a sketch containing non-intersecting multiple closed profiles, the function calculates the sum of the lengths of all profile perimeters:

Perimeter: 9 inches

For a sketch containing intersecting multiple closed profiles, the function calculates the sum of the lengths of all profile perimeters:

Perimeter: 12 inches

Measure.Extents

Measures the X, Y, or Z dimensions of the extents in a part or assembly. The extents can be larger than the exact dimensions of the model along that axis, especially if there are curved shapes.
Note: These functions only measure the extents of visible entities, including planes, workpoints, surfaces, and bodies. Hidden entities are not measured. There is one exception, Notebook Note objects are included in measures regardless of their visibility state.

Syntax

Measure.ExtentsLength

Measures the X extent (along the red axis) of the model.

Measure.ExtentsWidth

Measures the Y extent (along the green axis) of the model.

Measure.ExtentsHeight

Measures the Z extent (along the blue axis) of the model.