ilogic to get balloon no. of every (asembly/part) in parts list & copy in iprop.

ilogic to get balloon no. of every (asembly/part) in parts list & copy in iprop.

Anonymous
Not applicable
1,003 Views
1 Reply
Message 1 of 2

ilogic to get balloon no. of every (asembly/part) in parts list & copy in iprop.

Anonymous
Not applicable

Hi Guys,

 

Anyone have any rules that I can run in drawing to - 

 

Get the value of balloon for every item (assembly or part) in the parts list and copy it to a iproperty in the model files. 

 

Thanks,

 

Sandy

0 Likes
Accepted solutions (1)
1,004 Views
1 Reply
Reply (1)
Message 2 of 2

chandra.shekar.g
Autodesk Support
Autodesk Support
Accepted solution

@Anonymous,

 

Try below iLogic code to copy balloon no. to custom iProperties of model document.

 

Sub Main()
	Dim doc = ThisDoc.Document

	If doc.DocumentType = DocumentTypeEnum.kDrawingDocumentObject Then
		Dim oSheet As Sheet 
		oSheet = ActiveSheet.Sheet 
		
		Dim oBalloon As Inventor.Balloon 
		For Each oBalloon In oSheet.Balloons 
			Dim oReferDoc As Document
			oReferDoc = oBalloon.BalloonValueSets.Item(1).ReferencedFiles.Item(1).ReferencedDocument
			
			Update_Balloon_Number(oBalloon.BalloonValueSets.Item(1).ItemNumber, oReferDoc)
		Next
	Else
		MessageBox.Show("Current docuement is not Drawing", "Document")
	End If
End Sub

Sub Update_Balloon_Number(ByVal ItemNumber As String, ByVal oDoc As Document) 

	Try
		oDoc.PropertySets.Item("Inventor User Defined Properties").Item("Balloon_Number").Value = ItemNumber
	Catch
		'catch error when iproperty doesn't exist and create it
		oDoc.PropertySets.Item("Inventor User Defined Properties").Add("", "Balloon_Number")
		'then set the property
		oDoc.PropertySets.Item("Inventor User Defined Properties").Item("Balloon_Number").Value = ItemNumber
	End Try 	
End Sub 

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network