OberonPlace.com Forums  

Go Back   OberonPlace.com Forums > Developer Forums > VBA > CorelDRAW/Corel DESIGNER VBA

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 17-10-2004, 01:06
lees
Guest
 
Posts: n/a
Default 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!
Reply With Quote
  #2  
Old 17-10-2004, 11:16
Alex's Avatar
Alex Alex is offline
Administrator
 
Join Date: Nov 2002
Posts: 1,940
Blog Entries: 4
Default 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 <> 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
Reply With Quote
  #3  
Old 17-10-2004, 22:39
lees
Guest
 
Posts: n/a
Default

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


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

Advanced Search
Display Modes

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 Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Select all nodes if the subpath d-signer CorelDRAW/Corel DESIGNER VBA 2 13-05-2004 00:47


All times are GMT -5. The time now is 21:16.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
Copyright © 2011, Oberonplace.com