- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Its all in your point math. Calculated the middle point offset from the line to be exactly where you want the text center to be. tg.CreatePoint(x,y) use line midpoint or [ startpoint + ((line startpoint - line endpoint)/2)] to get the midpoint.
use line geometry 3d direction cross product (use the sketch plane normal vector for input) to get a vector (3d) that is 90deg from the line direction, but this has to be back translated from 3d model space to the 2d sketch space. Or you could calculate your own 2d cross product (a 2d vector). Or you could just use a rotation calculation. Then find a point that is from midpoint along the new direction a distance of your intended offset (such as 1/4").
If you know line direction is vertical or horizontal from the beginning, then you wouldn't need vector calculus to pick a position, you simply need to manipulate x and y by adding offsets.
Vertical line: x = midpoint x + offset, y = midpoint y
Horizontal line: x = midpoint x, y = midpoint y + offset