Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

Replace IAM with STP as multibody part (VBA)

tom_schmitt
Contributor

Replace IAM with STP as multibody part (VBA)

tom_schmitt
Contributor
Contributor

Hello

we replace a part of the assemblies in a document with generatet SAT Files. We do it manually: Save the IAM as SAT and then with Component --> "Replace with..". In the dailog we choose the SAT File and under SAT-Import options the option: import as a single part (or multibody part - don't know if it is the right translation). See the attached file. Then the IAM will replaced with an IPT from the SAT.

 

Now we will automate this process, but there is the following problem: If we replace via VBA the IAM with the SAT File with: Call Occurence.Replace(SATFile, True)) the SAT import has as result a new Assembly, not a new Part like in the manually process.

So my question is: where can i find the the possibility to import the SAT as a single multibody part in VBA?

 

We use INV1015

 

Thanks Tom

0 Likes
Reply
Accepted solutions (1)
524 Views
2 Replies
Replies (2)

wayne.brill
Collaborator
Collaborator
Accepted solution

Hi Tom,

 

A colleague in Inventor Engineering confirms that there is not a direct way to replace a component with an SAT and have it be a part.

 

>> >>

If users directly specify a SAT for the ComponentOccurrence.Replace method, Inventor will import the SAT using default settings(which will import the SAT as assembly).

 

If the user wants to open the SAT as a single part with multiple solids, he/she can use below VBA code to import the SAT, and then save the part document and use it to replace the component:

 

Sub ImportSATSample()
    Dim oSat As TranslatorAddIn
    Set oSat = ThisApplication.ApplicationAddIns.ItemById("{89162634-02B6-11D5-8E80-0010B541CD80}")

    Dim oDM As DataMedium
    Set oDM = ThisApplication.TransientObjects.CreateDataMedium
    Dim oContext As TranslationContext
    Set oContext = ThisApplication.TransientObjects.CreateTranslationContext
    oContext.Type = kDataDropIOMechanism
    
    Dim oOptions As NameValueMap
    Set oOptions = ThisApplication.TransientObjects.CreateNameValueMap
    
    oDM.MediumType = kFileNameMedium
    oDM.FileName = "C:\Temp\Sat.sat"
    
    ' Import SAT as a single part with multiple solid bodies
    oOptions.Add "ImportAASP", True
    oOptions.Add "ImportAASPIndex", 0

    Dim oDoc As PartDocument
    Set oDoc = ThisApplication.Documents.Add(kPartDocumentObject)
    
    Call oSat.Open(oDM, oContext, oOptions, oDoc)
    oDoc.SaveAs "C:\Temp\Sat.ipt", False
    
End Sub

 

 

<< <<

 

 

Thanks,

Wayne



Wayne Brill
Developer Technical Services
Autodesk Developer Network

tom_schmitt
Contributor
Contributor

Hello Wayne,

 

thanks a lot for your reply.

I already found the same solution of the problem and with this method it runs really good.

You havte to save the part as a SAT, import the SAT file in this way (over the ImportAASPIndex feature), save the file as IPT and then replace the IAM with this IPT.

The macro helps my colleagues to save time by reducing their manually work.

One thing i noticed: If i make the manual way (Component->Replace) the ipt will be smaller (30%) and has another structure. See the pictures.

 

I have to find out, which other parameter from the ValueMap of the AddIn is responsible for this.

Problem is that i doesnt find any docu in detail.

 

BR

Tom

 

2.JPG1.JPG

0 Likes