Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
tjvz85
in reply to: Anonymous

Hi DanV,

 

I would like to add a sheet, based on an existing sheet format, for the part/assembly in my drawing.

The snippet you suggest fetches the file path, but how would I insert it into the code below, to fulfill the function I require? Any guidance would be appreciated.

 

' Set a reference to the drawing document.
' This assumes a drawing document is active.
Dim oDrawDoc As DrawingDocument
oDrawDoc = ThisApplication.ActiveDocument

'Set a reference to the sheet format named "C size, 4 view"
Dim oFormat As SheetFormat
Try
oFormat = oDrawDoc.SheetFormats.Item("C size, 4 view")
Catch
MessageBox.Show("Error: C size, 4 view might not exist.", "iLogic")
Return
End Try

'Open the model document invisible
Dim oModel As Document
oModel = ThisApplication.Documents.Open("C:\TEMP\block.ipt", False)

'Create a new sheet based on the sheet format using the specified model
Dim oSheet As Sheet
oSheet = oDrawDoc.Sheets.AddUsingSheetFormat(oFormat, oModel)