- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Good Day,
Is there a way to copy a drawing sheet to a main drawing.
I would like my main drawing to be a machine GA, but from this drawing I would like to run a rule to search for the shop detailing drawings and copy their relevant sheets to my main GA drawing to create an all in one drawing file.
Is there a way to do this silently (without visibly opening the the shop detail drawing)?
Thank you.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Here's one way of doing it.
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:\Temp\MasterDrawing.idw"
Dim oOtherDrawing As DrawingDocument = ThisApplication.Documents.Open(oOtherDocPath,False)
For Each oSheet As Sheet In oDDoc.Sheets
If oSheet.Name.Contains("Shop") Then
oSheet.CopyTo(oOtherDrawing)
End If
Next
Wesley Crihfield
(Not an Autodesk Employee)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
With a couple of tweaks to suit my application your solution worked perfectly
Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
It is possible to change:
from: adresse fixe
to: Open drawing
I like to copy sheets from tamplate withs notes and details to new drawing
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Sure. Which way would you prefer the rule to work:
- The 'new' drawing will be the 'active' drawing when you run the rule, then you open the template drawing (using open dialog) and copy sheets from the template into the new/active drawing.
- The template drawing will be the 'active' drawing when you run the rule, then you open the 'other' drawing (using open dialog), and copy the sheets from the template to the 'other' drawing.
- The 'new' drawing will be the 'active' drawing when you run the rule, and the template file's full file name is hard coded into the rule (no open dialog needed), so it will invisibly open the template in the background, and copies the sheets to the active drawing.
Wesley Crihfield
(Not an Autodesk Employee)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Quand je suis dans nouv dessin et execut la regle, les pages nomée va apparetre sur mon nouv dessin.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Here is a similar iLogic rule that will either silently open the template drawing, without using an open file dialog, or can use the open file dialog, depending on which lines you leave commented out. If not using the open file dialog, make sure the path and name of the template drawing are correct in the rule before running it. Since I am not sure which 'named' sheets you want to copy over, I removed the 'filter' question, and the code will now try to copy all sheets over. If you need it to be more specific, I would need to know how to filter for which sheets to copy. If there is a list of specific sheet names, we could include them into the rule, as the filter.
Sub Main
If ThisDoc.Document.DocumentType <> DocumentTypeEnum.kDrawingDocumentObject Then
MsgBox("A Drawing document must be active for this code to work. Exiting.", vbCritical, "")
Exit Sub
End If
Dim oDDoc As DrawingDocument = ThisDoc.Document
Dim sTemplatesPath As String = ThisApplication.DesignProjectManager.ActiveDesignProject.TemplatesPath
Dim sTemplateFile As String = sTemplatesPath & "\Drawing.idw" '<<< EDIT THIS >>>>
'Dim sTemplateFile As String = BrowseForDrawing 'calls the custom Function below
'If sTemplateFile = "" Then Exit Sub
Dim oTemplate As DrawingDocument = ThisApplication.Documents.Open(sTemplateFile, False)
For Each oSheet As Sheet In oTemplate.Sheets
oSheet.CopyTo(oDDoc)
Next
oDDoc.Update2(True)
End Sub
Function BrowseForDrawing() As String
Dim oFileDialog As Inventor.FileDialog
ThisApplication.CreateFileDialog(oFileDialog)
oFileDialog.DialogTitle = "Select Source Template Drawing."
oFileDialog.InitialDirectory = ThisApplication.DesignProjectManager.ActiveDesignProject.WorkspacePath
oFileDialog.Filter = "Autodesk Inventor Drawings (*.dwg;*.idw) | *.dwg;*.idw"
oFileDialog.MultiSelectEnabled = False
oFileDialog.OptionsEnabled = False
oFileDialog.CancelError = True
oFileDialog.InsertMode = False
Try
oFileDialog.ShowOpen
Catch
End Try
Return oFileDialog.FileName
End Function
If this solved your problem, or answered your question, please click ACCEPT SOLUTION .
Or, if this helped you, please click (LIKE or KUDOS)
.
Wesley Crihfield
(Not an Autodesk Employee)