Use Geometry Intent to place a balloon

Use Geometry Intent to place a balloon

chris_davis
Contributor Contributor
804 Views
14 Replies
Message 1 of 15

Use Geometry Intent to place a balloon

chris_davis
Contributor
Contributor

Hello, 

I'm trying to place a balloon in a drawing view and have the balloon at a certain location.  I can get the balloon placed but it is not where I would like it.  In line 140  I'm trying to  get a work point that I created called Balloon Point 2 and get my balloon to be at that location. I believe I need to turn Work Point 2 into a X & Y Coordinate on the sheet. Then I can plug that into line 147. Any ideas on how I can use get intent and turn it into a X & Y sheet Coordinate? Thanks 

chris_davis_0-1752526137094.png

 

 

0 Likes
Accepted solutions (2)
805 Views
14 Replies
Replies (14)
Message 2 of 15

chris_davis
Contributor
Contributor
Accepted solution

So I'm going to answer my own question. When I did the GetIntent on line 140 you can then get the sheet location of the work point. It is in cm which is i-logics default units for length. The part that I was not understanding is that the "leaderPoints As IEnumerable(Of DoumentUnitsPoint2d)"  (the 2ed argument when adding a balloon) was not asking for a sheet location but a location from the lower left corner of the view with the value of (1,1) being the top right corner of the view. Knowing this I was able to use the view center location and the views height & width along with the sheet location of the work point I created to find the value that would place the balloon at the location of this work point. As a note the views center, height & width were in inchs because that is the default of my model/drawing. 

 

I first found the lower left corner of the view then found the difference in the location of the lower left corner of the view to the work point location (in both the x & y direction) then used that difference divided by the views width/height to get the ratio that needed to be plugged into the 2ed argument when adding a balloon. 

 

It seems that there could be a better way of doing this.

 

chris_davis_0-1752681623161.png

 

0 Likes
Message 3 of 15

Curtis_Waguespack
Consultant
Consultant

@chris_davis 


See this link. It has an example of placing the balloon leader arrow on the midpoint of the selected edge and a near point to further help dictate placement.

https://forums.autodesk.com/t5/inventor-programming-ilogic/reattach-balloon-through-ilogic/m-p/13293...

 

Hope that helps,

Curtis

EESignature

0 Likes
Message 4 of 15

chris_davis
Contributor
Contributor

@Curtis_Waguespack,

Thank you for the reply. Looking through your posted example it looks to me that it is placing a balloon at the view location you stated and then attaching to the face of the cylinder near this point. This is good especially since the cylinder has 2 lines it could attach to. What I'm trying to do is different. I'm placing a nozzle in a top head of a tank. This nozzle could be at any degree around the tank and any radius from the center. I have no problem getting the balloon to attach to the nozzle. My issue is that I want the balloon to be on the radius that the nozzle is and on the outside of the tank like the attached picture. So if the nozzle were located as drawn in red then the balloon would be as shown. The nozzle assembly uses a sketch to located it so my thought was to just add  a point in the sketch at the location I want the balloon to be, that could then be used to add a work point in the nozzle assembly.  Then this work point could be used to place the balloon on the drawing. However, I was not able to find a way to easily tell the balloon to be at this work point. The only way so far I was able to get this to work was as described above. 

 

 

chris_davis_0-1752759178801.png

 

Thanks, 

Chris Davis

 

0 Likes
Message 5 of 15

Curtis_Waguespack
Consultant
Consultant
Accepted solution

@chris_davis, I think something like this should work for you if I understand correctly:

 note I used *.3937 just as a conversion, because my assembly was in mm and the drawing was in inches, that might or might not be needed for you depending on units involved

Dim Sheet_1 = ThisDrawing.Sheets.ItemByName("Sheet:1")
Dim VIEW1 = Sheet_1.DrawingViews.ItemByName("VIEW1")

Dim oInt = VIEW1.GetIntent("FlyWheel", "Pie Face2" , intent := PointIntentEnum.kMidPointIntent)

Dim WPt = VIEW1.GetIntent( "Work Point1").PointOnSheet
WPt2  = ThisDrawing.Geometry.Point2d(WPt.X *.3937, WPt.Y*.3937)

Dim balloon1 = Sheet_1.Balloons.Add("Balloon1", {WPt2}, oInt)

 

Setup:

 

Sketch in part

Curtis_Waguespack_1-1752771057742.png

 

Workpoint in assembly based on part sketch

Curtis_Waguespack_2-1752771079525.png

 

drawing view

Curtis_Waguespack_0-1752771030828.png

 

rule places balloon using work point as placement point

Curtis_Waguespack_3-1752771160991.png

 

rotating the model, rotates the sketch and point

Curtis_Waguespack_4-1752771580569.png

running the rule after uses the point in new location

Curtis_Waguespack_5-1752771606222.png

 

 

 

 

EESignature

0 Likes
Message 6 of 15

FeelGoodGirl
Advocate
Advocate

 

This is so cool! That's exactly what I need. I tried it out right away, but I can't get it to work. I'm still learning how to use iLogic/code.

 

I know where the error is probably, but I don't understand what you're supposed to enter. It's the line:

 

Dim oInt = VIEW1.GetIntent("FlyWheel", "Pie Face2", intent := PointIntentEnum.kMidPointIntent)

 

I thought "FlyWheel" was the name of the part. But what does "Pie Face2" refer to?

 

Sorry, this feels like a really stupid question. But I just can't get it to work.

Message 7 of 15

chris_davis
Contributor
Contributor

Curtis, @Curtis_Waguespack 

Thanks for the response, This worked great and was much easier then the solution I found.

 

Thanks, 

Chris Davis

Message 8 of 15

Curtis_Waguespack
Consultant
Consultant

