OberonPlace.com Forums

OberonPlace.com Forums (http://forum.oberonplace.com/index.php)
-   CorelDRAW/Corel DESIGNER VBA (http://forum.oberonplace.com/forumdisplay.php?f=16)
-   -   Adding nodes to a line segment via VBA (http://forum.oberonplace.com/showthread.php?t=24742)

ddonnahoe 06-10-2015 13:28

Adding nodes to a line segment via VBA
 
In Draw X7, if I create a line segment that only has 2 nodes, then select all the nodes with the node editing tool and hit the plus key on the numerical keypad, I get additional nodes, evenly spaced, every time i hit the plus key.

How can I achieve this via VBA?

Code:

Set chevron = ActiveLayer.CreateLineSegment(x, y, (w + 0.5), y)

shark 07-10-2015 02:07

Try it
 
Here simple code to add nodes to each segments
Code:

Private Sub AddNodes()
Dim s As Shape, nseg&
    Set s = ActiveShape: If s Is Nothing Then Exit Sub
    For nseg = s.Curve.Segments.Count To 1 Step -1
        s.Curve.Segments(nseg).AddNodeAt  'without parameters adds node to midpoint
    Next
End Sub

Or you can do it by one codeline:
s.Curve.Segments.All.AddNode


All times are GMT -5. The time now is 02:22.

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