Message 1 of 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Sub Template(oDDoc As DrawingDocument) Dim cnt As Integer Dim oTBDefs As TitleBlockDefinitions = oDDoc.TitleBlockDefinitions Dim oBDDefs As BorderDefinitions = oDDoc.BorderDefinitions Dim oTitleBlock As TitleBlock Dim oTitleBlkDef As TitleBlockDefinition Dim oTextBoxes As TextBoxes Dim operation, supplier, supplierDWG, companyName, patentNum, gauge, finish, material, quantity, gaugeDESC As New List(Of String) ...
cnt = 0 Dim originalSheet As Sheet = oDDoc.ActiveSheet For Each oSheet As Sheet In oDDoc.Sheets oSheet.Activate If seq = "Gauge" Then If gauge.Count > 0 Then ActiveSheet.SetTitleBlock("GAUGE INT title block", gauge.Item(cnt), finish.Item(cnt), material.Item(cnt), quantity.Item(cnt), gaugeDESC.Item(cnt)) ActiveSheet.Border = "GAUGE border" Else ActiveSheet.SetTitleBlock("GAUGE INT title block", "", "", "", "", "") ActiveSheet.Border = "GAUGE border" End If Else If oSheet.TitleBlock IsNot Nothing Then If ActiveSheet.TitleBlock = "Supplier title block" Or ActiveSheet.TitleBlock = "Supplier Title Block" Then If operation.Count > 0 Then ActiveSheet.SetTitleBlock("Supplier Title Block", operation.Item(cnt), supplier.Item(cnt), supplierDWG.Item(cnt), companyName.Item(cnt), patentNum.Item(cnt)) ActiveSheet.Border = "Enterprise border" Else ActiveSheet.SetTitleBlock("Supplier Title Block", "", "", "", "", "") ActiveSheet.Border = "Enterprise border" End If Else If operation.Count > 0 Then ActiveSheet.SetTitleBlock("Enterprise Title Block", operation.Item(cnt)) ActiveSheet.Border = "Enterprise border" Else ActiveSheet.SetTitleBlock("Enterprise Title Block", "") ActiveSheet.Border = "Enterprise border" End If End If Else If operation.Count > 0 Then ActiveSheet.SetTitleBlock("Enterprise Title Block", operation.Item(cnt)) ActiveSheet.Border = "Enterprise border" Else ActiveSheet.SetTitleBlock("Enterprise Title Block", "") ActiveSheet.Border = "Enterprise border" End If End If End If Dim ooPane As BrowserPane = oDDoc.BrowserPanes("Model") Dim oTopNode As BrowserNode = ooPane.TopNode Dim node As Object = FindBorderNode("Enterprise border", oTopNode.BrowserNodes) If Not node Is Nothing Then node.EnsureVisible() Else MsgBox("Enterprise border' not found for sheet: " & oSheet.Name) End If cnt = cnt + 1 Next
Function FindBorderNode(name, nodes) Dim node For Each node In nodes If name = node.BrowserNodeDefinition.Label Then FindBorderNode = node Exit Function End If FindBorderNode = FindBorderNode(name, node.BrowserNodes) If Not FindBorderNode Is Nothing Then Exit Function End If Next End Function
I am using the above code to update and place new title blocks and borders.
The border template has zone lines (see image below)
But when placing the border (on certain drawings only) the border disappears (see image below).
The node.EnsureVisible() code makes the zones visible, but it only works for the active sheet. It does not update all of the sheets.
Any assistance would be greatly appreciated!
Solved! Go to Solution.