iLogic Help: Saving all parts in assembly & subassemblies into a folder.
Not applicable
09-29-2018
07:08 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi All,
Background:
I am making a process for creating models from pre-existing assemblies and then saving it all together including sub-assembly parts in a project folder.
I plan on then working out how to replace the references with the newly required parts.
The code below gets an error on this line
Dim oPartDoc As Inventor.PartDocument
and probably quite a few other errors.
I repurposed this from a piece i found for iterating through subassemblies parts and listing them to change the material.
Dim CreateNewModel = String.Format("C:\Here\Drawings\{0}-{1}\Drawings\Rev0\{0}-{1}.iam", DrawingReference, ProjectName) ThisDoc.Document.SaveAs(CreateNewModel, True) MessageBox.Show("New Project Save Successful", "Save New") ' Get the active assembly document. Dim oAsmDoc As AssemblyDocument oAsmDoc = ThisApplication.ActiveDocument ' Iterate through all of the documents refrenced by the assembly. Dim oDoc As Document For Each oDoc In oAsmDoc.AllReferencedDocuments ' Check to see if this is a part. If oDoc.DocumentType = kPartDocumentObject Then Dim oPartDoc As Inventor.PartDocument oPartDoc = oDoc Dim PartName As String = oDoc.ToString ' Set the material. Dim CreatePart = String.Format("C:\Here\Drawings\{0}-{1}\Drawings\Rev0\{2}.iam", DrawingReference, ProjectName, PartName) oPartDoc.Document.Saveas(CreatePart) End If Next
