11-02-2021
01:02 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
11-02-2021
01:02 PM
Hall Theo,
thanks for the anwer. But as you mentioned the 'PromoteParameter' does not work.
I 'found' a really sketchy solution how to identify a annotation depending on a DimensionConstraint.
I guess that this solution will be very easy to break, and if the other objects
- RadiusModelDimensions
- DiameterModelDimensions
- AngularModelDimensions
will work the same way ?? I don't know
public ModelAnnotation GetConnectedAnnotation(DimensionConstraint constraint)
{
logger.Debug($"GetConnectedAnnotation");
var annotations = applicationService.GetDocumentAnnotations();
foreach (var md in annotations.ModelDimensions)
{
if (md is LinearModelDimension modelDimension)
{
if (modelDimension.Definition is LinearModelDimensionDefinition lmdd)
{
if (lmdd.IntentOne.Geometry is SketchPoint sp)
{
foreach (var point in constraint.AnchorPoints)
{
if (point is Point2d point2d)
{
if (sp.Geometry.IsEqualTo(point2d))
{
if (Math.Abs(constraint._DisplayValue - modelDimension.ModelValue) <= 0)
{
logger.Debug($"found constraint : {constraint.Parameter.Name} Value:'{constraint.Parameter.Expression}' | modelDimesnion{modelDimension.Name} Value :'{modelDimension.ModelValue}'");
return md as ModelAnnotation;
}
}
}
}
}
}
}
}
return null;
}