Hello,
I have a diagonal line and would like to reduce it's length by 2 units. Is this done by trigonometry or are there utility functions available for computing points based on angle and length?
Thanks in advance!
Jr.
Add nod for first segment into position of it second node then move third node by 2 inchess.Curve.Segments.First.AddNodeAt 1then move third node by 2 inches (bias)
bias = 2 ''LN = Round(nN1.GetDistanceFrom(nN2), 3) X0 = xN1 - bias * (xN2 - xN1) / LN Y0 = yN1 - bias * (yN2 - yN1) / LNs.Curve.Nodes(3).SetPosition X0, Y0
Delete node 2s.Curve.Nodes(2).Delete Somehow
Thanks. What do I set nN1 and nN2 to? and xN1 and xN2 to?
xN1 it's X coordinate for node 1 yN1 it's Y coordinate for node 1 N2 - node 2 in accordance
LN here is segment length = diistance betwen nodes 1 and 2
I tried this, but I'm doing something wrong:
Sub lengthenline()Dim s As CurveSet s = ActiveShape.Curves.Segments.First.AddNodeAt 1Dim nN1 As NodeDim nN2 As Node
Set nN1 = s.Nodes(1)Set nN2 = s.Nodes(2)bias = 2xN1 = s.Nodes(1).PositionXyN1 = s.Nodes(1).PositionYxN2 = s.Nodes(2).PositionXyN2 = s.Nodes(2).PositionY
Ln = Round(nN1.GetDistanceFrom(nN2), 3)X0 = xN1 - bias * (xN2 - xN1) / LnY0 = yN1 - bias * (yN2 - yN1) / Lns.Nodes(3).SetPosition X0, Y0
'Delete node 2s.Nodes(2).Delete
End Sub