Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Copy a sheet from another drawing

10 REPLIES 10
SOLVED
Reply
Message 1 of 11
AMN3161
965 Views, 10 Replies

Copy a sheet from another drawing

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 

10 REPLIES 10
Message 2 of 11

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

Regards,

Arthur Knoors

Autodesk Affiliations:

Autodesk Software:Inventor Professional 2024 | Vault Professional 2022 | Autocad Mechanical 2022
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: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 !

Message 3 of 11

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

Message 4 of 11
J-Camper
in reply to: AMN3161

@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?

Message 5 of 11
AMN3161
in reply to: J-Camper

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

 

Message 6 of 11
JhoelForshav
in reply to: AMN3161

@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)
Message 7 of 11
J-Camper
in reply to: AMN3161

@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
Message 8 of 11
J-Camper
in reply to: JhoelForshav

@JhoelForshav,

Looks like you were quicker on this one too haha

Message 9 of 11
AMN3161
in reply to: JhoelForshav

I see, thank you for the help!

Message 10 of 11
JhoelForshav
in reply to: J-Camper

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

Message 11 of 11
J-Camper
in reply to: JhoelForshav

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

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report