Hello
The position where dimension line starts is defined by the geometry intent. If you use the simple iLogic way the Intent point is defined somewhere on one drawingcurve of your named entity. You can specify the typ of intent you want. As your component has more then one drawing curve, you would also need to define somehow, which drawingcurve to use. The sample below gets the drawingcurve nearest to the planned position of dimension text. In my test the PointIntentEnums kStartPointIntent and kEndPointIntent returns the desired points. I don't know how Inventor defines which side of a drawing curve is start or end.
Dim Sheet_1 = ThisDrawing.Sheets.ItemByName("Blatt:1")
Dim Schnittansicht = Sheet_1.DrawingViews.ItemByName("B")
Dim genDims = Sheet_1.DrawingDimensions.GeneralDimensions
Dim DSUnten = Schnittansicht.GetIntent("Sheet Metal (mm):2","AussenDFlacheDSUnten",PointIntentEnum.kStartPointIntent,Schnittansicht.SheetPoint(0.7, 1.1))
Dim DSOben = Schnittansicht.GetIntent("Sheet Metal (mm):2", "AussenDFlacheDSOben",PointIntentEnum.kEndPointIntent,Schnittansicht.SheetPoint(0.7, 1.1))
Dim DickeDS = genDims.AddLinear("DickeDS", Schnittansicht.SheetPoint(0.7, 1.1), DSUnten, DSOben)
The sample above works for this one situation. You need a more universal workflow.
I think you need to:
- find all drawingcurves corresponding your named geometry
- compare start and end point to find the point of the drawingcurve with the highest Y value
- check if this point is start- or endpoint of the drawingcurve
- create a geometry intent with this point and the drawingcurve using the Sheet.CreateGeometryIntent method
I would also not use such a position of your dimension text. If you got the X,Y values of the points where your dimension lines are anchored, you can calculate a point relative to this points. E.g. DimensionText.X=(Point1.X+Point2.X)/2 and if Point1.Y >= Point2.Y then DimensionText.Y=Point1.Y+1 else DimensionText.Y=Point2.Y+1
R. Krieg
RKW Solutions
www.rkw-solutions.com