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 02-05-2006, 05:23
soydan
Guest
 
Posts: n/a
Default help me please....needed HPGL export macros color selection..

I'm user coreldraw x3...needed macro for selection color automatic HPGL (PLT) files export ..thanks...
Reply With Quote
  #2  
Old 04-05-2006, 11:58
shelbym's Avatar
shelbym shelbym is offline
Senior Member
 
Join Date: Nov 2002
Location: Cheyenne, WY
Posts: 1,777
Blog Entries: 10
Send a message via ICQ to shelbym Send a message via AIM to shelbym Send a message via MSN to shelbym Send a message via Yahoo to shelbym
Default Details

Can you give a few more details of what you are trying to do. You only want to export one color?

Shelby
Reply With Quote
  #3  
Old 27-12-2006, 15:56
soydan
Guest
 
Posts: n/a
Question

sample :

Object 1 ==> Black (outline color)

Object 2 ==> Red (outline color)

Object 3 ==> Green (outline color)

Needed macro or script... for HPGL (PLT) export

example :

Object 1 ==> automatic export macro ==> Black.plt

Object 2 ==> automatic export macro ==> Red.plt

Object 3 ==> automatic export macro ==> Green.plt



Sample Macro

1 - Search Active.Document
2 - Find all Black outline color and export Black.plt
3 - Find all Red outline color and export Red.plt
4 - Find all Green outline color and export Green.plt
5 - Finish

help me please...thanks...
Attached Images
 

Last edited by soydan; 27-12-2006 at 16:28.
Reply With Quote
  #4  
Old 27-12-2006, 16:55
shelbym's Avatar
shelbym shelbym is offline
Senior Member
 
Join Date: Nov 2002
Location: Cheyenne, WY
Posts: 1,777
Blog Entries: 10
Send a message via ICQ to shelbym Send a message via AIM to shelbym Send a message via MSN to shelbym Send a message via Yahoo to shelbym
Default Macro

And you always just have the three colors to deal with??

Shelby
Reply With Quote
  #5  
Old 27-12-2006, 17:00
soydan
Guest
 
Posts: n/a
Default

yes..my design for laser cutting machine...always three colors...sometimes four colors (blue)..
Reply With Quote
  #6  
Old 27-12-2006, 17:07
shelbym's Avatar
shelbym shelbym is offline
Senior Member
 
Join Date: Nov 2002
Location: Cheyenne, WY
Posts: 1,777
Blog Entries: 10
Send a message via ICQ to shelbym Send a message via AIM to shelbym Send a message via MSN to shelbym Send a message via Yahoo to shelbym
Default Cool

OK, easy enough....will work something out for you tonight.

Shelby
Reply With Quote
  #7  
Old 27-12-2006, 17:24
soydan
Guest
 
Posts: n/a
Smile

yes..thanks...
Reply With Quote
  #8  
Old 28-12-2006, 00:25
shelbym's Avatar
shelbym shelbym is offline
Senior Member
 
Join Date: Nov 2002
Location: Cheyenne, WY
Posts: 1,777
Blog Entries: 10
Send a message via ICQ to shelbym Send a message via AIM to shelbym Send a message via MSN to shelbym Send a message via Yahoo to shelbym
Default Code

OK here is my first pass at this. Basically it loops through all the shapes and assigns each color to a shaperange, then exports each shaperange. If no shapes are assigned to the range nothing is exported. I did include blue as you stated you sometimes use it. Hope you find it helpful.

Shelby
Code:
Option Explicit

'Define ShapeRanges to Export by Outline Color
Public srBlack As New ShapeRange
Public srRed As New ShapeRange
Public srGreen As New ShapeRange
Public srBlue As New ShapeRange

Sub ExportbyOutlineColor()

Dim ex As ExportFilter

'Find the Outline Color and Assign to a ShapeRange
FindSameColorOutline ActivePage.Shapes

'Export all Black shapes to Black.plt
If srBlack.Shapes.Count > 0 Then
    srBlack.CreateSelection
    ActiveDocument.Export "C:\Temp\Black.plt", cdrPLT, cdrSelection
End If

'Export all Red shapes to Red.plt
If srRed.Shapes.Count > 0 Then
    srRed.CreateSelection
    ActiveDocument.Export "C:\Temp\Red.plt", cdrPLT, cdrSelection
End If

'Export all Green shapes to Green.plt
If srGreen.Shapes.Count > 0 Then
    srGreen.CreateSelection
    ActiveDocument.Export "C:\Temp\Green.plt", cdrPLT, cdrSelection
End If

'Export all Blue shapes to Blue.plt
If srBlue.Shapes.Count > 0 Then
    srBlue.CreateSelection
    ActiveDocument.Export "C:\Temp\Blue.plt", cdrPLT, cdrSelection
End If

End Sub

Private Sub FindSameColorOutline(ss As Shapes)

Dim s As Shape

For Each s In ss
    If s.Type = cdrGroupShape Then
        FindSameColorOutline s.Shapes
    Else
        Select Case s.Outline.Color.Name(True)
            Case "C:0 M:0 Y:0 K:100"
                'Black
                srBlack.add s
            Case "C:0 M:100 Y:100 K:0"
                'Red
                srRed.add s
            Case "C:100 M:0 Y:100 K:0"
                'Green
                srGreen.add s
            Case "C:100 M:100 Y:0 K:0"
                'Blue
                srBlue.add s
        End Select
    End If
Next s
End Sub
Reply With Quote
  #9  
Old 28-12-2006, 03:09
soydan
Guest
 
Posts: n/a
Thumbs up :yippee:

Thank you very much SHELBYM !!! code is working...tested...ok...wonderful..


I want... Sample GMS Module...

(Fake GMS... My Dream Design...)
Attached Images
 

Last edited by soydan; 28-12-2006 at 04:56.
Reply With Quote
  #10  
Old 31-12-2006, 00:56
shelbym's Avatar
shelbym shelbym is offline
Senior Member
 
Join Date: Nov 2002
Location: Cheyenne, WY
Posts: 1,777
Blog Entries: 10
Send a message via ICQ to shelbym Send a message via AIM to shelbym Send a message via MSN to shelbym Send a message via Yahoo to shelbym
Default PLT Export by Outline Color Macro

It so happened that I had some time today while waiting for year end processes to finish at work. So here is what I was able to come up with.

First I have only tested this on CorelDRAW X3, but there is nothing fancy in it, so I assume it will run on previous versions just fine.

Features Include: (First version is: .065)

1. Export up to five colors, You may change them if you wish.
2. Gets save path from active document, you can change if you wish.
3. Launches Windows Explorer to exported Path
4. Several Color Models Supported
5. File is Exported as myfilesname-color.plt (example: testing-black.plt)

The default settings are seen in the first screen shot, but I know everyone may not use the same colors so it is 100% customizable, just click on the color you want to change and you will get a color dialog to select your new color. These changes will then be returned to the form. I show this in the third screen shot. The second screen shot shows the completed screen.

If you have a suggestion for improvements let me know, never know when I might have time to whip something up. Good luck and I hope it saves you a little bit of time.

Shelby
Attached Images
   
Attached Files
File Type: gms PLTExport.gms (62.0 KB, 482 views)
Reply With Quote
Reply


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
Corel, Options, Customization, Commands, macros, "Separ Rick Randall CorelDRAW/Corel DESIGNER VBA 5 14-05-2009 12:20
HPGL export problem Anonymous General 1 16-02-2006 10:15


All times are GMT -5. The time now is 15:31.


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