I have the desktop connector set up and can import fusion files to inventor through the user interface - great. When I do this manually I get the two options: Reference or Convert.
I can open a .fusionDesign file using the API:
Sub openAndTranslate()
Set invApp = ThisApplication
Dim oDoc As Document
Set oDoc = invApp.Documents.Open("C:\...\part.FusionDesign")
End Sub
This converts the file into an inventor solid model. I'd like to make a referenced/ linked file.
Can I access the import options for this process through the API?
Should I be using: Call ThisApplication.Documents.OpenWithOptions() instead?
Alternatively, can I translate the file using the translation add-in object (ThisApplication.ApplicationAddIns.ItemById(sClientID)) I have the ClientID for the fusion translator, but Can't find any documented options - what settings are available there?
Solved! Go to Solution.
Solved by JhoelForshav. Go to Solution.
It doesn't seem like I have the necessary addin to import fusion files at all, so I can't really test this, but I think it's worth a try to create an assembly and import the file by creating a ImportedGenericComponentDefinition. That object has a property called ReferenceModel which sounds like what you're looking for.
If you have an assembly open and you want to do this through iLogic the rule would look something like this then:
Dim oDoc As AssemblyDocument = ThisApplication.ActiveDocument Dim oAssyCompDef As AssemblyComponentDefinition = oDoc.ComponentDefinition 'Create the ImportedGenericComponentDefinition based on a file Dim oImportedGenericCompDef As ImportedGenericComponentDefinition = oAssyCompDef.ImportedComponents.CreateDefinition( _ "C:\testfile.f3d") 'Set the ReferenceModel to associatively import the file 'True is the default value oImportedGenericCompDef.ReferenceModel = True 'Import the file to assembly Dim oImportedComp As ImportedComponent = oAssyCompDef.ImportedComponents.Add(oImportedGenericCompDef)
As I said. I can't try it myself because I cant even open fusion files in inventor so I can't really say if it works or not 🙂
Jhoel Forshav
Download my free Inventor Addin - Hole Projector
LinkedIn | Ideas | Contributions | Blog posts | Website
Yes thanks Jhoel,
I think the oImportedGenericCompDef.ReferenceModel = True is the key.
I found/adapted the following from the API help: https://help.autodesk.com/view/INVNTOR/2020/ENU/?guid=GUID-6D1F335F-7680-4F7D-9A26-F141DCD1B1BD
Sub AssociativelyImportToPartSample()
Dim oDoc As PartDocument
Set oDoc = ThisApplication.Documents.Add(kPartDocumentObject)
Dim oPartCompDef As PartComponentDefinition
Set oPartCompDef = oDoc.ComponentDefinition
' Create the ImportedGenericComponentDefinition bases on an fusion file
Dim oImportedGenericCompDef As ImportedGenericComponentDefinition
Set oImportedGenericCompDef = oPartCompDef.ReferenceComponents.ImportedComponents.CreateDefinition("C\...Part.fusiondesign")
' Set the ReferenceModel to associatively import the Fusion file, set this property to False will just convert
oImportedGenericCompDef.ReferenceModel = True
oImportedGenericCompDef.IncludeAll
' Import the file
Dim oImportedComp As ImportedComponent
Set oImportedComp = oPartCompDef.ReferenceComponents.ImportedComponents.Add(oImportedGenericCompDef)
End Sub
This imports a fusion design file into a part file as reference/linked. I know it says that the defult is to import as reference, but I don't think that is the case with oDoc = invApp.Documents.Open("part.fusiondesign") when I tried that it imports as a converted file - the previous user setting does not make any difference.
Can't find what you're looking for? Ask the community or share your knowledge.