OberonPlace.com Forums  

Go Back   OberonPlace.com Forums > Corel User Forums > CorelDRAW > Macros/Add-ons

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 05-04-2011, 08:40
shark shark is offline
Senior Member
 
Join Date: Aug 2010
Location: Russia, Belgorod
Posts: 146
Default Order of nodes

Hi,
I have a curve with some nodes. I choose third node, then fifth, then a second. How can i get a noderange 3->5->2 ? Curve.Selection gives me a noderange 2->3->5

Corel Draw X3
Reply With Quote
  #2  
Old 05-04-2011, 09:29
runflacruiser's Avatar
runflacruiser runflacruiser is offline
Senior Member
 
Join Date: Jun 2009
Location: Pigeon Forge, TN USA
Posts: 811
Default

HI.
You could use an array for the nodes.
0=>3
1=>5
2=>2
-John
Reply With Quote
  #3  
Old 05-04-2011, 11:54
shark shark is offline
Senior Member
 
Join Date: Aug 2010
Location: Russia, Belgorod
Posts: 146
Default

thank you,
Nodes are selected at random by user. Then user run macro.
I would like to get shaperange with order of selection. Or array with such order. Is it possible?
Reply With Quote
  #4  
Old 05-04-2011, 15:22
runflacruiser's Avatar
runflacruiser runflacruiser is offline
Senior Member
 
Join Date: Jun 2009
Location: Pigeon Forge, TN USA
Posts: 811
Default

Hi.
Try this.
Run and press escape when finished. It will place any selected nodes indexes in order in an array. It also highlights selected nodes upon a successful selection.

-John

Code:
Private Sub getNodeIndexes()
        Dim bClick As Boolean
        Dim x#, y#, dTol#
        ReDim aNodes(0) As Double
        Dim lCnt&, aInd&, lShift&
        Dim n As Node, sCirc As Shape, s As Shape
        
        ActiveDocument.Unit = cdrInch
        
        If ActiveShape Is Nothing Then MsgBox "Select a single curve shape.": Exit Sub
        If ActiveSelection.Shapes.count > 1 Then MsgBox "Select only 1 shape please.": Exit Sub
        Set s = ActiveShape
        If s.Type <> cdrCurveShape Then MsgBox "Please select a curve type shape": Exit Sub
        ActiveTool = cdrToolNodeEdit
        
        dTol = 0.01
        aInd = 0
        bClick = False
        
        While Not bClick
        bClick = ActiveDocument.GetUserClick(x, y, lShift, 15, False, cdrCursorEyeDrop)
            Set n = s.Curve.FindNodeAtPoint(x, y, dTol)
            If Not n Is Nothing Then
                aNodes(aInd) = n.Index
                aInd = aInd + 1
                ReDim Preserve aNodes(aInd)
                Set sCirc = ActiveLayer.CreateEllipse2(x, y, 0.01)
                With sCirc
                .Name = "just_a_circle": .Fill.UniformColor.RGBAssign 255, 0, 0: .Outline.Width = 0
                End With
            End If
        Wend
        
        If UBound(aNodes) Then MsgBox UBound(aNodes) - 1 & " nodes are in the array"
        ActivePage.Shapes.FindShapes("just_a_circle").Delete
        s.CreateSelection
End Sub
Reply With Quote
  #5  
Old 06-04-2011, 10:19
buga buga is offline
Senior Member
 
Join Date: Jan 2011
Posts: 114
Default

Hello such.

How it works, and that makes this macro?

Sorry but I have not understood.

Greetings
Reply With Quote
  #6  
Old 06-04-2011, 14:14
runflacruiser's Avatar
runflacruiser runflacruiser is offline
Senior Member
 
Join Date: Jun 2009
Location: Pigeon Forge, TN USA
Posts: 811
Default

Hi Buga.
That is a sample code that can be built upon. The value is the array that is generated. It has the index values of the nodes in the order that they were clicked.
Use your locals window in debug mode to see this.
-John
Reply With Quote
  #7  
Old 07-04-2011, 04:12
shark shark is offline
Senior Member
 
Join Date: Aug 2010
Location: Russia, Belgorod
Posts: 146
Default

Hi
Thanx for your code, very interesting, but...

I was looking for way to find the order of selected nodes, that user has already chosen. I.e. user selected two nodes, 7-th and 5-th, after this run macro, program analyzes the order of selected nodes, 7->5, computes difference (-2) and select new node from last selected (5-2=3). Unfortunately, Shape.Curve.Selection gives (ascending) 5->7 always, even if first selected node #7, and then node #5.
Reply With Quote
  #8  
Old 10-04-2011, 20:34
shelbym's Avatar
shelbym shelbym is offline
Senior Member
 
Join Date: Nov 2002
Location: Cheyenne, WY
Posts: 1,791
Blog Entries: 13
Send a message via ICQ to shelbym Send a message via AIM to shelbym Send a message via MSN to shelbym Send a message via Yahoo to shelbym
Default Node Order

You are correct I do not know of a built in way to capture the order the nodes where selected.

The only way would be to capture the user click yourself so you could know the order. Wish there was an easier way.

-Shelby


Quote:
Originally Posted by shark View Post
Hi
Thanx for your code, very interesting, but...

I was looking for way to find the order of selected nodes, that user has already chosen. I.e. user selected two nodes, 7-th and 5-th, after this run macro, program analyzes the order of selected nodes, 7->5, computes difference (-2) and select new node from last selected (5-2=3). Unfortunately, Shape.Curve.Selection gives (ascending) 5->7 always, even if first selected node #7, and then node #5.
Reply With Quote
  #9  
Old 11-04-2011, 02:06
shark shark is offline
Senior Member
 
Join Date: Aug 2010
Location: Russia, Belgorod
Posts: 146
Default One of the ways

Hi
I solved the task using Document_SelectionChange to capture selection of nodes.
Reply With Quote
  #10  
Old 11-04-2011, 10:41
runflacruiser's Avatar
runflacruiser runflacruiser is offline
Senior Member
 
Join Date: Jun 2009
Location: Pigeon Forge, TN USA
Posts: 811
Default

Quote:
Originally Posted by shark View Post
Hi
I solved the task using Document_SelectionChange to capture selection of nodes.
Very Cool. Kicking myself, I shoulda' thoughta' that!...lol
-John
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
Thumbnailer - File Order dgearl Macros/Add-ons 1 12-05-2017 03:39
Create a cut order for from Corel. excessiveforce General 6 25-02-2006 06:23
Sort/Order by position Shaddy CorelDRAW/Corel DESIGNER VBA 6 21-08-2005 14:03
stack order 2 Michael Cervantes CorelDRAW/Corel DESIGNER VBA 3 15-06-2004 07:58
stack order Michael Cervantes CorelDRAW/Corel DESIGNER VBA 2 20-05-2004 01:32


All times are GMT -5. The time now is 17:13.


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