Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Add angular dimension between sketch lines

3 REPLIES 3
Reply
Message 1 of 4
breinkemeyer
241 Views, 3 Replies

Add angular dimension between sketch lines

I'm trying to use sketchlines to add two angular dimensions in a drawing view (and having no luck).  What am I missing here?

 

double dOutX = 16.25 * 2.54;
double dOutY = 11.5 * 2.54;
double dInX = 14.0 * 2.54;
double dInY = 11.5 * 2.54;
double dTanX = 7.84615 * 2.54;
double dTanY = -3.26923 * 2.54;

 

oIDraftDoc = (DrawingDocument)oInventorApp.ActiveDocument;
oISheet = oIDraftDoc.Sheets[1];
oIBaseView = oISheet.DrawingViews[1];
oIDwgSketch = oIBaseView.Sketches.Add();
oISketchLines = oIDwgSketch.SketchLines;
oISketchArcs = oIDwgSketch.SketchArcs;
oISketchCircles = oIDwgSketch.SketchCircles;

oIAssyDoc = oIBaseView.ReferencedDocumentDescriptor.ReferencedDocument;
oIAssyCompDef = oIAssyDoc.ComponentDefinition;
oIWorkPoint = oIAssyCompDef.WorkPoints.AddFixed(oITransGeo.CreatePoint(0, 0, 0));
oICenterMark = oISheet.Centermarks.AddByWorkFeature(oIWorkPoint, oIBaseView, oICenterMarkStyle);

Point2d oCenterPoint = oIBaseView.ModelToDrawingViewSpace(oIWorkPoint.Point);

oIPoint2d[0] = oITransGeo.CreatePoint2d(oCenterPoint.X - dOutX, oCenterPoint.Y + dOutY);
oIPoint2d[1] = oITransGeo.CreatePoint2d(oCenterPoint.X - dInX, oCenterPoint.Y + dInY);
oIPoint2d[2] = oITransGeo.CreatePoint2d(oCenterPoint.X - dTanX, oCenterPoint.Y + dTanY);
oIPoint2d[3] = oITransGeo.CreatePoint2d(oCenterPoint.X + dTanX, oCenterPoint.Y + dTanY);
oIPoint2d[4] = oITransGeo.CreatePoint2d(oCenterPoint.X + dInX, oCenterPoint.Y + dInY);
oIPoint2d[5] = oITransGeo.CreatePoint2d(oCenterPoint.X + dOutX, oCenterPoint.Y + dOutY);

oIDwgSketch.Edit();
oISketchLine[0] = oISketchLines.AddByTwoPoints(oIPoint2d[0], oIPoint2d[1]);
oISketchLine[1] = oISketchLines.AddByTwoPoints(oISketchLine[0].EndSketchPoint, oIPoint2d[2]);

oISketchLine[2] = oISketchLines.AddByTwoPoints(oIPoint2d[3], oIPoint2d[4]);
oISketchLine[3] = oISketchLines.AddByTwoPoints(oISketchLine[2].EndSketchPoint, oIPoint2d[5]);

oISketchArc[0] = oISketchArcs.AddByCenterStartEndPoint(oCenterPoint, oISketchLine[1].EndSketchPoint, oISketchLine[2].StartSketchPoint, true);
oIDwgSketch.ExitEdit();

oIGeoIntent1 = oISheet.CreateGeometryIntent(oISketchLine[2]);
oIGeoIntent2 = oISheet.CreateGeometryIntent(oISketchLine[3]);

oIDrawingDims = oISheet.DrawingDimensions;
oIPoint2d[7] = oITransGeo.CreatePoint2d(oIBaseView.Left + oIBaseView.Width + 0.05, oIBaseView.Top + 0.05);
oIDim[1] = (GeneralDimension)oIDrawingDims.GeneralDimensions.AddAngular(oCenterPoint, oIGeoIntent1, oIGeoIntent2, null, true, false);

3 REPLIES 3
Message 2 of 4
dalton98
in reply to: breinkemeyer

What is the exact issue you are having? It's hard to test this since ilogic is in VB.net.

 

When I tried to recreate it i had problems with the "ModelToDrawingViewSpace" so I switched it to the already created centermark. Other than that "null" is not supported but thats probably not the problem. is there a specific line thats throwing  an error?

'Point2d oCenterPoint = oIBaseView.ModelToDrawingViewSpace(oIWorkPoint.Point) ;
Point2d oCenterPoint = oIBaseView.ModelToDrawingViewSpace(oICenterMark.Position);
Message 3 of 4
breinkemeyer
in reply to: breinkemeyer

ok, so it's not erroring and i've attached what I'm getting.  i added another dimension so here is the code

oIDrawingDims = oISheet.DrawingDimensions;
oIGeoIntent1 = oISheet.CreateGeometryIntent(oISketchLine[1]);
oIGeoIntent2 = oISheet.CreateGeometryIntent(oISketchLine[2]);

oIDim[0] = (GeneralDimension)oIDrawingDims.GeneralDimensions.AddAngular(oCenterPoint, oIGeoIntent1, oIGeoIntent2, null, true, false);


oIGeoIntent1 = oISheet.CreateGeometryIntent(oISketchLine[2]);
oIGeoIntent2 = oISheet.CreateGeometryIntent(oISketchLine[3]);


oIDim[1] = (GeneralDimension)oIDrawingDims.GeneralDimensions.AddAngular(oCenterPoint, oIGeoIntent1, oIGeoIntent2, null, true, false);

 

I feel like it's an issue with the geometryIntent, which, I admit to having a limited knowlege of.  please see the latest attachement.  the 70° one is correct, just in a horrible location.  the other is not correct.

 

Message 4 of 4
dalton98
in reply to: breinkemeyer

It looks like it it's just the placement of the dimension's text "oCenterPoint". Have you tried using the more "user friendly" ilogic way to dimension?

Link 

 

The "ModelToSketchSpace" might be the problem aswell. You might need to convert that again to the sheet space

Dim oSPoint As Point2d = oSketch.SketchToSheetSpace(oPoint)

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report