Show FeatureDimensions on multiple features

Show FeatureDimensions on multiple features

wgraham
Advocate Advocate
379 Views
1 Reply
Message 1 of 2

Show FeatureDimensions on multiple features

wgraham
Advocate
Advocate

Has anyone discovered a method to show all feature dimensions for multiple features?  Ideally it would behave similar to the snippet shown below.  Currently have my code making the dimensions from sketches available, but unfortunately there are times when the necessary dimension are associated only with the 3D feature.

 

foreach (PartFeature feature in partdocument.ComponentDefinition.Features)
{
    feature.FeatureDimensions.Show();
}
0 Likes
Accepted solutions (1)
380 Views
1 Reply
Reply (1)
Message 2 of 2

frederic.vandenplas
Collaborator
Collaborator
Accepted solution

Well, if you do this manually, you first need to create a selection, and then activate the command to show the dimensions, if you just loop through the feature, only the last looped shows dimensions.

Sub ShowDimensions()

Dim oDoc As PartDocument
Set oDoc = ThisApplication.ActiveDocument


Dim oCompDef As PartComponentDefinition
Set oCompDef = oDoc.ComponentDefinition

Dim oSelectSet As SelectSet

Dim oFeature As PartFeature
For Each oFeature In oCompDef.Features
Call oDoc.SelectSet.Select(oFeature)
Next oFeature

Dim oControlDef As ControlDefinition
Set oControlDef = ThisApplication.CommandManager.ControlDefinitions.Item("PartShowDimensionsCtxCmd")
oControlDef.Execute

End Sub
If you think this answer fullfilled your needs, improved your knowledge or leads to a solution,
please feel free to "kudos"