iLogic Rule to Balloon Repeatedly

iLogic Rule to Balloon Repeatedly

Anonymous
Not applicable
853 Views
6 Replies
Message 1 of 7

iLogic Rule to Balloon Repeatedly

Anonymous
Not applicable

Has anyone come up with a piece of code to balloon repeatedly?

854 Views
6 Replies
Replies (6)
Message 2 of 7

chandra.shekar.g
Autodesk Support
Autodesk Support

@Anonymous,

 

Please explain the requirement in more detail.

 

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



0 Likes
Message 3 of 7

Anonymous
Not applicable

I'm currently using inventor 2015 but we're due to update, so this may not even be an issue soon. The issue i have is when i place balloons, i have to click the icon every time i want to balloon instead of the function continuing until i'm done.

0 Likes
Message 4 of 7

WCrihfield
Mentor
Mentor

This is just some quickie iLogic code for an external rule, and I know it's not a perfect solution, but this will continually create balloons for you.  There are multiple ways to make this kind of rule loop.  I have a question commented out near the end of this code, that would pop-up and ask you if you want to go again, and if you answer yes, it will restart the loop.  But for cleanliness and speed, I've left those lines commented out, and simply left the GoTo statement.  This along with the 'check' line that makes sure you have selected something, should create a fairly smooth solution that will continue to place a balloon for each drawing curve you select, and continue until you press your Escape key.  (When you press your escape key, it returns Nothing as the result of the Pick function, and when that next line checks that status, it exits the rule.

   This code does not include any extra leader points when creating the balloons, and does not allow you to manually click on the screen to add additional leader points as you place them, which is why it is not ideal.  But it does serve as an example which shows you how to use a loop to allow you to add a series of Balloons until you are done, without having to click the command each time.

   Here's the code:

If ThisApplication.ActiveDocumentType <> DocumentTypeEnum.kDrawingDocumentObject Then
	MsgBox("This rule '" & iLogicVb.RuleName & "' only works for Drawing Documents.",vbOKOnly, "WRONG DOCUMENT TYPE")
	Exit Sub
End If

Dim oDDoc As DrawingDocument = ThisDrawing.Document
Dim oSheet As Inventor.Sheet = oDDoc.ActiveSheet
Dim oTO As TransientObjects = ThisApplication.TransientObjects
Dim oBalloons As Balloons = oSheet.Balloons
Dim oBalloon As Balloon
NewBalloon :
Dim oDCurve As DrawingCurveSegment = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kDrawingCurveSegmentFilter, "Select a drawing curve to attach the balloon to.")
If oDCurve Is Nothing Then Exit Sub
Dim oIntent As GeometryIntent = oSheet.CreateGeometryIntent(oDCurve.Parent)
Dim oLeaderPoints As ObjectCollection = oTO.CreateObjectCollection
oLeaderPoints.Add(oIntent)
oBalloon = oBalloons.Add(oLeaderPoints)
'oRepeat = MsgBox("Again?", vbYesNo + vbQuestion, " ")
'If oRepeat = vbYes Then GoTo NewBalloon
GoTo NewBalloon

 

If this solved your problem, or answered your question, please click ACCEPT SOLUTION.
Or, if this helped you, please click 'LIKE' 👍.

If you have time, please... Vote For My IDEAS 💡and Explore My CONTRIBUTIONS

Inventor 2021 Help | Inventor Forum | Inventor Customization Forum | Inventor Ideas Forum

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 5 of 7

Anonymous
Not applicable

@WCrihfield 

you must be the resident ilogic guru😎

 

when i try to use the code you posted, i get the following error:conball.png

0 Likes
Message 6 of 7

WCrihfield
Mentor
Mentor

Yeah, that one stumps some folks up.  You can just delete that section out of that line if you want, or just comment out the whole MsgBox line if you want.  That "iLogicVb.RuleName" may have become available in a later version of Inventor than the one you're using.  Getting rid of that little bit won't hurt anything.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 7 of 7

DRoam
Mentor
Mentor

@Anonymous wrote:

I'm currently using inventor 2015 but we're due to update, so this may not even be an issue soon. The issue i have is when i place balloons, i have to click the icon every time i want to balloon instead of the function continuing until i'm done.


According to the balloon documentation for Inventor 2015, the Balloon command should stay active after you add a Balloon, allow you to continue adding Balloons until you escape out of it. No iLogic should be necessary. Can you share a Screencast of what happens when you use the Balloon command?

0 Likes