Multibody parts

Multibody parts

chachaman
Collaborator Collaborator
10,689 Views
11 Replies
Message 1 of 12

Multibody parts

chachaman
Collaborator
Collaborator

Hello,

Is there a way to callout the name of a body of a multibody part in the IDW drawings ?

 

For example, is there a way  for teh ballon  callouts to identify the body ? Can the text Annotations be made to point to the body ?

 

Thx

0 Likes
10,690 Views
11 Replies
Replies (11)
Message 2 of 12

pcrawley
Advisor
Advisor
Accepted solution

No... and yes.

 

Balloon looks for Part properties, so don't waste too much effort making them look for anything else.  Leaders are generally the same - so neither option does what you need.

 

However, this old post shows how you can do what you ask: Solved: Re: Reference solid body name in balloon text? - Autodesk Community - Inventor 

 

 

Since the post is approaching the Autodesk 10-year cull policy, here (for the next 10 years hopefully) is code.

 

Note - you need to place balloons on the drawing of the multibody (they'll all show the same value).  Next select the balloons one at a time and run the rule.  The balloon text should update to reflect the body name.

Sub Main()
	Dim oSS As SelectSet
	oSS = ThisApplication.ActiveDocument.SelectSet
	
	oSS.Item(1).BalloonValueSets.Item(1).OverrideValue = GetSolidName(oSS.Item(1))
	
End Sub

Function GetSolidName(oBalloon As Balloon) As String
	Dim oLeader As Leader
	oLeader = oBalloon.Leader
	
	Dim oNode As LeaderNode
	Dim oModelGeom
	For Each oNode In oLeader.AllNodes
		If Not (oNode.AttachedEntity Is Nothing)
			oModelGeom = oNode.AttachedEntity.Geometry.ModelGeometry
			Exit For
		End If
	Next
	
	If oModelGeom.Type = ObjectTypeEnum.kEdgeObject
		oSurfaceBody = oModelGeom.Faces.Item(1).SurfaceBody
	Else
		oSurfaceBody = oModelGeom.SurfaceBody
	End If
	
	GetSolidName = oSurfaceBody.Name
End Function  

 

Ballooning solids.gif

Peter
Message 3 of 12

chachaman
Collaborator
Collaborator

Hello PCCrawley,

 

It's very kind of you to dig this up and present it so helpfully !   This really helped me !

 

All my gratitude and kindest regards !  HNY too !

 

Thanks again !

Message 4 of 12

kacper.suchomski
Mentor
Mentor
Accepted solution

I will add that in the case of a larger number of shapes, it is worth creating a form to have the command close to the cursor and not have to travel around the screen every time.

 


Kacper Suchomski

EESignature


YouTube - Inventor tutorials | LinkedIn | Instagram

Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.


Message 5 of 12

chachaman
Collaborator
Collaborator

That's a fan tastic tip ! Thx !!

Message 6 of 12

chachaman
Collaborator
Collaborator

Hello,

Can you tell me what seeting in the forms dialog allows you to switch focus between the form and  the ballon ? Presently, when the form is displayed, I cannot select the balloon .....

Thx

0 Likes
Message 7 of 12

kacper.suchomski
Mentor
Mentor
Accepted solution

Please change modal setting.

https://help.autodesk.com/view/INVNTOR/2025/ENU/?guid=GUID-40B1D589-4D0C-4B46-AB52-896F0C7D78F4


Kacper Suchomski

EESignature


YouTube - Inventor tutorials | LinkedIn | Instagram

Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.


Message 8 of 12

chachaman
Collaborator
Collaborator
Accepted solution

Thanks a million Kacper ! 😀

0 Likes
Message 9 of 12

pcrawley
Advisor
Advisor
Accepted solution

Ok, if it's a competition for making it easier... 😉

 

Modify the code as follows.  Now you can select multiple balloons - then run the code - and they all change 🙂

Sub Main()
	Dim oSS As SelectSet
	oSS = ThisApplication.ActiveDocument.SelectSet
	Dim ObjB(oSS.Count) As Balloon
	NB = oSS.Count
		
	For i = 1 To oSS.Count
		ObjB(i)=oSS.Item(i)
		Logger.Debug(GetSolidName(oSS.Item(i)))
	Next
	
	For i = 1 To NB
		ObjB(i).BalloonValueSets.Item(1).OverrideValue = GetSolidName(ObjB(i))
	Next		
	
End Sub

Function GetSolidName(oBalloon As Balloon) As String
	Dim oLeader As Leader
	oLeader = oBalloon.Leader
	
	Dim oNode As LeaderNode
	Dim oModelGeom
	For Each oNode In oLeader.AllNodes
		If Not (oNode.AttachedEntity Is Nothing)
			oModelGeom = oNode.AttachedEntity.Geometry.ModelGeometry
			Exit For
		End If
	Next
	
	If oModelGeom.Type = ObjectTypeEnum.kEdgeObject
		oSurfaceBody = oModelGeom.Faces.Item(1).SurfaceBody
	Else
		oSurfaceBody = oModelGeom.SurfaceBody
	End If
	
	GetSolidName = oSurfaceBody.Name
End Function  
Peter
Message 10 of 12

kacper.suchomski
Mentor
Mentor

I love this kind of competition  👏👏🙌


Kacper Suchomski

EESignature


YouTube - Inventor tutorials | LinkedIn | Instagram

Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.


Message 11 of 12

chachaman
Collaborator
Collaborator

Awesome !

 

How do I buy you a coffee !!!

 

Thanks

Message 12 of 12

pcrawley
Advisor
Advisor

You just did 🙂

 

I had to do this myself once and thought about coding it - but I was too lazy and just over-rode the text manually.  Today I was thrown a project where everything has been modelled as a single multi-body part - so this routine has been sooooooooooooooooooooo helpful - so thanks for making me less lazy!

 

Seriously though, it's a great question and probably should be a "standard feature" - like having iProperties on individual solid bodies and letting the drawing tools recognise those body-properties.

Peter