- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hallo,
since Inventor 22 it is possible to promote SketchDimensions via code. See here
via UI
The Model Dimensions promoted via 'Inventor' has the great feature that if i change an value in the sketch the value in the Model Value will change to.
Manuell created Model Dimensions do not have this feature.
I Assume that the Sketch Dimension (DimensionConstaint) and the Model Dimension (ModelDimension) are somehow connected.
I was checking the documentation, but i did not find any connection between the two objects.
Can somebody help me to find the connection between these objects, or how can i find out if one DimensionConstraint is already promoted and get the object ?!
Thanks in Advance
Christian
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Within the Modeldimensiondefinition you can find the promoted parameter. But for some reason i can't get the parameter. It results in a "not implemented" message. Maybe someone else knows how to deal with this.
Dim oDoc As PartDocument oDoc = ThisApplication.ActiveDocument Dim oDef As PartComponentDefinition oDef = oDoc.ComponentDefinition Dim oModelDim As ModelDimension For Each oModelDim In oDef.ModelAnnotations.ModelDimensions Dim oModelDef As ModelDimensionDefinition Dim oPara As Inventor.Parameter oModelDef = oModelDim.Definition oPara = oModelDef.PromoteParameter Logger.Info(oPara.Name) Next
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
With Inventor 2022.2 update it's now possible to use "Promoteparameter". tested it and it works fine ![]()