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: 

Callout balloon referencing folder name in feature tree assembly

2 REPLIES 2
Reply
Message 1 of 3
Anonymous
448 Views, 2 Replies

Callout balloon referencing folder name in feature tree assembly

Anonymous
Not applicable

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

0 Likes

Callout balloon referencing folder name in feature tree assembly

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

Labels (1)
2 REPLIES 2
Message 2 of 3
WCrihfield
in reply to: Anonymous

WCrihfield
Mentor
Mentor

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

EESignature

(Not an Autodesk Employee)

0 Likes

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

EESignature

(Not an Autodesk Employee)

Message 3 of 3
Anonymous
in reply to: WCrihfield

Anonymous
Not applicable

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.

Capture1.PNG

I tried your rule and received the following errors;Capture2.PNG

0 Likes

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.

Capture1.PNG

I tried your rule and received the following errors;Capture2.PNG

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

Post to forums  

Autodesk Design & Make Report