Dim s As Shape
ActiveLayer.Shapes.All.CreateSelectionFor Each s In ActiveSelection.Shapes.FindShapesIf s.Type = cdrMeshFillShape ThenSet s1 = s.ConvertToBitmapEx(cdrCMYKColorImage, False, True, 200, cdrNormalAntiAliasing, True, False, 95)End IfNext
This macro search all meshes and make it bitmap, but not in powerclips, so how to do this with powerclip in document?
Dim pwc As PowerClip, OM As ShapeRange, AM As Shape, s As Shape, g As ShapeActiveDocument.BeginCommandGroup'Optimization = TrueActivePage.Shapes.FindShapes(Query:="!@com.powerclip.IsNull").CreateSelection EndFor Each s In ActiveSelection.ShapesSet OM = s.PowerClip.ExtractShapesOM.UngroupAllFor Each g In ActiveSelection.ShapesSet AM = g.ConvertToBitmapEx(cdrCMYKColorImage, False, True, 200, cdrNormalAntiAliasing, True, False, 95)AM.AddToPowerClip s, cdrFalseNextNext'Optimization = FalseActiveDocument.EndCommandGroupActiveDocument.ClearSelectionActiveWindow.RefreshEnd Sub
This work almost fine, but i need to ungroup all objects
Is there has a way to save group structure?
Yes of course
1. Check type of each selected shape 2. If the shape is a group(cdrGroupShape), apply your function to each it shape Taras
Can you please show how it? Im bad with functions :(
Dim SR As ShapeRange, SM As ShapeRange, GN As New ShapeRange, s As Shape, g As Shape, b As ShapeActiveDocument.BeginCommandGroupFor Each s In ActivePage.Shapes.FindShapes(Type:=cdrGroupShape)Set SM = s.UngroupExSM.UngroupAllFor Each g In ActiveSelection.Shapes.FindShapes(Query:="!@com.powerclip.IsNull")Set SR = g.PowerClip.ExtractShapesSR.UngroupAllFor Each b In ActiveSelection.ShapesIf Not b.Transparency.Type = cdrNoTransparency ThenSet AM = b.ConvertToBitmapEx(cdrCMYKColorImage, False, True, 200, cdrNormalAntiAliasing, True, False, 95)ElseSet AM = bEnd IfGN.Add AMNextGN.AddToPowerClip g, cdrFalseNextSM.GroupNextActiveDocument.EndCommandGroupEnd Sub
I just don't know what to do next, it work only with one group, next group produce error.
if i use only "Set SM = s.UngroupEx" then it works fine BUT only when group not contain other groups. If i use "Set SM = s.UngroupEx" with "SM.UngroupAll" then script get error after first group. And i cant; make something like "Set SM = s.UngroupAll" cause this make error to :(
i found that "ActivePage.Shapes.FindShapes(Type:=cdrGroupShape)" get all groups, even groups in groups, so when i do ungroupall, all subsequence get broken. How to find only main groups?
i found a solution :)
this is probably cumbersome and there is a more elegant solution, but i make all i can.
Dim SR As ShapeRange, SM As ShapeRange, GN As New ShapeRange, s As Shape, g As Shape, b As Shape, PG As New ShapeRangeOn Error GoTo ErDnActiveDocument.BeginCommandGroupActiveLayer.Shapes.All.CreateSelectionFor Each s In ActiveSelection.ShapesIf Not s.Type = cdrGroupShape Thens.RemoveFromSelectionEnd IfNextSet PG = ActiveSelectionRangelngObjCount = ActiveSelection.Shapes.CountFor i = 1 To lngObjCountPG(i).CreateSelectionActiveSelection.UngroupAllSet SM = ActiveSelectionRangeFor Each g In ActiveSelection.Shapes.FindShapes(Query:="!@com.powerclip.IsNull")Set SR = g.PowerClip.ExtractShapesSR.UngroupAllFor Each b In ActiveSelection.ShapesIf Not b.Transparency.Type = cdrNoTransparency ThenSet AM = b.ConvertToBitmapEx(cdrCMYKColorImage, False, True, 200, cdrNormalAntiAliasing, True, False, 95)ElseSet AM = bEnd IfGN.Add AMNextGN.AddToPowerClip g, cdrFalseNextSM.GroupNextErDn:ActiveDocument.EndCommandGroupEnd Sub