Sharing the knowledge does a whole lot of good and I find that personally very rewarding.
|What!? just use post-it...|
Every once in awhile, on rare special occasion that can even return back in a multiplied form and the stress, wear out, paranoia, moody states from all the sleep deprivation goes away and you feel exalted again; not too long though, I got used to a level of tiredness and stress it’s hard to work otherwise.
We talked long and detailed (maybe too long) about how to create tags and balloons for equipment on the drawing. I was talking from a tube and pipe point of view but I have mentioned that this will be good for electronic components as well.
We talked about the general concept of drawing tagging, tagging the assembly, both together and even tagging top level components rather than end of tree fittings.
This can be very useful, and Colbjørn recognized the potential so he has adapted the code to help him get AutoCAD Electrical Tags into Inventor Drawing.
But the most important part is that he has shared the code for others to use, adapt, modify.
To be honest I wish I had his programming skill but I am, as often like to call myself, just “a mouse operator”.
You can find the original code here but I have added it down below (hope he doesn’t mind) for you.
Private Sub test(ByVal app As Inventor.Application)
Dim oDrawDoc As DrawingDocument = app.ActiveDocument
Dim oSheet As Sheet = oDrawDoc.ActiveSheet
Dim oBalloon As Balloon
For Each oSheets In oDrawDoc.Sheets
For Each oBalloon In oSheet.Balloons
Dim oLeader As Leader = oBalloon.Leader
Dim oLeaderNode As LeaderNode = oLeader.AllNodes(2)
Dim oGeometryIntent As GeometryIntent = oLeaderNode.AttachedEntity
Dim oDrawingCurve As DrawingCurve = oGeometryIntent.Geometry
Dim oModelGeom As Object = oDrawingCurve.ModelGeometry
Dim oComponentOccurrence As ComponentOccurrence = oModelGeom.ContainingOccurrence
Dim attrbSets = oComponentOccurrence.AttributeSets
Dim attrbSet = attrbSets.Item("com.autodesk.mechatronics")
Dim attrib = attrbSet.Item("ComponentTag")
Dim oBalloonValueSet As BalloonValueSet
If oBalloon.Style.Name = "Tags" Then
For Each oBalloonValueSet In oBalloon.BalloonValueSets
oBalloonValueSet.OverrideValue = attrib.Value
Thanks Colbjørn for sharing it; if you find it useful go give him kudos.