Top  Previous  Next

You can add an iPart member (i.e. an instance of an iPart from the iPart's table) to an assembly by using the function AddiPartMember. The easiest type of call is when you know the index of the row of the table, for example row 3 in the example below:


CComPtr<ComponentOccurrence> pPartOcc = nullptr;

pOccurrencesList->AddiPartMember (CComBSTR("My_Factory.ipt"), // iPart factory file


                                 CComVariant(3), // Row of the iPart Factory Table, the "member"

                                 &pPartOcc) ;


You can also specify directly the member to insert using the Member string:



CComPtr<TransientGeometry> pTransGeom = ...

CComPtr<Matrix> pPosMatrix;

pTransGeom->CreateMatrix(&pPosMatrix); // Defaults to 0 0 0


CComPtr<ComponentOccurrence> pTroncOcc  ;

CComBSTR bstrTronchettiFile (L"C:\\TEST\\TEST_IPART.ipt") ;

CComBSTR bstrMember (L"30086486") ; // the Member value

pOccurrencesList->AddiPartMember (bstrTronchettiFile,pPosMatrix,_variant_t(bstrMember),&pTroncOcc) ;


As a reminder, the Member column is the first in the iPart table:





See also iPartFactory, listing members, and rotating parts in assemblies.

Text, images and diagrams © 2021 Owen F. Ransen. All rights reserved. (But copy the source code as much as you want!)