Export main assembly to RFA file using iLogic

Export main assembly to RFA file using iLogic

frahaman7SKBG
Advocate Advocate
638 Views
1 Reply
Message 1 of 2

Export main assembly to RFA file using iLogic

frahaman7SKBG
Advocate
Advocate

Looking for help with iLogic to export main iam assembly to RFA. 

 

Found this thread, but this code exports all the individual components and not the whole assembly. 

https://forums.autodesk.com/t5/inventor-ilogic-api-vba-forum/rfa-export/m-p/9783828#M116607

 

639 Views
1 Reply
Reply (1)
Message 2 of 2

WCrihfield
Mentor
Mentor

Hi @frahaman7SKBG.  I haven't tested this yet, so be careful, because I don't use BIM stuff.  But in theory the following simpler iLogic code should work for you if you just want to export the main assembly.  It simply captures the currently 'active' assembly document, then uses the same path and file name as that assembly, but with the ".rfa" file extension when exporting the rfa file.  If you need to change the path or file name further, you can change the line defining oFFN, or use multiple more lines to manipulate the string (text). 

If ThisApplication.ActiveDocumentType <> DocumentTypeEnum.kAssemblyDocumentObject Then
	MsgBox("An Assembly Document must be active for this rule to work. Exiting.",vbOKOnly+vbCritical, "WRONG DOCUMENT TYPE")
	Exit Sub
End If
'gets the 'active' assembly document
Dim oADoc As AssemblyDocument = ThisApplication.ActiveDocument
Dim oADef As AssemblyComponentDefinition = oADoc.ComponentDefinition
'same path & file name as active assembly, but with ".rfa" file extension
Dim oFFN As String = System.IO.Path.ChangeExtension(oADoc.FullFileName, ".rfa")
'export
oADef.BIMComponent.ExportBuildingComponent(oFFN)

If this solved your problem, or answered your question, please click ACCEPT SOLUTION.
Or, if this helped you, please click (LIKE or KUDOS) 👍.

If you want and have time, I would appreciate your Vote(s) for My IDEAS 💡or you can Explore My CONTRIBUTIONS

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes