Hi,
I create shape, paint it a color pantone Purple (for example). I apply to it Extrude effect and make a extrude color -- solid Reflex Blue.Then I want to get all extrude color:
If shTmp.Effects(i).Type = cdrExtrude ThenMsgBox shTmp.Effects.ExtrudeEffect.Extrude.BaseColor.Name & " " & shTmp.Effects.ExtrudeEffect.Extrude.BevelColor.Name & " " & shTmp.Effects.ExtrudeEffect.Extrude.ShadingColor.Nameendif
All colors are pantone Purple.
if I change a fill color to Control Rectangle (for example pantone Yellow), then Msgbox code shows me correct information: Yellow ReflexBlue Purple
How I can get correct colors dont change color to Control Rectangle?
My main task is finding some color to everywhere. I have CorelDraw X6.
This is another great place to use CQL.
Using the following code, select your shape with the Extrude Effect. The code will find the extrude group and group it to the shape, this way we can use a little CQL to get all the colors.
The CQL loops through all the shapes and finds the colors. We then filter the list to unique colors and sperate them with a comma.
The code then ungroups the group we created and selects the original shape again. We then display a message box with the list of unique colors.
One note, the list will be every color that CQL finds, so that included the outline color of your shape.
Sub CQLExtrudeColors() Dim s As Shape, sGroup As Shape Dim srToGroup As New ShapeRange Dim strColors As String Set s = ActiveShape srToGroup.Add s srToGroup.Add s.Effects.ExtrudeEffect.Extrude.ExtrudeGroup Set sGroup = srToGroup.Group strColors = sGroup.Evaluate("@children.foreach(array(), $lasteval.addarray($item.colors)).unique.convert($item.name).join(', ')") sGroup.Ungroup s.CreateSelection MsgBox strColors End Sub
Happy coding,
-Shelby
I solved this problem to search of all shapes in ExtrudeGroup:
Dim n As Long, shTMP As Shape
For n = 1 To shTMP.Effects(i).Extrude.ExtrudeGroup.Shapes.Count
If shTMP.Effects(i).Extrude.ExtrudeGroup.Shapes(n).fill.Type = cdrFountainFill Then
Set sColor = sh.Effects(i).Extrude.ExtrudeGroup.Shapes(n).fill.Fountain.StartColor Set eColor = sh.Effects(i).Extrude.ExtrudeGroup.Shapes(n).fill.Fountain.EndColor
' make some actions
else
set sColor =shTMP.Effects(i).Extrude.ExtrudeGroup.Shapes(n).fill.UniformColor
endif
next n