- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi
I am Trying to add the Model Annotation.
In Model annotation I am trying to Add the ModelSurfaceTextureSymbols and LeaderNoteText How to do Create the Defination for the same.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello @SachinRane,
Try the below VBA code to add ModelSurfaceTextureSymbols and ModelLeaderNote.
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 leader point")
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 oSurfacePoints As ObjectCollection
Set oSurfacePoints = ThisApplication.TransientObjects.CreateObjectCollection
' Create a few leader points.
Call oSurfacePoints.Add(oTG.CreatePoint(10, 15, 0))
Dim oIntent As GeometryIntent
Set oIntent = oDef.CreateGeometryIntent(oFace)
Call oSurfacePoints.Add(oIntent)
Dim oSurfaceTexDef As ModelSurfaceTextureSymbolDefinition
Set oSurfaceTexDef = oDef.ModelAnnotations.ModelSurfaceTextureSymbols.CreateDefinition(oSurfacePoints, oAnnotationPlaneDef)
Dim oSurfaceTexture As ModelSurfaceTextureSymbol
Set oSurfaceTexture = oDef.ModelAnnotations.ModelSurfaceTextureSymbols.Add(oSurfaceTexDef)
Dim oLeaderPoints As ObjectCollection
Set oLeaderPoints = ThisApplication.TransientObjects.CreateObjectCollection
' Create a few leader points.
Call oLeaderPoints.Add(oTG.CreatePoint(5, 10, 0))
Dim oLeaderIntent As GeometryIntent
Set oLeaderIntent = oDef.CreateGeometryIntent(oFace)
Call oLeaderPoints.Add(oLeaderIntent)
Dim oLeaderDef As ModelLeaderNoteDefinition
Set oLeaderDef = oDef.ModelAnnotations.ModelLeaderNotes.CreateDefinition(oLeaderPoints, "Sample", oAnnotationPlaneDef)
Dim oLeader As ModelLeaderNote
Set oLeader = oDef.ModelAnnotations.ModelLeaderNotes.Add(oLeaderDef)
End Sub
On running above code, it prompts for selection of face as shown below.
After selection of face, sample ModelSurfaceTextureSymbol and ModelLeaderNote are added at different location as shown below.
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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Thanks for your help in Adding ModelSurfaceTextureSymbols, I am trying to add the tolerence Feature using the ModelCompositeAnnotation or the trying to add the ModelFeatureFrame but its giving the Error. Can you Help me out
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Thanks For your support
but i am trying to add the ModelCompositeAnnotation, I Can do that
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Yes, You can use same ModelFeatureControlFrame to add a ModelCompositeAnnotation.
Thanks and regards,
CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am Trying to Set the Standerd for the ModelSurfaceTexture via API, it is possible in Drafting but how to do the Same for the ModelSurfaceTextureSymbols. Figure 2 is the Required result and Figure 3 is API Result. How I can achive the Same.
Figure 1 is need to Set the STD. I want to set the ANSI Std for ModelSurfaceTextureSymbols
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
This has been a very good teaching tool for me. I'm having a particular issue where Inventor will crash when running this method, if a non-planar face is selected. If, say, a cylindrical face is selected
oAnnoPlaneDef = oDoc.ModelAnnotations.CreateAnnotationPlaneDefinitionUsingPlane(oFace)
Fails
and Inventor crashes.
I have tried instead using kAllPlanarEntities instead, but that similarly failed.
What would be the best route to constrain the user to selecting only valid planar faces, or being able to handle a nonplanar face selection?
Thanks in advance.
IMPORTANT EDIT
I'm working in an assembly environment, rather than part. Trying to add ModelLeaderNotes