delete a shape that too small for laser cut

Hello,

im new at using macro in corel, i just take code from this forum, and tried to customized thing with trial and error, i cant write script to be honest (hehe)

im working at laser cutting. after finising the design i need to clean-up the design, like remove the small shape that too small for laser cutting, like image below

for now, i have to break apart the object, then manually deleting the small shapes.

is it possible to do it with macro?

im thinking a code that

- break apart the shape,

- selecting shape that too short with parameter "length of curve" < 3 cm

- then delete that selection

- and put everything back

thanks

Parents
No Data
Reply
  • Yep, you can do this with a macro. I have kepts this very simple since you are just learning. It basically does your exact steps, breaks apart the selection, deletes the small shapes, then combines everthing back to a single shape. 

    Sub DeleteSmallShapes()
        Dim srSelection As ShapeRange, s As Shape
        
        'Break apart the active selection
        Set srSelection = ActiveSelectionRange.BreakApartEx
        
        'Delete all shapes that are smaller than 1.5cm
        srSelection.Shapes.FindShapes(Query:="@width < {1.5cm} and @height < {1.5cm}").Delete
        
        'Combine back to a single shape
        Set s = srSelection.Combine
        'Select the combined shape
        s.CreateSelection
    End Sub
    

    Happy coding, 

    -Shelby

Children