Message 1 of 7
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi all,
This is a problem I just came upon whilst working on a customer addin. Using c# I am attempting to add a leader note like this:
The part I am struggling with is accessing the start/end of the dimension line I wish to attach to.
Here is the code I have for this and the line that errors is in red:
private static void AddUniqueHoleCountsToDrawingView(Sheet drawingSheet, DrawingView baseView) { LeaderNotes leaderNotes = drawingSheet.DrawingNotes.LeaderNotes; double initialSpacing = 2; double spacingLeft = 1; double spacingRight = spacingLeft; foreach (LinearGeneralDimension item in UniqueYDimensions) { ObjectCollection leaderPoints = ThisApplication.TransientObjects.CreateObjectCollection(); Line2d dimLine = item.DimensionLine; double[] startPoint = new double[2]; double[] endPoint = new double[2]; dimLine.Evaluator.GetEndPoints(ref startPoint, ref endPoint); Point2d dimLineStart = TransGeom.CreatePoint2d(startPoint[0], startPoint[1]); Point2d dimLineEnd = TransGeom.CreatePoint2d(endPoint[0], endPoint[1]); Point2d leaderNoteElbow = null; Point2d leaderNotePosn = null; if (dimLineStart.Y < dimLineEnd.Y) //left? { if (spacingLeft == 1) { leaderNoteElbow = TransGeom.CreatePoint2d(dimLineStart.Y - initialSpacing, dimLineStart.X); leaderNotePosn = TransGeom.CreatePoint2d(leaderNoteElbow.Y, leaderNoteElbow.X + 2); } else { leaderNoteElbow = TransGeom.CreatePoint2d(dimLineStart.Y - initialSpacing - spacingLeft, dimLineStart.X); leaderNotePosn = TransGeom.CreatePoint2d(leaderNoteElbow.Y, leaderNoteElbow.X + 2); spacingLeft++; } leaderPoints.Add(dimLineStart); leaderPoints.Add(leaderNoteElbow); leaderPoints.Add(leaderNotePosn); } else { if (spacingRight == 1) { leaderNoteElbow = TransGeom.CreatePoint2d(dimLineEnd.Y - initialSpacing, dimLineEnd.X); leaderNotePosn = TransGeom.CreatePoint2d(leaderNoteElbow.Y, leaderNoteElbow.X - 2); } else { leaderNoteElbow = TransGeom.CreatePoint2d(dimLineEnd.Y - initialSpacing - spacingRight, dimLineEnd.X); leaderNotePosn = TransGeom.CreatePoint2d(leaderNoteElbow.Y, leaderNoteElbow.X - 2); spacingRight++; } leaderPoints.Add(dimLineEnd); leaderPoints.Add(leaderNoteElbow); leaderPoints.Add(leaderNotePosn); } LeaderNote newLeader = leaderNotes.Add(leaderPoints, "# Unique Holes"); } }
There don't seem to be ANY other posts that deal with dimensions in this way that I can find, so perhaps someone from Autodesk can help?
Thanks,
Alex.
----------------------------------------------------------------
Alex Fielder
Inventor Expert
https://github.com/alexfielder/
LinkedIn - Github Inventor Extension Server - Bonkers polygon iLogic thing
Top ten iLogic Tips - API Shortcut In Google Chrome - Assembly Extrusion Example
Alex Fielder
Inventor Expert
https://github.com/alexfielder/
LinkedIn - Github Inventor Extension Server - Bonkers polygon iLogic thing
Top ten iLogic Tips - API Shortcut In Google Chrome - Assembly Extrusion Example
Solved! Go to Solution.