I have an algorithm that aims to move LeaderPoints of OrdinateDimension objects.
The process is basically to transform LeaderPoint in a Point3d and do some tricks with it (which I’m not allowed in entering in details). But then I have some issues:
- If I try to modify the original OrdinateDimension LeaderPoint to a new Point2d created from the modified Point3d, nothing happens (the set looks broken? don’t know)
- I also tried to create a new OrdinateDimension with the modified points and replace it, but this sometimes causes a weird behaviour that applies the wrong measure direction to it, I checked and the defined measure in Create() method is correct, but still not work.
Here is a code snipped on whats i’m trying to do
var tuple = dimensions.Zip(result, (dimension, point) => new { Dimension = dimension, Point = point });
List<OrdinateDimension> dimResult = new List<OrdinateDimension>();
foreach (var item in tuple)
{
item.Dimension.Get3dPoints(out Point3d basepoint, out Point3d defpoint, out Point3d leaderpoint, out _, out _);
Vector3d translation = item.Point - Point2dTo3d(item.Dimension.LeaderPoint);
if (translation.Length >= tolerance)
{
Transform transform = Transform.Translation(translation);
leaderpoint.Transform(transform);
}
OrdinateDimension newDim = OrdinateDimension.Create(item.Dimension.DimensionStyle, Plane.WorldXY, measure, basepoint, defpoint, leaderpoint, 0, 0);
dimResult.Add(newDim);
}
return dimResult;
And here is the output of the original dimension (on the left) and the modified dimensions (on the right)
I stored the measure
atribute as the same as the original dimensioning
Any help here would be apreciated. I also would really like to know how I can extract the MeasureDirection from a OrdinateDimension for debugging purposes.
Thanks!
Márcio