Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Show Part Name in Annotation Leader Note in Assembly

0 REPLIES 0
Reply
Message 1 of 1
b.kushaiynov
19 Views, 0 Replies

Show Part Name in Annotation Leader Note in Assembly

'hier shows only occurence name. I need part name. Pls help me some one. Thanks
Sub
Main() If ThisApplication.ActiveDocumentType = kAssemblyDocumentObject Then CreatePartNumberAnnotation() 'MessageBox.Show("ich bin Assembly", "ich muss assembly sein") Else MessageBox.Show("Sorry ich bin kein ssembly", "Ich muss assembly sein") End If End Sub Sub CreatePartNumberAnnotation() Dim Doc As Document = ThisApplication.ActiveDocument Dim oDef As AssemblyComponentDefinition = Doc.ComponentDefinition Dim oTG As TransientGeometry = ThisApplication.TransientGeometry Dim dViewRepMgr As RepresentationsManager = oDef.RepresentationsManager Dim dWeldView As DesignViewRepresentations = dViewRepMgr.DesignViewRepresentations Dim oEdge As Edge = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kPartEdgeFilter, "Select an Edge to attach leader") Dim o As ComponentOccurrence = oEdge.ContainingOccurrence Dim oAnnoPlaneDef As AnnotationPlaneDefinition = oDef.ModelAnnotations.CreateAnnotationPlaneDefinitionUsingPlane(oEdge.Geometry) Dim oLeaderPoints As ObjectCollection = ThisApplication.TransientObjects.CreateObjectCollection 'finding Midpoint of an Edge Dim startPoint As Point = oEdge.StartVertex.Point Dim endPoint As Point = oEdge.StopVertex.Point Dim midPointX As Double = (startPoint.X + endPoint.X) / 2 Dim midPointY As Double = (startPoint.Y + endPoint.Y) / 2 Dim midPointZ As Double = (startPoint.Z + endPoint.Z) / 2 'midmoint found 'accesing components name if it is a occurance ' i have problem in this part of code. help pls . Dim sel_set As SelectSet sel_set = ThisDoc.Document.SelectSet If sel_set.Count = 1 Then If TypeOf sel_set.Item(1) Is ComponentOccurrence Then Doc = sel_set.Item(1).definition.document Else MessageBox.Show("part or assembly must be selected", "Title") End If Else MessageBox.Show("Only one component can be selected", "Title") Exit Sub End If 'name acessed Call oLeaderPoints.Add(oTG.CreatePoint(midPointX,midPointY,midPointZ)) Dim oLeaderIntent As GeometryIntent = oDef.CreateGeometryIntent(oEdge) Call oLeaderPoints.Add(oLeaderIntent) Dim oLeaderDef As ModelLeaderNoteDefinition= oDef.ModelAnnotations.ModelLeaderNotes.CreateDefinition(oLeaderPoints, Doc.DisplayName, oAnnoPlaneDef) 'and here show else part. Dim oLeader As ModelLeaderNote = oDef.ModelAnnotations.ModelLeaderNotes.Add(oLeaderDef) End Sub
0 REPLIES 0

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Technology Administrators


Autodesk Design & Make Report