10-23-2019
02:42 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
10-23-2019
02:42 PM
Hi Forum,
I have two different Part List Styles that I use on my drawings and I am trying to write a code to switch in between them. Lets say I have a Part List Style named as "Style One" and "Style Two". Here's what I got so far:
Dim oDrawDoc As DrawingDocument = ThisApplication.ActiveDocument Dim oPartsList As PartsList = oDrawDoc.ActiveSheet.PartsLists(1) oPartsList.Style() = "Style Two"
This code doesn't seem to work. Anyone have an idea?
Thanks,
- Felix Cortes
Solved! Go to Solution.
10-23-2019
04:43 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
10-23-2019
04:43 PM
Hi
Try this.
Once you have got it working, expand the code to include a multivalue list, allowing a wider selection.
Dim oDrawDoc As DrawingDocument
oDrawDoc = ThisApplication.ActiveDocument
Dim oPartsList1 As PartsList
oPartsList1 = oDrawDoc.ActiveSheet.PartsLists.Item(1)
oPartsList1.Style = oDrawDoc.StylesManager.PartsListStyles.Item("Style Two")
Reg
2025.2
2025.2
10-24-2019
06:21 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
10-24-2019
06:21 AM
Thanks rhasell
How could I add a multilist? Seems like iLogic only has a limited input boxes
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