Message 1 of 7
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Sheet 1 has an iam file on it and a parts list.
Everything is good.
Sheet 2 has a ipn file on it and a parts list.
I want this parts list to use a different style.
I've got the below code, but it doesn't work. I believe it's because it's checking the file used on sheet 1 to see it's an ipn instead of sheet 2. I think this is probably the problem, but I don't know how to fix it:
oType = oDoc.DocumentSubType.DocumentSubTypeID
The code works if I put the ipn on sheet 1.
Another question is, what does the (1) mean in this line?
oSheet.PartsLists(1)
Sub Main Dim oDoc As Document oDoc = ThisDrawing.ModelDocument Dim oType As String oType = oDoc.DocumentSubType.DocumentSubTypeID 'is View 1 a part If oType = "{76283A80-50DD-11D3-A7E3-00C04F79D7BC}" Then PLstyle 'run function Return Else Logger.Info("Presentation File Not Found", filename) End If End Sub Function PLstyle Dim openDoc As Document 'assumes a drawing document is active. Dim oDrawDoc As DrawingDocument oDrawDoc = ThisApplication.ActiveDocument 'Set a reference to the active sheet. Dim oSheet As Sheet oSheet = ThisDrawing.Sheet("Sheet:2")'oDrawDoc.ActiveSheet 'Look for partlist within drawing. End rule, if it doesn't exist. 'say there is a Partslist on the sheet. Dim oPartslist As PartsList oPartslist = oSheet.PartsLists(1) If oSheet.PartsLists(1) IsNot Nothing Then 'set parts list to a specific style oPartslist.Style = oDrawDoc.StylesManager.PartsListStyles.Item("Exploded Parts List") Else Logger.Info("Parts list not found.", filename) End If End Function

Solved! Go to Solution.