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

Ilogic save as every sheets as an independent .idw

MKE_Howard
Collaborator

Ilogic save as every sheets as an independent .idw

MKE_Howard
Collaborator
Collaborator

Hi, Ive been trying to find a code that could save as my sheets to a new .idw file. I tried some code that I found on the forum but it save as .pdf. 

 

Do someone have an idea how I can do this? Thanks a lot

0 Likes
Reply
200 Views
2 Replies
Replies (2)

WCrihfield
Mentor
Mentor

Hi @MKE_Howard.  Maybe this simple example will work for you, or at least get you the needed information to build your own similar version.  The key method here is the Sheet.CopyTo method, that copies a sheet from the current drawing to another drawing.

If ThisDoc.Document.DocumentType <> DocumentTypeEnum.kDrawingDocumentObject Then Exit Sub
Dim oDDoc As DrawingDocument = ThisDoc.Document
Dim oPathAndName As String = ThisDoc.PathAndFileName(Fasle)
For Each oSheet As Sheet In oDDoc.Sheets
	Dim oNewIDW As DrawingDocument = ThisApplication.Documents.Add(DocumentTypeEnum.kDrawingDocumentObject)
	Dim oCopiedSheet As Sheet = oSheet.CopyTo(oNewIDW)
	For Each oSht As Sheet In oNewIDW.Sheets
		If oSht IsNot oCopiedSheet Then oSht.Delete
	Next
	'need code here to provide different file name to each new document
	Dim oNewFullFileName As String = oPathAndName & "-" & oSheet.Name & ".idw"
	oNewIDW.SaveAs(oNewFullFileName, False)
Next

If this solved your problem, or answered your question, please click ACCEPT SOLUTION .
Or, if this helped you, please click (LIKE or KUDOS) :thumbs_up:.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes

MKE_Howard
Collaborator
Collaborator
Give me a couple hours to find the time and to try this... Ill get back to you thanks a lot
0 Likes