I am in need of programmatically showing the Display dimensions of a specific feature in a Part Document.
I have tried using selectbyid2, ISelectionManager.AddSelectionListObject, ISelectionManager.AddSelectionListObjects,
All of the above select the feature, but the feature dimensions do not display the same way if i select it in the Feature Tree.
The features i am trying to Select Programmatically have No Faces.
They are MacroFeatures
They have Display Dimensions
See the attached screenshots.
The Code to do this is:
Sub SelectParentFeature(ByVal ModDoc As ModelDoc2)
If IsNothing(ModDoc) = False Then
Dim SelMgr As SelectionMgr = ModDoc.SelectionManager
Dim SelCt As Integer = SelMgr.GetSelectedObjectCount2(-1)
If SelCt = 1 Then
Dim SelFeat As Feature = Nothing
Select Case SelMgr.GetSelectedObjectType3(1, -1)
Case swSelectType_e.swSelFACES
Dim ThisFace As Face2 = SelMgr.GetSelectedObject6(1, -1)
If IsNothing(ThisFace) = False Then
SelFeat = ThisFace.GetFeature
End If
ThisFace = Nothing
Case swSelectType_e.swSelBODYFEATURES
SelFeat = SelMgr.GetSelectedObject6(1, -1)
End Select
If IsNothing(SelFeat) = False Then
'Get the Parent Feature (Owner Feature)
Dim ParFeat As Feature = SelFeat.GetOwnerFeature
If IsNothing(ParFeat) = False Then
ModDoc.Extension.SelectByID2(ParFeat.Name, "BODYFEATURE", 0, 0, 0, False, -1, Nothing, swSelectOption_e.swSelectOptionDefault)
ParFeat = Nothing
End If
SelData = Nothing
SelFeat = Nothing
End If
SelMgr = Nothing
End If
End If
End Sub
All this Sub Does is gets the Selected feature by either SwSelecttype_e.SwSelBodyFeatures or SwSelType_e.SwSelFaces.
then it gets the Owner Feature which is the Feature i want to Show the DisplayDimensions of.
i have tried getting all of the IDisplayDimensions using IFeature.GetFirstDisplayDimension and getting the Annotation from The IDisplayDimension using IDisplayDimension.GetAnnotation
Then Setting the IAnnotation.Visibility to SwAnnotationVisibility_e.swAnnotationVisible which does nothing.
I can make an IAnnotationView and show that but i dont like doing that because it would involve making a new one every time. you cannot name them so getting a special annotationview and clearing the IAnnotations from it seems like too much work. if i have to, i will though.
But i would like to see if there is an easier route.
Thanks
So Basically all i want to do is show the displayDimensions of a feature without having to select anything.
So Like IFeature.ShowDimensions would be sweet, or something to Achieve this goal