Object Model Reference : Classes : N : Node : Methods : Node.SetPosition |
Sub SetPosition(PositionX As Double, PositionY As Double)
Member of Node
The SetPosition method moves a node to the specified x- and y-coordinates.
• |
The GetPosition method returns the x- and y-coordinates of a node.
|
Parameter
|
Description
|
PositionX
|
Specifies, in document units, the x-coordinate of the node
|
PositionY
|
Specifies, in document units, the y-coordinate of the node
|
The following VBA example distorts the selected curve. The amount of distortion depends on the distance between the node and the center of the shape. The node is moved only radially.
Sub Test() |
Dim s As Shape |
Dim n As Node |
Dim xc As Double, yc As Double |
Dim r As Double |
Dim dx As Double, dy As Double |
Const Amplitude As Double = 0.2 |
Set s = ActiveShape |
If s.Type = cdrCurveShape Then |
ActiveDocument.ReferencePoint = cdrCenter |
s.GetPosition xc, yc |
For Each n In s.Curve.Nodes |
dx = n.PositionX - xc |
dy = n.PositionY - yc |
r = Exp((Rnd() - 0.5) * Amplitude) |
n.SetPosition xc + dx * r, yc + dy * r |
Next n |
End If |
End Sub |
Copyright 2013 Corel Corporation. All rights reserved.