@oransen,
Try below C++ code to retrieve dimensions of occurrence from Drawing document. This code is tested with attached sample drawing.
CComPtr<Document> pDoc;
Result = pInvApp->get_ActiveDocument(&pDoc);
CComPtr<DrawingDocument> pDrawDoc;
pDrawDoc = pDoc;
CComPtr<Sheet> Draw_Sheet;
Result = pDrawDoc->get_ActiveSheet(&Draw_Sheet);
DrawingViewsPtr draw_Views;
Result = Draw_Sheet->get_DrawingViews(&draw_Views);
DrawingViewPtr Draw_View;
Result = draw_Views->get_Item(1, &Draw_View);
IDispatchPtr pReferDoc;
Result = Draw_View->ReferencedDocumentDescriptor->get_ReferencedDocument(&pReferDoc);
CComQIPtr<Document> pReferDocument = CComQIPtr<Document>(pReferDoc);
CComQIPtr<AssemblyDocument> pAssyDoc;
pAssyDoc = pReferDocument;
CComPtr<AssemblyComponentDefinition> pAssDef;
Result = pAssyDoc->get_ComponentDefinition(&pAssDef);
CComPtr<ComponentOccurrence> pOcc;
Result = pAssDef->Occurrences->get_Item(1, &pOcc);
DrawingDimensionsPtr Draw_Dims;
Result = Draw_Sheet->get_DrawingDimensions(&Draw_Dims);
GeneralDimensionsPtr draw_Gen_Dims;
Result = Draw_Dims->get_GeneralDimensions(&draw_Gen_Dims);
CComPtr<ObjectCollection> pObjCollection;
CComPtr<ObjectCollection> pGenDimsEnum;
Result = draw_Gen_Dims->GetRetrievableDimensions(Draw_View, _variant_t((IDispatch*)pOcc), &pObjCollection);
long no_of_Retrieved_Dim = 0;
if (pObjCollection != NULL)
{
Result = pObjCollection->get_Count(&no_of_Retrieved_Dim);
}
return S_OK;
Please feel free to contact if there is any queries.
If solves problem, click on 'Accept as solution' / give a 'Like'.
Thanks and regards,
CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network