OberonPlace.com Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 26-11-2009, 16:21
macrofan
Guest
 
Posts: n/a
Default Close Path Macro

Hi Folks,

I would like to close all open paths in my multi page/single page document without selecting them individually. Can a macro automate this task by using corel's Arrange>Close Path>Closest nodes with straight lines option?

Thanks for reading and answering

Last edited by macrofan; 26-11-2009 at 16:32.
Reply With Quote
  #2  
Old 26-11-2009, 17:17
runflacruiser's Avatar
runflacruiser runflacruiser is offline
Senior Member
 
Join Date: Jun 2009
Location: Pigeon Forge, TN USA
Posts: 811
Default

you mean like this?

Code:
Sub closeThePaths()

    Dim s As Shape
    Dim sr As ShapeRange
    Set sr = ActiveLayer.Shapes.All
    
    For Each s In sr
    s.Curve.Closed = True
    Next s

End Sub
Reply With Quote
  #3  
Old 26-11-2009, 17:40
runflacruiser's Avatar
runflacruiser runflacruiser is offline
Senior Member
 
Join Date: Jun 2009
Location: Pigeon Forge, TN USA
Posts: 811
Default

oh..multiple pages, forgot.

Will this work?

Code:
Sub closeThePaths()

    Dim p As Page
    Dim s As Shape
    Dim sr As ShapeRange
    
    For Each p In ActiveDocument.Pages
        p.Activate
        Set sr = ActivePage.Shapes.All
        For Each s In sr
            s.Curve.Closed = True
        Next s
    Next p
End Sub
John
Reply With Quote
  #4  
Old 01-12-2009, 03:38
macrofan
Guest
 
Posts: n/a
Default

Hi John,
Your macro is working partially. I have a very special scenario where the open paths are disguised in the combined paths (because I mostly import my text as curves from MS word through .prn) Unless I break every curve apart the macro doesn't function you know it's so tedious to break every curve apart then run the macro. So can you suggest a code that can examine the open curves inside the combined paths? Once again thanks for the earlier ones that you have posted. See the attached .cdr file for more info.
Attached Files
File Type: cdr BREAK APART.cdr (14.2 KB, 296 views)
Reply With Quote
  #5  
Old 01-12-2009, 11:13
runflacruiser's Avatar
runflacruiser runflacruiser is offline
Senior Member
 
Join Date: Jun 2009
Location: Pigeon Forge, TN USA
Posts: 811
Default

looks like the spam fairy attacked last night...

Maybe this'll work:

Code:
Sub closeThePaths()

    Dim p As Page
    Dim s As Shape
    Dim sr As ShapeRange
    
    For Each p In ActiveDocument.Pages
        p.Activate
        Set sr = ActivePage.Shapes.All.BreakApartEx
         For Each s In sr
            If s.Type <> cdrTextShape Then
                s.UngroupAll
            End If
        Next s
        Set sr = ActivePage.Shapes.All
        For Each s In sr
             If s.Type <> cdrTextShape Then
            s.BreakApart
            End If
        Next s
        Set sr = ActivePage.Shapes.All
        For Each s In sr
            If s.Type <> cdrTextShape Then
            s.Curve.Closed = True
            End If
        Next s
    Next p
End Sub
Reply With Quote
  #6  
Old 01-12-2009, 16:44
macrofan
Guest
 
Posts: n/a
Default We are almost there!

Hi john,
I really thank you for taking personal interest in my problem and sorry for giving you constant trouble. We are almost there towards achieving our desired goal the only thing left is after closing all open curves, can it be possible to combine the objects in the same state that they were broken apart from? I hope I am clear when I say that in the same state from where they were broken apart from, Let me explain, suppose I have letter O and letter A, I want them to be combined in their original states. see the attached file.
Attached Files
File Type: cdr PATHS.cdr (15.4 KB, 300 views)
Reply With Quote
  #7  
Old 01-12-2009, 17:51
runflacruiser's Avatar
runflacruiser runflacruiser is offline
Senior Member
 
Join Date: Jun 2009
Location: Pigeon Forge, TN USA
Posts: 811
Default

Hi,
Not sure if I'm following exactly.

You can add ActiveSelection.Combine on it's own line right after s.BreakApart

Hope this helps.
-John
Reply With Quote
  #8  
Old 03-12-2009, 14:35
macrofan
Guest
 
Posts: n/a
Default

Quote:
Originally Posted by runflacruiser View Post
Hi,
Not sure if I'm following exactly.
Hi John,
I think you are following it all right It's me who has made it complicated. Ok let's remove the confusing things.
I first said, it should apply on all pages without having to select any thing. But then I realized I don't need that, and I am sorry for that. Now the macro should close the paths inside a group of various curves selected (No text involved at all in all of this process, as I import text as curves).
Your macro does exactly what I want but forgets to combine the shapes that it breaks apart. I am attaching a small sample of what I have to deal with, for you to experiment with, I would love if you can add one more feature of auto convert the Grayscale black to CMYK black, and if you notice it has No outline but with the RGB mode, if you can convert that no outline to CMYK as well that would be great too. Once again thanks for taking interest in my problem. By the way your suggestion of adding a new line after the breakapart line didn't work.
Reply With Quote
  #9  
Old 03-12-2009, 14:40
macrofan
Guest
 
Posts: n/a
Default

Attachment didn't show up in previous message
Attached Files
File Type: cdr Close Paths.cdr (152.0 KB, 307 views)
Reply With Quote
  #10  
Old 03-12-2009, 14:42
runflacruiser's Avatar
runflacruiser runflacruiser is offline
Senior Member
 
Join Date: Jun 2009
Location: Pigeon Forge, TN USA
Posts: 811
Default

I'll check it out.
I had a brain fart too...on that last post. lol

-John
Reply With Quote
Reply

Tags
close path


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
Best way to Close a form RobC CorelDRAW/Corel DESIGNER VBA 2 19-09-2009 01:30
Text to path macro... patcho519 Macros/Add-ons 0 16-01-2008 10:57
cannot close combined shape jemmyell CorelDRAW/Corel DESIGNER VBA 5 27-07-2005 14:25
How to use close path in a VB routine? jconnor CorelDRAW/Corel DESIGNER VBA 1 02-04-2005 03:15


All times are GMT -5. The time now is 19:12.


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