Hi All,
Does anyone know how to create a custom callout balloon which can reference the "name" of the folder within the assembly feature tree?
I have inserted sub-assemblies within folders in the assembly and named them "Location 1", "Location 2".... ect". I want to callout these "locations" in a drawing but don't know how I can link folder names back to callout balloons.
Using Inventor 2019. Your help would be greatly appreciated.
Best Regards
Alex
This is a somewhat odd request, but I'll give it a try.
Do you need to use Balloons for this, or would another form of annotation like a LeaderNote (Leader Text) work?
Here is some (untested) code that may work for you using Balloons.
It it set up have you select an existing balloon, that is already attached to a component you want to call-out this way.
It then attempts to get the parent view. Get the assembly document within that view. User the balloons BalloonValueSet that contains a reference to which DrawingBOMRow it is associated with. Get the ComponentDefinition associated with that row. Get the BrowserNode for that component. Then search up through a couple of parent nodes, checking to see if they are a BrowserFolder, and if it finds one, it then tries to override the value of the balloon with the name of that folder.
Here's the (untested) code I've got so far. See if this will work for you.
Dim oDDoc As DrawingDocument = ThisDrawing.Document
Dim oSheet As Inventor.Sheet = oDDoc.ActiveSheet
Dim oBalloon As Balloon = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kDrawingBalloonFilter,"Select a Balloon.")
Dim oView As DrawingView = oBalloon.ParentView
Dim oADoc As AssemblyDocument = oView.ReferencedDocumentDescriptor.ReferencedDocument
Dim oVBSet As BalloonValueSet
Dim oCD As ComponentDefinition
If oBalloon.Attached Then' or Try
oVBSet = oBalloon.BalloonValueSets.Item(1)
oCD = oVBSet.ReferencedRow.BOMRow.ComponentDefinitions.Item(1)
End If
'Get BrowserNode for this component, then use that to find what BrowserFolder it is within
Dim oPane As BrowserPane = oADoc.BrowserPanes.Item("PmDefault")
Dim oNode As BrowserNode = oPane.GetBrowserNodeFromObject(oCD)
Dim oBFolder As BrowserFolder
If oNode.Parent.Type = ObjectTypeEnum.kBrowserFolderObject Then
oBFolder = oNode.Parent
ElseIf oNode.Parent.Parent.Type = ObjectTypeEnum.kBrowserFolderObject Then
oBFolder = oNode.Parent.Parent
Else
MsgBox("Couln't find the Browser Folder for the Item this Balloon is attached to. Exiting.", vbOKOnly, " ")
Exit Sub
End If
oBalloon.BalloonValueSets.Item(1).OverrideValue = oBFolder.Name
oBalloon.BalloonValueSets.Item(1).Static = True
Wesley Crihfield
(Not an Autodesk Employee)
Hi WCriHfield,
Thank you for your attempt;
re your question: "Do you need to use Balloons for this, or would another form of annotation like a LeaderNote (Leader Text) work?"
I don't have to use balloons if you see a more reliable way of achieving what I am trying to do.
The desired end result [below] shows the location and the components within those folders. However, this requires assemblies for each location and custom fields in the BOMs. Not very practical for documents with hundreds of locations.
I tried your rule and received the following errors;
Can't find what you're looking for? Ask the community or share your knowledge.