OberonPlace.com Forums > VBA Howcan get a node's offset of the subpah to which nod belong
 Blogs Gallery FAQ Members List Social Groups Calendar Search Today's Posts Mark Forums Read

#1
17-10-2004, 01:06
 lees Guest Posts: n/a
Howcan get a node's offset of the subpah to which nod belong

the Node.SubPath property returns the subpath to which the node belongs.

so how can get the offset of the subpath to which the node belongs?

I have a very foolish way: creat a subpath SubP (0,0) to (node.persitonX,node.persitonY) and then Set cps = node.subpath.GetIntersections(SubP)
and use the cps(1).offset to get the offset of the node !

it's so foolish .do you have an easy way to do so?

thx!
#2
17-10-2004, 11:16
 Alex Administrator Join Date: Nov 2002 Posts: 1,940 Blog Entries: 4
Re: Howcan get a node's offset of the subpah to which nod be

What you need to do is to count the length of all segments from the beginning of subpath.

You can use the following function to determine the length of the curve from the beginning of the subpath to the specified node:

Code:
```Function GetNodeOffset(ByVal n As Node) As Double
Dim seg As Segment
Dim dLen As Double

dLen = 0
' If the node is not the first node in the subpath
If n.Index &lt;> 1 Then
Set seg = n.Segment
Do
dLen = dLen + seg.length
If seg.Index = 1 Then Exit Do
Set seg = seg.Previous
Loop
End If

GetNodeOffset = dLen
End Function```
Here is how you can use this function:

Code:
```Sub Test()
MsgBox GetNodeOffset(ActiveShape.Curve.Nodes(8))
End Sub```
#3
17-10-2004, 22:39
 lees Guest Posts: n/a

Thank you vary much. I think about it for a long time! and you can do it in a so soon !

 Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is Off Forum Rules
 Forum Jump User Control Panel Private Messages Subscriptions Who's Online Search Forums Forums Home OberonPlace Discussion     Site News     Web site suggestions     Image Gallery     Testing Oberon Products     CurveWorks     SecuriDesign     Calendar Wizard     Oberon Function Plotter     Jigsaw Puzzle Creator     Other Oberon Commercial Products     New product ideas Corel User Forums     CorelDRAW         General         Tutorials         FAQ         Feature requests/wishlist         Macros/Add-ons         Artwork Showcase     Corel DESIGNER         General         Tutorials         FAQ         Feature requests/wishlist         Macros/Add-ons         Artwork Showcase     Corel PHOTO-PAINT         General         Tutorials         FAQ         Feature requests/wishlist         Macros/Add-ons         Artwork Showcase     General         About Corel         Off-Topic Developer Forums     OberonPlace Development Portal     VBA         CorelDRAW/Corel DESIGNER VBA         Corel Photo-Paint VBA         Code Critique     Corel Script         CorelDRAW CS         Corel Photo-Paint CS