How can I have multiple balloon sets on same drawing? How can show project Item Number on components and subassembly drawings?
In this case the user wanted to have dual balloons on all drawings but it works with as many balloons as you can fit in a drawing.
The first balloon will indicate current assembly Item Number, which translates to what position the item has in the current assembly and the second balloon was to show master Item Number which means what position this member has in the general, whole project, context.
He didn’t want to have dual set of documentation, one for fabrication and one for manuals because it was hard for him to maintain and update.
Three things are needed for this.
The user will place balloons on drawing as usual and we will change them for him but in order to do that we need a way of knowing which ones exactly he needs changing.
1. A new balloon style called “Pars Only”. I suggest you change the shape as well, like hexagonal type, maybe change text style too just to distinguish them better and update the code if you use a different name for the balloon.
2. A “PARTS ONLY” table but of the main assembly. Name it whatever you want but update the code.
User needs to place main assembly (project) “PARTS ONLY” parts list on the drawing so we can track and find this.
Do not filter the Parts Only table, it won’t work, there is no view for it to process. Design View reps or Ballooned Only filters won’t work.
3. iLogic code to process all “Parts Only” balloons and update value as in “PARTS ONLY” table.
You can do this with without a table but have the user browser for main iam and process BOM from that.
Here is a short video:
And here is the iLogic code:
' Set a reference to the drawing document.
' This assumes a drawing document is active.
Dim oDrawDoc As DrawingDocument
oDrawDoc = ThisApplication.ActiveDocument
' Set a reference to the active sheet.
Dim oActiveSheet As Sheet
oActiveSheet = oDrawDoc.ActiveSheet
Dim oStyles As DrawingStylesManager
oStyles = oDrawDoc.StylesManager
Dim oCurve As DrawingCurve
'Dim oEdge As EdgeProxy
Dim oOccurrence As ComponentOccurrence
Dim oGeometryIntent As GeometryIntent
'----------Update existing balloons on all sheets
'Ask the user if he wants to update values of all balloons (if edited some)
booleanParam = InputRadioBox("Update Parts Only balloons?: ", "Yes", "No", True, Title :="Update?")
If booleanParam = False Then
Exit Sub
ElseIf booleanParam = True
End If
Dim oSheet As Sheet
'process all sheets
For Each oSheets In oDrawDoc.Sheets
'----------find the parts list
oPartsLists = oActiveSheet.PartsLists
'try and get the parts list form the table of this sheet
Try
For i=1 To oPartsLists.Count
If oPartsLists.Item(i).Title = "PARTS ONLY" Then
oPartsList = oPartsLists.Item(i)
Exit For
Else
'do nothing
End If
Next
Catch
MessageBox.Show("No parts list named 'PARTS ONLY' found on drawing", "iLogic")
End Try
'----------end finding parts list
' Iterate over each balloon on the sheet.
For Each oBalloon In oActiveSheet.Balloons
If oBalloon.Style.Name = "Parts Only" Then
Try
Dim leader As Leader
Leader = oBalloon.Leader
'assuming the leader is a single line segment
Dim leaderNode As LeaderNode
leaderNode = leader.AllNodes(2)
oGeometryIntent = leaderNode.AttachedEntity
curve = oGeometryIntent.Geometry
oEdge = curve.ModelGeometry
oOccurrence = oEdge.ContainingOccurrence
'get the selected item document occurrence name
oOccDoc = oOccurrence.Definition.Document
'get the path and file name of the selected item
oOccFileName = oOccDoc.FullFileName
' Iterate over each value set (attached balloons) in a balloon.
For Each oBalloonValueSet In oBalloon.BalloonValueSets
'----------find item in parts list PARTS ONLY
' Iterate through the contents of the parts list.
Dim j As Long
For j = 1 To oPartsList.PartsListRows.Count
' Get the current row.
Dim oRow As PartsListRow
oRow = oPartsList.PartsListRows.Item(j)
'get filename of model in row
Dim oRowFileName As String
Try ' try and get the full file name of the PL item
oRowFileName = oRow.ReferencedFiles.Item(1).FullFileName
Catch 'on error go to next item
Continue For
End Try
'compare the filenames
'Performs a text comparison, based on a case-insensitive text sort order
'If strings equal returns 0
If StrComp(oOccFileName, oRowFileName, CompareMethod.Text)=0 Then
'Get the value of Item from the Parts List
'Row name needs to be case sensitive or use 1 for first 2 for second etc.
oCell = oPartsList.PartsListRows.Item(j).Item("ITEM")
'Row name needs to be case sensitive or use 1 for first 2 for second etc.
'get the value of text in cell
Dim oItemValue As String
oItemValue = oCell.Value
'------------change balloon value to Parts ONLY Item value
oBalloonValueSet.OverrideValue = oItemValue
End If
'go to next row in table
Next
'----------end find item in parts list PARTS ONLY
Next 'go to next attached balloon in set
Catch'do nothing if error
End Try
End If 'end of search for Tags balloons
Next
Next
'----------End Update existing balloons on all sheets
Later,
ADS
photo credit: Donahos Balloons over Colorado (license)
No comments:
Post a Comment