Community
Sometimes when I try to read a rotated dimension property I get an exception.
Surely calling Dim.Measurement does not change the entity?
Here is the code fragment:
else if (entity.EntityType == Support.ikRotatedDimEnt)
{
AcadDimRotated Dim = null;
try
{
Dim = (AcadDimRotated)entity;
double x = Dim.Measurement; // <--- cause exception
}
catch
{
ABSup.Log.WriteLn(CLog.Type_e.ekLog, "Skipping a rotated DIM" );
}
}
I tried these with Python, no issues
import traceback
from pyrx_impx import Rx, Ge, Gi, Db, Ap, Ed, Ax
def PyRxCmd_xdoit1() -> None:
try:
dims = []
ax_app = Ax.getApp()
for ent in ax_app.ActiveDocument.ModelSpace:
if ent.ObjectName == 'AcDbRotatedDimension':
dim = Ax.AcadDimRotated(ent)
dims.append(dim.Measurement)
print(dims)
except Exception as err:
traceback.print_exception(err)
def PyRxCmd_xdoit2() -> None:
try:
dims = []
ikRotatedDimEnt = 15
ax_app = Ax.getApp()
for ent in ax_app.ActiveDocument.ModelSpace:
if ent.EntityType == ikRotatedDimEnt:
dim = Ax.AcadDimRotated(ent)
dims.append(dim.Measurement)
print(dims)
except Exception as err:
traceback.print_exception(err)
Many thanks for your reply. Unfortunately it does not always happen, even in C#. Not sure if I'm allowed to share the drawing or not though. I'll get back to you.
It could be that those dimensions are associated with some entity, something is causing them to update
Can't find what you're looking for? Ask the community or share your knowledge.