10-24-2019
05:07 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
10-24-2019
05:07 PM
Hi
Here is a copy of my code.
You will need to create a parts list style for each configuration.
The code is not triggered, so it has to be run after a change is made.
'Apply Parts List Filter
'Created 17/07/2017
'PRTL = Parts List
'Reg Hasell
Sub Main
'Choose the parts list, 1 is the first one placed.
oPRTL = InputBox("Choose the Parts List", "Parts List Filter", "1")
'Create a multi value list if not there.
Call Create_Params()
Call ApplyFilter(oPRTL)
End Sub
Sub Create_Params()
' Get the UserParameters collection
Dim userParams As UserParameters
userParams = ThisDoc.Document.Parameters.UserParameters
'check for parameter and create if not found
Try
oPartslist = Parameter("Parts_List")
Catch
'multi-value text parameter
userParams.AddByValue("Parts_List", "ALL", UnitsTypeEnum.kTextUnits)
'Option of two types, this is also present in the Global Form
MultiValue.SetList("Parts_List", "ALL", "No_Fasteners", "Fasteners_Only")
End Try
Parameter.Param("Parts_List").IsKey = True
End Sub
Sub ApplyFilter(oPRTL)
On Error Resume Next
Dim oDrawDoc As DrawingDocument
oDrawDoc = ThisApplication.ActiveDocument
Dim oPartsList1 As PartsList
oPartsList1 = oDrawDoc.ActiveSheet.PartsLists.Item(oPRTL)
oPartslist = Parameter("Parts_List")
If oPartslist = "ALL"
oPartsList1.Style = oDrawDoc.StylesManager.PartsListStyles.Item("Parts List")
Else If oPartslist = "No_Fasteners"
oPartsList1.Style = oDrawDoc.StylesManager.PartsListStyles.Item("Parts List-NoFasteners")
Else If oPartslist = "Fasteners_Only"
oPartsList1.Style = oDrawDoc.StylesManager.PartsListStyles.Item("Parts List-Fasteners")
End If
End Sub
Reg
2025.2
2025.2