create a centerline by two points
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Trying to add a centerline to a drawing view but it keeps failing at the centerlines.add method. All I get is an ambiguous error message. What am i missing?
DrawingDocument oDoc = (DrawingDocument)oInventorApp.ActiveDocument;
Sheet oSheet = oDoc.ActiveSheet;
DrawingView oView = oSheet.DrawingViews[1];
Centerlines oLines = oSheet.Centerlines;
DrawingSketch oSketch = oView.Sketches.Add();
SketchPoints oPoints = oSketch.SketchPoints;
oSketch.Edit();
SketchPoint pnt1 = oPoints.Add(oITransGeo.CreatePoint2d(0, 0), false);
SketchPoint pnt2 = oPoints.Add(oITransGeo.CreatePoint2d(216 * 2.54, 0), false);
oSketch.ExitEdit();
GeometryIntent oInt1 = oSheet.CreateGeometryIntent(pnt1);
GeometryIntent oInt2 = oSheet.CreateGeometryIntent(pnt2);
ObjectCollection oCollection = oInventorApp.TransientObjects.CreateObjectCollection();
oCollection.Add(oInt1);
oCollection.Add(oInt2);
Centerline line = oLines.Add(oCollection);