Drawing Zones Disappearing

Drawing Zones Disappearing

a81383
Enthusiast Enthusiast
196 Views
2 Replies
Message 1 of 3

Drawing Zones Disappearing

a81383
Enthusiast
Enthusiast
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)

a81383_0-1743517052238.png

 

But when placing the border (on certain drawings only) the border disappears (see image below).

a81383_2-1743517113898.png

 

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! 

 

 

 

 

0 Likes
Accepted solutions (1)
197 Views
2 Replies
Replies (2)
Message 2 of 3

a.brusamolino
Enthusiast
Enthusiast

HI!

I don’t think I quite understood the issue, but I can try to make a guess:

The fact that in some drawings you don’t see the edges as in the template might be due to certain local definitions present in the document not being updated according to the ones in the template (which may have been modified after the creation of that document). Therefore, you should first make sure to copy the border definitions from the template into the document, so you’ll have the updated ones properly, and then use them. You can give it a try if you want.

 

Regarding the last part of the code, it’s unclear to me how the command node.ensurevisible() could help achieve the result you want...

0 Likes
Message 3 of 3

a81383
Enthusiast
Enthusiast
Accepted solution

Hi @a.brusamolino,

 

Thank you for your reply. You are correct the node.ensurevisible() does nothing I've removed it from the code.

 

The solution ended up being, I had to completely delete all title blocks & borders from each sheet. Then replace the references in the drawing. Then add them back in. 

 

I do not believe that this should have to be done this way. It seems to me like this may be a glitch in the older drawings. But it works!

Example:

	For Each oSheet As Sheet In oDDoc.Sheets
		If oSheet.Border IsNot Nothing Then oSheet.Border.Delete
		If oSheet.TitleBlock IsNot Nothing Then oSheet.TitleBlock.Delete
	Next