Hi all
I'm able to create CMYK colors by the following code
Color colorName = application.CreateCMYKColor(0, 93, 95, 0);
But I need to create a spot color with a specific name to use as an cutline for our cutter. The color is not important, but I need to give it a specific name "cut"I see the application.CreateSpotColor method, but I cant figure out how to use it.
Any suggestions?
Thanks
I ended up with creating the palette in CorelDRAW first and then using the "CreateSpotColorByName" method to get the color.
Color cutColor = application.CreateSpotColorByName("cutsliss", "cut");
cutsliss is the palettename and cut is the colorname
But using this approach the palette and color must already be defined on the machine, I would prefer to be able to define it in the program.
May I know why do you need such a spot color? Usually spot colors are provided by third-party manufacturers in order to be a base for specific company-approved colors. For cutting the color doesn't matter too much. Is it just for having a name? Does the cutting machine recognize color name? And it must have that 'cut' name?
Is that a real need or a challenge to see how is it programmatically possible?
Never-mind...
I played a little with palettes and I observed that corel exposes only some of them to VGCore. I mean to be created or customized by code: Document Palette, Default Palette and the ones created by user.
I created a pallete (in VBA), added a color, but I couldn't find a way to name that color directly (in VBA code). I used the next code (True to rewrite the existing XML file if this exists):
1 2 3 4 5 6 7
Sub testPalleteCol() Dim colorName As Color, myPall As Palette Set colorName = Application.CreateCMYKColor(0, 93, 95, 0) Set myPall = Application.Palettes.Create("cutsliss", , True) myPall.AddColor colorName Debug.Print myPall.FileName End Sub
To transpose it in VB.NET or C# it is easy... You can see myPall.FileName returns the XML file Path. In my case it is "C:\Users\myUser\Documents\My Palettes\cutsliss.xml". Corel creates a guid for it. I could open it and add a name tag. So now it looks like that (It is easy to do that programmatically):
<?xml version="1.0"?> <palette guid="cd456924-16f6-4e96-8cb5-63e604bc386c" name="cutsliss"> <colors> <page> <color cs="CMYK" name="cut" tints="0,0.93,0.95,0"/> </page> </colors> </palette>
After restarting Corel the color name has been displyed... And it can be used like that:
1 2 3
Dim c As New Color c.CopyAssign Application.Palettes("cutsliss").Colors(1) ActiveShape.Outline.Color = c
Is it what you need? Is it important to be a something from the spot palette? If yes, we can dig deeper and find Corel Palette xml files and add there an element...
Thank you, I'll try this and see.The requirement says that it has to be a spot color, and the RIP will detect the name of the spot color and generate a cutfile for the cutter based on the lines with that specific color.