Update button

Update button

Anonymous
Not applicable
579 Views
2 Replies
Message 1 of 3

Update button

Anonymous
Not applicable

I am currently working on an update button.

 

It has to do all the checks and procedures when you are finished with a drawing such as:

update mass, round dimensions, update copied properties, update scale, sort part list, etc etc

 

Atleast, thats what it will do when its finished...

 

Currently I want to add an ilogic code to check if all parts are ballooned.

The partlist shows which parts are ballooned by a small symbol (See the attachment)

Is there a way to check if this is on or off in ilogic?

 

thx in advance,

 

Arnold

0 Likes
Accepted solutions (1)
580 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable
Accepted solution

The Inventor programming help will be of some use to you.  The DrawingBOMRow object has a boolean property "ballooned" which will give you a true/false of whether it has a balloon.

 

In C#, the code to check the BOM for ballooned parts would be: 

void CheckForBalloon(DrawingDocument aDoc)
{
	foreach (DrawingBOM bom in aDoc.DrawingBOMs)
	{
		foreach (DrawingBOMRow oRow in bom.DrawingBOMRows)
		{
			bool hasBalloon = oRow.Ballooned;
		}
	}
}

 Obviously the iLogic code will have a different syntax, but this should get you started.  Keep in this needs a drawing document and a drawing BOM row because balloons can only be placed on drawings.

Message 3 of 3

Anonymous
Not applicable

I have this code now:

 

Dim drawDoc As DrawingDocument = ThisApplication.ActiveDocument
Dim baseSheet As Sheet = drawDoc.Sheets.Item(1)
Dim valSet As BalloonValueSet = baseSheet.Balloons.Item(1).BalloonValueSets.Item(1)
Dim drawBOM As DrawingBOM = valSet.ReferencedRow.Parent
Dim oRows As DrawingBOMRows = drawBOM.DrawingBOMRows

For i = 1 To oRows.Count
Dim drawBOMRow As DrawingBOMRow = drawBOM.DrawingBOMRows.Item(i)
Dim hasBallooned As Boolean = drawBOMRow.Ballooned
If hasBallooned = "False" Then

MessageBox.Show("Attention! Not all parts are ballooned!", "Balloon Check", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1)
Exit Sub
End If
Next

 

It works!

 

Any comment to improve it is welcome!

 

For example: I copied some code snippets here and there on this forum (forgot origin) and though I understand the rule picks a balloon in a  view and gets the BOM, I do not know if this a good way in my situation.

 

For all i care he picks the first BOM he finds in my drawing.

 

Anyways thanks for the help,

 

Arnold

0 Likes