![]() |
#1
|
|||
|
|||
![]()
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 |
#2
|
||||
|
||||
![]()
HI.
You could use an array for the nodes. 0=>3 1=>5 2=>2 -John |
#3
|
|||
|
|||
![]()
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? |
#4
|
||||
|
||||
![]()
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 |
#5
|
|||
|
|||
![]()
Hello such.
How it works, and that makes this macro? Sorry but I have not understood. Greetings |
#6
|
||||
|
||||
![]()
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 |
#7
|
|||
|
|||
![]()
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. ![]() |
#8
|
||||
|
||||
![]()
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:
|
#9
|
|||
|
|||
![]()
Hi
I solved the task using Document_SelectionChange to capture selection of nodes. |
#10
|
||||
|
||||
![]() Quote:
![]() -John |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
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 |