Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

@SachinRane,

 

Try below VBA code to add ModelFeatureControlFrame. There must be at least one row in ModelFeatureControlFrame while adding.

 

Sub Main()

    Dim doc As PartDocument
    Set doc = ThisApplication.ActiveDocument
    
    Dim oDef As PartComponentDefinition
    Set oDef = doc.ComponentDefinition
    
    Dim oFace As Face
    Set oFace = ThisApplication.CommandManager.Pick(kPartFaceFilter, "Select a face to add Model feature control frame")
    
    Dim oAnnotationPlaneDef As AnnotationPlaneDefinition
    Set oAnnotationPlaneDef = oDef.ModelAnnotations.CreateAnnotationPlaneDefinitionUsingPlane(oFace)
    
    ' Set a reference to the TransientGeometry object.
    Dim oTG As TransientGeometry
    Set oTG = ThisApplication.TransientGeometry
    
    Dim oIntent As GeometryIntent
    Set oIntent = oDef.CreateGeometryIntent(oFace)
        
    Dim oPt As Point
    Set oPt = oTG.CreatePoint(12, 15, 0)
    
    Dim oMFCFDef As ModelFeatureControlFrameDefinition
    Set oMFCFDef = oDef.ModelAnnotations.ModelFeatureControlFrames.CreateDefinition(oIntent, oAnnotationPlaneDef, oPt)

    Dim oMFCFRow As ModelFeatureControlFrameRow
    Set oMFCFRow = oMFCFDef.FeatureControlFrameRows.Add(kFlatness, 0.02)
    
    Dim oMFCF As ModelFeatureControlFrame
    Set oMFCF = oDef.ModelAnnotations.ModelFeatureControlFrames.Add(oMFCFDef)
    
    
End Sub

Please feel free to contact if there is any queries.

 

If solves problem, click on "Accept as solution" / give a "Kudo".

 

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network