Copy a sheet from another drawing

Copy a sheet from another drawing

AMN3161
Advocate Advocate
1,431 Views
10 Replies
Message 1 of 11

Copy a sheet from another drawing

AMN3161
Advocate
Advocate

Hello anyone have a rule that will copy a specific sheet from a specific drawing and insert it into the active drawing? I am trying to get around some of the limitations with Inventor Template files

 

thank you in advanced 

0 Likes
Accepted solutions (2)
1,432 Views
10 Replies
Replies (10)
Message 2 of 11

bradeneuropeArthur
Mentor
Mentor

https://forums.autodesk.com/t5/inventor-customization/ilogic-copy-drawing-sheet-from-one-drawing-to-... 

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 3 of 11

AMN3161
Advocate
Advocate

This is what i originally tried but i was having difficulty getting it to work

0 Likes
Message 4 of 11

J-Camper
Advisor
Advisor

@AMN3161,

 

Did you modify the code from the other forum post?  Can you post your modified version of the code? 

 

What kind of difficulties are you having?

0 Likes
Message 5 of 11

AMN3161
Advocate
Advocate

I am probably missing something stupid, i am new to ilogic

 

the drawing i want the sheet copied from is C:\_VAULT_WORKSPACE\JOBS\Templates\tag Testing (Tony).idw

The Sheet I want is called "Tags" on the above drawing

 

If ThisApplication.ActiveDocumentType <> DocumentTypeEnum.kDrawingDocumentObject Then
	MsgBox("This rule '" & iLogicVb.RuleName & "' only works for Drawing Documents.",vbOK, "WRONG DOCUMENT TYPE")
	Return
End If

Dim oDDoc As DrawingDocument = ThisDrawing.Document
Dim oOtherDocPath As String = "C:\_VAULT_WORKSPACE\JOBS\Templates\tag Testing (Tony).idw"
Dim oOtherDrawing As DrawingDocument = ThisApplication.Documents.Open(oOtherDocPath,False)
For Each oSheet As Sheet In oDDoc.Sheets
	If oSheet.Name.Contains("Tags") Then
		oSheet.CopyTo(oOtherDrawing)
	End If
Next

 

0 Likes
Message 6 of 11

JhoelForshav
Mentor
Mentor
Accepted solution

@AMN3161 

It looks like you just got the two drawing documents mixed up.

Is this what you want? 🙂

If ThisApplication.ActiveDocumentType <> DocumentTypeEnum.kDrawingDocumentObject Then
	MsgBox("This rule '" & iLogicVb.RuleName & "' only works for Drawing Documents.",vbOK, "WRONG DOCUMENT TYPE")
	Return
End If
Dim oDoc As DrawingDocument = ThisDoc.Document
Dim oOtherDocPath As String = "C:\_VAULT_WORKSPACE\JOBS\Templates\tag Testing (Tony).idw"
Dim oOtherDrawing As DrawingDocument = ThisApplication.Documents.Open(oOtherDocPath, False)
For Each oSheet As Sheet In oOtherDrawing.Sheets
	If oSheet.Name.StartsWith("Tags") Then oSheet.CopyTo(oDoc)
Next
oDoc.Update
ThisApplication.Documents.CloseAll(True)
0 Likes
Message 7 of 11

J-Camper
Advisor
Advisor
Accepted solution

@AMN3161,

 

It was pretty simple, you just needed to swap with drawing to look through and which drawing to copy to:

If ThisApplication.ActiveDocumentType <> DocumentTypeEnum.kDrawingDocumentObject Then
	MsgBox("This rule '" & iLogicVb.RuleName & "' only works for Drawing Documents.",vbOK, "WRONG DOCUMENT TYPE")
	Return
End If

Dim oDDoc As DrawingDocument = ThisDrawing.Document
Dim oOtherDocPath As String = "C:\_VAULT_WORKSPACE\JOBS\Templates\tag Testing (Tony).idw"
Dim oOtherDrawing As DrawingDocument = ThisApplication.Documents.Open(oOtherDocPath,False)
For Each oSheet As Sheet In oOtherDrawing.Sheets
	If oSheet.Name.Contains("Tags") Then
		oSheet.CopyTo(oDDoc)
	End If
Next
0 Likes
Message 8 of 11

J-Camper
Advisor
Advisor

@JhoelForshav,

Looks like you were quicker on this one too haha

0 Likes
Message 9 of 11

AMN3161
Advocate
Advocate

I see, thank you for the help!

0 Likes
Message 10 of 11

JhoelForshav
Mentor
Mentor

Hahah, sorry @J-Camper , but at least both our answers got accepted as solutions 😄

Message 11 of 11

J-Camper
Advisor
Advisor

Yeah no worries @JhoelForshav , I thought it was funny to happen twice within the hour haha

0 Likes