Let's say I have two points in my sheet (10, 20) and (20, 20), and I want to create a DrawingDimension between those points. There is no geometry intent I can provide, so using any of the "GeneralDimensions.Add" method is not possible.
Still, one way to do it can be to create this dimension to a DrawingSketch, regarding converting the point positions from the sheet space to the sketch space, then use the "GeneralDimensions.Retrieve" method to make the Sketch dimension visible into the Sheet.
Here is a sample that illustrates this workflow in C#:
void addDimWithoutGeo()
{
// assume we have had Inventor application
DrawingDocument oDrawingDoc =
(DrawingDocument)mApplication.ActiveDocument;
TransientGeometry oTG =
mApplication.TransientGeometry;
//Create new Drawing Sketch
DrawingSketch oSketch =
oDrawingDoc.ActiveSheet.DrawingViews[1].
Sketches.Add();
//Create 2 points in the sheet space
Point2d oSheetPoint1 =
oTG.CreatePoint2d(10, 20);
Point2d oSheetPoint2 =
oTG.CreatePoint2d(20, 20);
//Convert points in sketch space
Point2d oInSketchPoint1 =
oSketch.SheetToSketchSpace(oSheetPoint1);
Point2d oInSketchPoint2 =
oSketch.SheetToSketchSpace(oSheetPoint2);
//Edit sketch
oSketch.Edit();
//Create 2 sketch points
SketchPoint oSketchPoint1 =
oSketch.SketchPoints.Add(oInSketchPoint1, false);
SketchPoint oSketchPoint2 =
oSketch.SketchPoints.Add(oInSketchPoint2, false);
//Set position for the text
Point2d oTextPosition =
oTG.CreatePoint2d(0, 0);
//Create dimension in sketch
oSketch.DimensionConstraints.AddTwoPointDistance(
oSketchPoint1,
oSketchPoint2,
Inventor.DimensionOrientationEnum.kAlignedDim,
oTextPosition,
false);
//Close sketch
oSketch.ExitEdit();
//Retrieve dimensions of the sketch in the sheet
object dummy = null;
oDrawingDoc.ActiveSheet.DrawingDimensions.
GeneralDimensions.Retrieve(oSketch, dummy);
}