@FeelGoodGirl wrote:

 

This is so cool! That's exactly what I need. I tried it out right away, but I can't get it to work.

 

Dim oInt = VIEW1.GetIntent("FlyWheel", "Pie Face2", intent := PointIntentEnum.kMidPointIntent)

 

I thought "FlyWheel" was the name of the part. But what does "Pie Face2" refer to?

 


Hi @FeelGoodGirl ,

 

In the previous example, "FlyWheel" was the component name, and "Pie Face2" was a named face in the FlyWheel component/part.

 

There is a short video at this link that shows a quick overview of how to create named geometry, and how we work with it in a drawing. The video example is using an edge and creating a dimension, but it's the same concepts for a named face and creating a balloon.

https://autode.sk/4m3vkvl

 

Hope that helps,

Curtis

EESignature

0 Likes
Message 9 of 15

FeelGoodGirl
Advocate
Advocate

I'm so sorry, but I just can't get it to work properly. I don't understand what I'm doing wrong. 🙈

 

I did figure out why it wasn't working at all at first. There should be a parts list on the drawing first. Couldn't this be included automatically?

 

Now I'm getting a balloon, but it's not where I thought it would go.

In my part i put a sketch point:

FeelGoodGirl_0-1753186703827.png

 

I made a work point in the assy from the sketch point:

FeelGoodGirl_1-1753186933204.png

 

The code I use:

Dim Sheet_1 = ThisDrawing.Sheets.ItemByName("Samenstelling_Enkel:1")
Dim VIEW1 = Sheet_1.DrawingViews.ItemByName("FrontView")

Dim oInt = VIEW1.GetIntent("THE PART", "Face0" , intent := PointIntentEnum.kMidPointIntent)

Dim WPt = VIEW1.GetIntent("test").PointOnSheet
WPt2  = ThisDrawing.Geometry.Point2d(WPt.X *.3937, WPt.Y*.3937)

Dim balloon1 = Sheet_1.Balloons.Add("Balloon1", {WPt2}, oInt)

 

The result:

FeelGoodGirl_2-1753187174215.png

 

 

0 Likes
Message 10 of 15

Curtis_Waguespack
Consultant
Consultant

@FeelGoodGirl , I think this is just a units conversion issue. So in my original example I had a mm part, but I pulled up an Inch based drawing ( by accident) so I needed the units conversion of * .3937

 

I left it in as an example, but if your part is in mm and your drawing standard is in mm, then you can just remove that and do this:

WPt2  = ThisDrawing.Geometry.Point2d(WPt.X , WPt.Y)

 

If your part is in mm, and your drawing is in cm, you might need to do a conversion as well.

EESignature

Message 11 of 15

FeelGoodGirl
Advocate
Advocate

My hero!

I did also try without the * .3937 conversion. But what I didn't know is that I needed to do a conversion from cm to mm. Did do the trick. Thank you so much!

WPt2  = ThisDrawing.Geometry.Point2d(WPt.X * 10, WPt.Y * 10)

 

 

Message 12 of 15

FeelGoodGirl
Advocate
Advocate

Now it works great to place the balloon on a working point, but I'd also like to place the leader on a working point. Could you help me with this? I thought it would be simple, but this doesn't work.

 

Dim Sheet_1 = ThisDrawing.Sheets.ItemByName("Sheet:1")
Dim VIEW1 = Sheet_1.DrawingViews.ItemByName("VIEW1")

Dim WPt3 = VIEW1.GetIntent("Work Point2").PointOnSheet
WPt4  = ThisDrawing.Geometry.Point2d(WPt3.X * 10, WPt3.Y * 10)

Dim WPt = VIEW1.GetIntent("Work Point3").PointOnSheet
WPt2  = ThisDrawing.Geometry.Point2d(WPt.X * 10, WPt.Y * 10)

Dim balloon1 = Sheet_1.Balloons.Add("Balloon1", {WPt2}, {WPt4})
0 Likes
Message 13 of 15

Curtis_Waguespack
Consultant
Consultant

Hi @FeelGoodGirl , I think you just need to add the points in the curly brackets as shown.

Here the arrow is going to the Edge on component, and the leader points are using the 2 workpoints.

Note you might need to swap the points in the array if your balloon leader is opposite of what you expect.

In my case WPt4 is where I wanted the balloon and WPt3 is where the leader point was meant to be.

Dim Sheet_1 = ThisDrawing.Sheets.ItemByName("Sheet:1")
Dim VIEW1 = Sheet_1.DrawingViews.ItemByName("VIEW1")

Dim Edge0 = VIEW1.GetIntent("Frame Base:1", "Edge0" , intent := PointIntentEnum.kMidPointIntent)

Dim WPt1 = VIEW1.GetIntent("Work Point3").PointOnSheet
WPt3  = ThisDrawing.Geometry.Point2d(WPt1.X * 10, WPt1.Y * 10)
Dim WPt2 = VIEW1.GetIntent("Work Point4").PointOnSheet
WPt4  = ThisDrawing.Geometry.Point2d(WPt2.X * 10 , WPt2.Y * 10)

Dim balloon1 = Sheet_1.Balloons.Add("Balloon1", {WPt4, WPt3}, Edge0)

Curtis_Waguespack_0-1753719208677.png

 

Curtis_Waguespack_1-1753719228587.png

 

EESignature

0 Likes
Message 14 of 15

FeelGoodGirl
Advocate
Advocate

Thanks for your reply!

 

This isn't quite what I mean. I mean the starting point of the leader. Instead of the middle of the edge, I would like to determine the location myself.

 

FeelGoodGirl_0-1753767476632.png

 

0 Likes
Message 15 of 15

FeelGoodGirl
Advocate
Advocate

Does anyone happen to know if this is possible?

0 Likes