Message 1 of 3
Adding Partslist to all Sheets Based on Title Block of Sheet
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'm trying add a parts list to every sheet only if the sheet is using a specific Title Block. I think my variable needs to be a String, so that I test the names of the Title Block. I can assign a string variable to ActiveSheet.TitleBlock but then the variable doesn't iterate and stays constant. If make the variable an object, and assign it oSheet.TitleBlock, then I'm not sure how to use the "if" statement to test for the correct title block. Assigning an string to oSheet.TitleBlock just gives me the "Unable to cast COM object to class type String" error.
Any help would be awesome,
thanks.
'Places Parts List at top right corner for all drawing sheets with Anton B Title Block
Sub Main()
Dim oDrawDoc As DrawingDocument = ThisDoc.Document
Dim oSheet As Sheet = oDrawDoc.ActiveSheet
Dim oDrawingView As DrawingView = oSheet.DrawingViews(1)
Dim oBorder As Border = oSheet.Border
Dim oPlacementPoint As Point2d
Dim sTitleBlock As String
For Each oSheet In oDrawDoc.Sheets
oSheet.Update
oDrawDoc.Update
sTitleBlock = oSheet.TitleBlock
If sTitleBlock = "Anton B"
oPlacementPoint = oBorder.RangeBox.MaxPoint
Dim oPartsList As PartsList = oSheet.PartsLists.Add(oDrawingView, oPlacementPoint)
End If
Next
End Sub