How to get iPart factory parent from child member

Top  Previous  Next

In C++ follow this example:

 

   // This will give you "C:\Users\Owen\Documents\Inventor\Tubi_Rame_12-7_Liscio_Sp0,75.IPT"

   wchar_t* pszFullName = LPWSTR (pTroncCompDef->iPartMember->ReferencedDocumentDescriptor->FullDocumentName);

   if (pszFullName == nullptr) {

       return false;

   }

 

   // Now get "Tubi_Rame_12-7_Liscio_Sp0,75.IPT"

   CString csIPartFileName(pszFullName);

   StripPath(csIPartFileName);

 

   // Now load with "Tubi_Rame_12-7_Liscio_Sp0,75.IPT"

   LoadTronchettiFile(csIPartFileName);

 

   if (csIPartFileName.GetLength() < NUM_SAP_CHARS) {

       return false;

   }

 

   // Get the member name "30089191.IPT"

   const CString kcsPartName = GetPartName(pTroncCompDef);

 

   // Remove the IPT to get "30089191"

   const CString kcsTroncSapCode = kcsPartName.Mid(0, NUM_SAP_CHARS);

 

   // Use "30089191" to find the details

   return GetTroncDetailsByCode(Details,kcsTroncSapCode);

 

 

In VB it would be like this:

 

Public Sub main()

 

  Dim a As Application

  Set a = ThisApplication

 

  Dim b As PartDocument

  Set b = a.ActiveDocument

 

  a.Documents.Open (b.ComponentDefinition.iPartMember.ReferencedDocumentDescriptor.FullDocumentName)

 

End Sub

 

I need to translate this into C++.

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