How to add ModelLeaderNotes accurately in assembly

How to add ModelLeaderNotes accurately in assembly

bindlmi
Advocate Advocate
317 Views
0 Replies
Message 1 of 1

How to add ModelLeaderNotes accurately in assembly

bindlmi
Advocate
Advocate

Hi,

actually I am able to place a ModelLeaderNote in an assembly, but I can't controll, how it is placed. I'm afraid, there are no APIs in Inventor 2018.3.3. - well, we will see.

 

The following Code allows me to pick a face and to pick a Point, then it creates a ModelLeaderNote with "test" in my assebly - but not as it should. (oDoc and oCompDef are declared global)

 

I thought, that the AnnotationPlaneDefinition is the plane, where my text lies on (when I place a note by hand, I can switch between them with space). But it seems to be the plane, where the root gets created.

And the oLeaderPoints in the ObjektCollection is where the text is placed, and not where the root from the note is.

 

Are there any other APIs or workarounds for my problem?

 

 

Private Sub CommandButton1_Click()

Dim oMLNs As ModelLeaderNotes
Set oMLNs = oCompDef.ModelAnnotations.ModelLeaderNotes

Dim oMLN As ModelLeaderNote
Dim oMLNDef As ModelLeaderNoteDefinition

Dim oFace As Face
Set oFace = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kPartFaceFilter, "Select a face")

Dim oAnnoPlaneDef As AnnotationPlaneDefinition
Set oAnnoPlaneDef = oCompDef.ModelAnnotations.CreateAnnotationPlaneDefinitionUsingPlane(oFace.Geometry)

Dim oLeaderPoints As ObjectCollection
Set oLeaderPoints = ThisApplication.TransientObjects.CreateObjectCollection

Dim oPoint As Variant
Set oPoint = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kPartVertexFilter, "Select Point")

Dim NewPoint As Point
Set NewPoint = ThisApplication.TransientGeometry.CreatePoint(oPoint.Point.X, oPoint.Point.Y, oPoint.Point.z)

Call oLeaderPoints.Add(NewPoint)

Dim oLeaderIntent As GeometryIntent
Set oLeaderIntent = oCompDef.CreateGeometryIntent(oFace)

Call oLeaderPoints.Add(oLeaderIntent)

Set oMLNDef = oMLNs.CreateDefinition(oLeaderPoints, "test", oAnnoPlaneDef)
Set oMLN = oMLNs.Add(oMLNDef)

End Sub

 

Kind regards

Michael

0 Likes
318 Views
0 Replies
Replies (0)