Should be very easy, but I lack node manipulation knowledge and couldn't find the magic code words.
This might get you started:
Sub add_node_halfway_selected_segment() Dim nodeThis As Node Dim noderangeSelected As New NodeRange For Each nodeThis In ActiveShape.Curve.Nodes.All If nodeThis.Selected Then noderangeSelected.Add nodeThis End If Next nodeThis If noderangeSelected.Count = 1 Then If noderangeSelected(1).Index > 1 Or noderangeSelected(1).SubPath.Closed Then noderangeSelected(1).segment.AddNodeAt 0.5, cdrRelativeSegmentOffset Else MsgBox "Selected Node cannot be the first Node of an open SubPath" End If Else MsgBox "Exactly one Node must be selected." End If End Sub
That doesn't get into the niceties of checking that a document is active, checking that the selection is a single Curve shape, error handling, etc.,
Note that the node you need to select is the "end node" of the segment to which you wish to add the new node.
I have to add here that there is a built-in way to do this (or something similar to this) in CorelDRAW, without a macro.
For some Curves, using the two different methods produces wildly different results.
Eskimo to the rescue - mo :D
As for the built-in way noted in your other reply, that is good to know because that is often mostly all I need to do. But with the code provided, I can now think of ways to expand upon it to be used either before or after other parts of a larger process. So thanks!
The silly thing is, once upon a time... I knew about this. I guess like 6 years ago, when I was first learning DRAW and thus exploring every single bar and button. With enough time, I forgot.
I meant to put an image in my other post but I'll put it here. It is the reason (THIS particular time) why I wanted an exact center. There have been many others. For this one, its because the "M" in the Gotham font does not come to a fine point. For most people, this means nothing. For laser cutting, I am frequently adjusting nodes for efficiency, performance, etc. and even just for the sake of some kind of symmetry OCD. I had already done it manually after posting initially, by drawing a line through the shapes midpoint and thus having something to snap a new node to. But now I have better way, a bit of code to play with, and a preferable solution for next time. Anyway, it was this:
Are you familiar with Dynamic Guides? It provides some very CAD-like capabilities.
For that sort of job, you could drag one of the nodes to the point where those two segments, if extended, would intersect.