Previous Document Next Document
Node.SetPosition

Sub SetPosition(PositionX As Double, PositionY As Double)

Member of Node

The SetPosition method moves a node to the specified horizontal and y-coordinates.

The GetPosition method returns the horizontal and y-coordinates of a node.

Parameters
Description
PositionX
Specifies the x-, or horizontal, coordinate of a node. The x-coordinate is measured in document units.
PositionY
Specifies the y-, or vertical, coordinate of a node. The y-coordinate is measured in document units.

The following code 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 

Previous Document Next Document Back to Top

Copyright 2007 Corel Corporation. All rights reserved.