Previous Document Next Document

Object Model Reference : Classes : S : Segment : Methods : Segment.GetPointPositionAt


Segment.GetPointPositionAt

Sub GetPointPositionAt(x As Double, y As Double, [Offset As Double = 0.5], [OffsetType As cdrSegmentOffsetType = cdrParamSegmentOffset])

Description

Member of Segment

The GetPointPositionAt method returns the coordinates of a point located on a segment.

Parameter
Description
x
Specifies the horizontal position of the point on the segment’s subpath. The x-coordinate is measured in document units.
y
Specifies the vertical position of the point on the segment’s subpath. The y-coordinate is measured in document units.
Offset
Specifies the offset, in document units, from the beginning of the segment’s subpath. This parameter is optional, and its default value is 0.5.
OffsetType
Specifies the offset type of the point on the curve’s subpath, and returns cdrSegmentOffsetType. This parameter is optional, and its default value is cdrParamSegmentOffset (2).

VBA example

Here is a code example:

Sub GetPointPositionAt_Sample()
Dim s1 As Shape
Set s1 = ActiveLayer.CreateLineSegment(1.698224, 8.796287, 3.094059, 8.22337)
s1.Outline.SetProperties 0.1
'Someone could trace a constellation
'For this example we created Ursa Major using the code below
Dim crv As Curve
Set crv = ActiveDocument.CreateCurve
With crv.CreateSubPath(1.698224, 8.796287)
.AppendLineSegment 3.094059, 8.22337
.AppendLineSegment 3.583642, 7.317118
.AppendLineSegment 4.229476, 6.317118
.AppendLineSegment 6.239894, 5.306701
.AppendLineSegment 5.364894, 4.348366
.AppendLineSegment 3.885724, 5.317118
.AppendLineSegment 4.229476, 6.317118
End With
s1.Curve.CopyAssign crv
'This portion of the sample code could be run to
'automatically create the position of each star in the constellation
Dim sStarPosition As Shape
Dim x As Double, y As Double
Dim sg As Segment
For Each sg In ActiveShape.Curve.Segments
sg.GetPointPositionAt x, y, 0.01, cdrAbsoluteSegmentOffset
Set sStarPosition = ActiveLayer.CreateEllipse2(x, y, 0.1)
sStarPosition.Fill.UniformColor.BWAssign True
Next sg
End Sub

Previous Document Next Document Back to Top

Copyright 2013 Corel Corporation. All rights reserved.