Ilogic to copy .dwg balloon override value to assembly/part instance value IV2022

Ilogic to copy .dwg balloon override value to assembly/part instance value IV2022

cameron.florenceJMGNL
Participant Participant
454 Views
2 Replies
Message 1 of 3

Ilogic to copy .dwg balloon override value to assembly/part instance value IV2022

cameron.florenceJMGNL
Participant
Participant

Hi

 

I need to make a rule that copies the balloon override values of assembly parts in a .dwg to the new part instance property, available in IV2022.  I have been learning to write basic ilogic for a while now but am not at the level where I can sort this one out. 🤔

Any help would be amazing.

 

Cheers

 

 

0 Likes
455 Views
2 Replies
Replies (2)
Message 2 of 3

JhoelForshav
Mentor
Mentor

Hi @cameron.florenceJMGNL 

Try running this code in your drawing document to set the instance property "Balloon value" for all occurrences with balloons attached to them 🙂

 

Dim oDoc As DrawingDocument = ThisDrawing.Document
For Each oSheet As Sheet In oDoc.Sheets
	For Each oBalloon As Balloon In oSheet.Balloons
		Dim oVal As String
		If oBalloon.BalloonValueSets(1).Static 'Check if value is overridden
			oVal = oBalloon.BalloonValueSets(1).OverrideValue
		Else
			oVal = oBalloon.BalloonValueSets(1).Value
		End If
		'Get the occurrence the balloon is attached to
		Dim Leader As Leader = oBalloon.Leader
		Dim oLeaderNode As LeaderNode = Leader.AllNodes(2)
		Dim oIntent As GeometryIntent = oLeaderNode.AttachedEntity
		Dim oCurve As DrawingCurve = oIntent.Geometry
		Dim oProx As EdgeProxy = oCurve.ModelGeometry
		Dim oOcc As ComponentOccurrence = oProx.ContainingOccurrence

		'Set the instance property "Balloon value"
		oOcc.OccurrencePropertySetsEnabled = True
		Try
			oOcc.OccurrencePropertySets.Item(1).Add(oVal, "Balloon value")
		Catch
			oOcc.OccurrencePropertySets.Item(1).Item("Balloon value").Value = oVal
		End Try
	Next
Next
0 Likes
Message 3 of 3

cameron.florenceJMGNL
Participant
Participant

 

 that number/tag to the instance iProperty of the part.

If anyone has the capability to write some code to do this, it would be so helpful.

 

Thanks

0 Likes