OberonPlace.com Forums  

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

Thread Tools Search this Thread Display Modes
Old 09-02-2016, 14:39
nic nic is offline
Join Date: May 2009
Posts: 90
Default Joining Subpaths

I have a drawing with 1,000 open curves with just two nodes per curve (at the ends) which when viewed normally seem to form one continuous (open) line. The end node of each curve being in the same x,y position as the start of the next and with the curves in z-order following the continuous line. The curves vary in linewidth with the next curve in the chain being either the same width or 0.1mm thinner or thicker (with most being the same as the one before and after).

The following macro correctly 'Combines' the 2 node curves based upon thickness of lines but ends up producing curves made up of many 2 node subpaths.

What do I need to do to produce curves where each curve is one thickness and only one subpath?

A. http://forum.oberonplace.com/showthread.php?t=8155

This is a question I had already asked and had answered.



Set sr = ActiveLayer.Shapes.FindShapes()
For Each s In sr
s.CustomCommand "ConvertTo", "JoinCurves", 0.1
Next s
Sub JoinLines()
    Dim sh As Shape
    Dim sr As ShapeRange
    Dim srLine As New ShapeRange ' sr for final curve
    Dim w As Double ' line width

    Set sr = ActiveLayer.Shapes.FindShapes()
    Set srLine = Nothing
    'set width to check for at first
    w = sr(1).Outline.Width
    For Each s In sr

    'if line width is the one we are looking for - add to srLine
        If s.Outline.Width = w Then
            srLine.Add s
        End If

    'if NOT the same - combine the sr into a single shape, clear the sr and set thenew linewidth to look for and add the current shape to new sr
        If s.Outline.Width <> w Then
            'set the line width to the new size
            w = s.Outline.Width
            'set srLine to a single line
            'clear the SrLine
            'add the new Shape with the new line thickness to just cleared shaperange
            srLine.Add s
        End If

    Next s
            'set the final srLine to a single line

End Sub

Last edited by nic; 09-02-2016 at 15:20.
Reply With Quote

combine, outline

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
Joining SubPaths nic CorelDRAW/Corel DESIGNER VBA 2 16-04-2012 03:45
s.Curve.SubPaths(i).BreakApartAt kobe CorelDRAW/Corel DESIGNER VBA 6 30-10-2011 14:06
Subpaths, Segments, and Nodes m31uk3 CorelDRAW/Corel DESIGNER VBA 7 20-06-2008 12:28
Macro for extracting subpaths madhur General 1 23-10-2007 08:58
Joining nodes is troubling madhur General 1 21-09-2007 11:41

All times are GMT -5. The time now is 06:05.

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