Add drawing dimension to sketched objects

Add drawing dimension to sketched objects

marco_lorenz1
Participant Participant
368 Views
1 Reply
Message 1 of 2

Add drawing dimension to sketched objects

marco_lorenz1
Participant
Participant

Hello,

 

My drawing has one view with one sketch attached to it and 2 circles drawn inside the sketch.

I would like to add a dimension to the 2 sketched circles just like the one which I have added manually (see attached file)

 

What am I doing wrong?

 

Inventor.DrawingDocument dDoc = _invApp.ActiveDocument as Inventor.DrawingDocument;

Inventor.Sheet sheet = dDoc.Sheets[1];

Inventor.DrawingView view = sheet.DrawingViews[1];

Inventor.DrawingSketch sketch = view.Sketches[1];

// c1, c2 are the 2 small circles which I want to dimension

Inventor.SketchCircle c1 = sketch.SketchCircles[1];

Inventor.SketchCircle c2 = sketch.SketchCircles[2];

// dim is the existing dimension on the drawing, added manually...

Inventor.GeneralDimension dim = sheet.DrawingDimensions[1] as Inventor.GeneralDimension;

 

// I tried xx possible combinations of param1 and param2  on CreateGeometryIntent

Inventor.GeometryIntent intent1 = sheet.CreateGeometryIntent(c1.Geometry.Center, Inventor.IntentTypeEnum.kPoint2dIntent);

Inventor.GeometryIntent intent2 = sheet.CreateGeometryIntent(c2.Geometry.Center, Inventor.IntentTypeEnum.kPoint2dIntent);

 

// and this does not work...

sheet.DrawingDimensions.GeneralDimensions.AddLinear(dim.Text.Origin, intent1, intent2);

 

Thanks for any help,

 

Marco

 

0 Likes
Accepted solutions (1)
369 Views
1 Reply
Reply (1)
Message 2 of 2

marco_lorenz1
Participant
Participant
Accepted solution

SOLVED

 

I could solve it by myself, this code does the job:

            Inventor.DrawingDocument dDoc = _invApp.ActiveDocument as Inventor.DrawingDocument;
            Inventor.Sheet sheet = dDoc.Sheets[1];
            Inventor.DrawingView view = sheet.DrawingViews[1];
            Inventor.DrawingSketch sketch = view.Sketches[1];
            Inventor.SketchCircle c1 = sketch.SketchCircles[1];
            Inventor.SketchCircle c2 = sketch.SketchCircles[2];
            Inventor.DrawingCurve dc1 = c1 as Inventor.DrawingCurve;
            Inventor.GeometryIntent intent1 = sheet.CreateGeometryIntent(c1 as Inventor.SketchEntity);
            Inventor.GeometryIntent intent2 = sheet.CreateGeometryIntent(c2 as Inventor.SketchEntity);
            Inventor.LinearGeneralDimension dim = sheet.DrawingDimensions[1] as Inventor.LinearGeneralDimension;
            Inventor.LinearGeneralDimension dim2 = sheet.DrawingDimensions.GeneralDimensions.AddLinear(dim.Text.Origin, intent1, intent2);

 

Thanks anyway,

 

Marco