Share

Feature parameters

You can use the inbuilt components() function to loop over the features within a feature set. Each feature has the following parameters:

Name — Name of Feature.

ID — Id of Feature.

RootType — 'feature' as a string.

num_items — Number of sub-holes.

Type — Type of feature (pocket, slot, hole, boss).

Top — Top of feature, z-value relative to Origin.

Bottom — Bottom of feature, z-value relative to Origin.

Depth — Depth of feature, from top to bottom.

Diameter — Diameter of feature.

Draft — Draft angle.

Axis — Z axis of Feature.

For example:

// Print out the diameter of each hole
FOREACH f in components(entity('featureset','1')) {
    IF f.Type == "hole" {
        PRINT = f.name + " has a diameter of " + f.Diameter
    }
}

You can also use the components() function to iterate over the elements of compound holes, as follows:

ENTITY fset = entity('FeatureSet','')
PRINT ="Feature Set '" + fset.Name + "' has " +
fset.num_items + "
Features"
FOREACH feat IN components(fset) {
    IF feat.num_items > 0 {
        PRINT ="Feature '" + feat.Name + "' is a compound
        hole'"
        FOREACH sub IN components(feat) {
            PRINT ="Sub-hole '" + sub.Name + "' has diameter "
            + sub.Diameter
        }
    }   ELSE {
        PRINT ="Feature '" feat.Name + "' is a " + feat.Type
    }
}
Note: You cannot edit feature parameters in the macro language. You must use the normal PowerMill commands to edit features. However, the parameters will give you all the values you need to make the appropriate edits.

Was this information helpful?