- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi all.
I created an Inventor 2021 assy (attacched as .zip) which is made up by 4 files: two are standard Inventor .ipt ones, while the others come from Solid Edge and SolidWorks files references too.
To made the assy up I used the 'Place Imported CAD Files' command.
Here is the assy structure:
Top node: invA004-CAD-00000108.iam
1st child → invP001:1 (invP001-CAD-00000102.ipt) →INVENTOR
2nd child → seP001-CAD-00000101:1 (seP001-CAD-00000101.par) → SOLID EDGE
3rd child → swP014-CAD-00000100:1 (swP014-CAD-00000100.SLDPRT) → SOLIDWORKS
4th child → invP002-CAD-00000104:1 (invP002-CAD-00000104.ipt) →INVENTOR
5th child → invP002-CAD-00000104:2 (invP002-CAD-00000104.ipt) →INVENTOR
Analyzing the assy I noted that when I try to get the occurences full paths thru the code below:
CComQIPtr<ComponentOccurrence> pCompOccurence = GetOccurence(); // to get the child occurrence
CComPtr<ComponentDefinition> pCompDef;
pCompDef = pCompOccurence->Definition;
CComPtr<IDispatch> pDispDoc = pCompDef->Document;
CComPtr<Document> pDoc;
if (pDispDoc)
{
pDispDoc.QueryInterface(&pDoc);
_bstr_t fullFileName = pDoc->FullFileName;
USES_CONVERSION;
std::string componentFullFilePath = OLE2A(fullFileName);
}
the resulting 'componentFullFilePath' string is a standard file path for Inventor .ipt components, while "codified" in case of other CADs ones.
For example, considering all files are in the 'C:\myPws' directory, in case of invP001:1 node I correctly obtain the 'C:\myPws\invP001-CAD-00000102.ipt' value, while for the seP001-CAD-00000101:1 node the '**C:\myPws\invA004-CAD-00000108.iam*LocalDocs*xAaaaqfdaAaaaaaaaAaaaaqcfWa*seP001-CAD-00000101.ipt' value.
However, I noted that for both Solid Edge and SolidWorks files, Inventor API return a good file path value when interrogating for OLE file descriptors, that is 'C:\myPWS\seP001-CAD-00000101.par' and 'C:\myPWS\swP014-CAD-00000100.SLDPRT'.
CComPtr<Document> m_InvenDoc = GetDocument(); // to get the current assy object
CComPtr<ReferencedOLEFileDescriptors> pRefOLEFileDescs;
pRefOLEFileDescs = m_InvenDoc->GetReferencedOLEFileDescriptors();
long OLERefCount = pRefOLEFileDescs->Count;
EPStatusType st = OK;
for (long i = 1; i <= OLERefCount; i++)
{
CComPtr<ReferencedOLEFileDescriptor> pRefOleFileDesc;
pRefOleFileDesc = pRefOLEFileDescs->GetItem(i);
_bstr_t fullName = pRefOleFileDesc->FullFileName;
USES_CONVERSION;
std::string fileName = OLE2A(fullName);
}
So... the question is: is there a way for getting good imported CAD files file paths while handling occurrences objects?
Thanks
Solved! Go to Solution.