Issue with dimLinePoint Not Updating in Aligned Dimension

Issue with dimLinePoint Not Updating in Aligned Dimension

grilj.blaz2000
Contributor Contributor
584 Views
1 Reply
Message 1 of 2

Issue with dimLinePoint Not Updating in Aligned Dimension

grilj.blaz2000
Contributor
Contributor

Hi everyone,


I'm working with aligned dimensions in AutoCAD using the AcDbAlignedDimension class. I've been trying to update dimLinePoint, xline1Point, and xline2Point, but I’ve noticed that changes to dimLinePoint are not reflecting in the drawing.

Has anyone else experienced this? Are there specific methods or requirements I should be aware of to ensure that changes to dimLinePoint take effect?

If you look at the image below the first dimension is before moving xline1Point and xline2Point, second is how i want it to be after moving points and third dimension is how it is after moving xline points.

griljblaz2000_1-1730116439645.png

 

Code below should be moving aligned dimension xline1, xline2 and dim points, but its not working correctly.

 

AcDbAlignedDimension* pDimension = AcDbAlignedDimension::cast(entClone);

// Retrieve the current start, end, and dimension line points
AcGePoint3d startPt = pDimension->xLine1Point();
AcGePoint3d endPt = pDimension->xLine2Point();
AcGePoint3d dimPt = pDimension->dimLinePoint();
AcGePoint3d textPt = pDimension->textPosition();

// Scale xLine1, xLine2, and dimLinePoint
startPt.x = refPoint.x + (startPt.x - refPoint.x) * xScaleFactor;
startPt.y = refPoint.y + (startPt.y - refPoint.y) * yScaleFactor;

endPt.x = refPoint.x + (endPt.x - refPoint.x) * xScaleFactor;
endPt.y = refPoint.y + (endPt.y - refPoint.y) * yScaleFactor;

dimPt.x = refPoint.x + (dimPt.x - refPoint.x) * xScaleFactor;
dimPt.y = refPoint.y + (dimPt.y - refPoint.y) * yScaleFactor;

textPt.x = refPoint.x + (textPt.x - refPoint.x) * xScaleFactor;
textPt.y = refPoint.y + (textPt.y - refPoint.y) * yScaleFactor;

// Update the dimension with the new points
pDimension->setXLine1Point(startPt);
pDimension->setXLine2Point(endPt);
pDimension->setDimLinePoint(dimPt);
pDimension->setTextPosition(textPt); 



Thanks for your help!

0 Likes
Accepted solutions (1)
585 Views
1 Reply
Reply (1)
Message 2 of 2

tbrammer
Advisor
Advisor
Accepted solution

Try to call 

  AcDbDimension::generateLayout();

  AcDbDimension::recomputeDimBlock(bool forceUpdate = true);

after you changed the AcDbDimension and before you close it. This should update the dimension block.


Thomas Brammer ● Software Developer ● imos AGLinkedIn
If an answer solves your problem please [ACCEPT SOLUTION]. Otherwise explain why not.

0 Likes