- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
iLogic Help: Saving all parts in assembly & subassemblies into a folder.
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
@Anonymous
Inventor programming needs and issues need to be posting in the Inventor Customization forum. https://forums.autodesk.com/t5/inventor-customization/bd-p/120 I will have the moderator relocate your posting there for better results.
Mark Lancaster
& Autodesk Services MarketPlace Provider
Autodesk Inventor Certified Professional & not an Autodesk Employee
Likes is much appreciated if the information I have shared is helpful to you and/or others
Did this resolve your issue? Please accept it "As a Solution" so others may benefit from it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Is this code used in I-logic or VBA or else?
for me the code runs prefect in i-logic !
Regards,
Arthur Knoors
Autodesk Affiliations:
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: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 !
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I brought a friend in to have a look and now this stage is working.
Once the code is cleaned up I'll upload as a solution.