DrawingDimensions vs GeneralDimensions

Top  Previous  Next

The lists they give are often the same. DrawingDimensions is at a higher level than GeneralDimensions, and GeneralDimensions lets you get hold of the RetrievableDimensions.

 

   // This will get all the dimensions currently visible in the sheet as well as giving

   // you a way of getting the general dimensions and hence the retrievable dimensions...

   CComPtr<DrawingDimensions> pDimensions = nullptr ;

   hRes = pSheet->get_DrawingDimensions (&pDimensions) ;

 

   // The general dimensions gives you a way of getting at the retrievable dimensions....

   CComPtr<GeneralDimensions> pGenDimensions = nullptr ;

   hRes = pDimensions->get_GeneralDimensions (&pGenDimensions) ;

 

   // NOW you can get the retrievable dimensions

   CComPtr<ObjectCollection> pObjColl;

   hRes = pGenDimensions->GetRetrievableDimensions(pThisView, CComVariant(), &pObjColl);

 

Both GeneralDimensions and DrawingDimensions will also list the dimension objects in the sheet:

 

   for (long i = 1; i <= pGenDimensions->Count; i++) {

       CComPtr<GeneralDimension> pGenDim;

       pGenDimensions->get_Item(i, &pGenDim);

 

       CComPtr <DimensionText> pDimText;

       pGenDim->get_Text(&pDimText);

 

       CComBSTR DimText;

       pDimText->get_Text(&DimText);

 

       gLogger.Printf(ekLogMsg, L"GeneralDimension Type is <%d> <%s> Text is <%s>",

                      pGenDim->Type,

                      GetObjTypeDesc(pGenDim->Type),

                      CString(DimText));

   }

 

   for (long i = 1; i <= pDimensions->Count; i++) {

       CComPtr<DrawingDimension> pDwgDim;

       pDimensions->get_Item(i, &pDwgDim);

 

       double ModelValue;

       pDwgDim->get_ModelValue(&ModelValue);

 

       CComPtr <DimensionText> pDimText;

       pDwgDim->get_Text(&pDimText);

 

       CComBSTR DimText;

       pDimText->get_Text(&DimText);

 

       gLogger.Printf(ekLogMsg, L"DrawingDim Type is <%d> <%s> Text is <%s> ModelValue=%.2f",

                      pDwgDim->Type,

                      GetObjTypeDesc(pDwgDim->Type),

                      CString(DimText),ModelValue);

   }

 

Model value is the actual number of the value, whereas the Text is what appears in the drawing.

 

 

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