I need to add nodes to each segment of a shape such that each node is at a specified distance from the previous one.
I am aware of the + key functionality, but it is not useful as it adds too many nodes on short segments and long segments get nodes too far apart from each other.
EDIT:
I want to add nodes via a macro.
Thanks.
While doing some search on my own I found this code and modified it to just draw tangents:getperpendicularat
Sub GetPerpendicularAt_Test()'uses MarkPointOnPerpendicular Dim seg As Segment Dim t As Double Dim count As Integer count = 40If ActiveShape Is Nothing Then MsgBox "nothing selected" Exit SubEnd If For Each seg In ActiveShape.Curve.Segments For t = 0 To count Step 2 MarkPointOnPerpendicular seg, t / count, 0.2 Next t Next segEnd Sub
Private Sub MarkPointOnPerpendicular(seg As Segment, t As Double, curveLength As Double)'used by GetPerpendicularAt_Test method Dim x As Double, y As Double Dim dx As Double, dy As Double Dim a1 As Double, a2 As Double seg.GetPointPositionAt x, y, t, cdrRelativeSegmentOffset a1 = seg.GetTangentAt(t, cdrRelativeSegmentOffset) ' * 3.1415926 / 180 a2 = seg.GetPerpendicularAt(t, cdrRelativeSegmentOffset) * 3.1415926 / 180 'dx = 0.5 * Cos(a1) 'dy = 0.5 * Sin(a1) 'With ActiveLayer.CreateLineSegment(x, y, x + dx, y + dy) ' .Outline.EndArrow = ArrowHeads(1) 'End With dx = curveLength * Cos(a2) dy = curveLength * Sin(a2) ActiveLayer.CreateLineSegment x, y, x + dx, y + dyEnd Sub
As far as I can figure it out, the "seg.GetPointPositionAt x, y, t, cdrRelativeSegmentOffset" is the key here. This gets the points coordinates at equal distance along the segment and "ActiveLayer.CreateLineSegment x, y, x + dx, y + dy" uses thos x and y values to create a line from those points.
Need help to alter this code to add nodes at those x and y coordinates, instead of creating lines.
use Segment.AddNodeAt from macro above