03-29-2018
10:46 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
03-29-2018
10:46 PM
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
