• I want to thank all the members that have upgraded your accounts. I truly appreciate your support of the site monetarily. Supporting the site keeps this site up and running as a lot of work daily goes on behind the scenes. Click to Support Signs101 ...

Simple macro to create bounding box? CDX4

meltsner

New Member
I've been doing the old fashioned way to create a bounding box (for plotting), and I always thought it would be great to have a simple (even temporary) macro to simplify this. I have a bunch of uniquely shaped graphics on a file, that I would like to add, say 1/2" etc. larger bounding/surrounding box.

I have (for YEARS!) been doing the "Shift+{double click} Rectangle" to add a box, then manually entering the size a bit larger as appropriate. Even a simple macro to do the size part would be great, but would be even nicer to select the shape, then run the macro for the rest. But I cannot even think of a way to give a shape a simple "add 1/2 to the size" function. Does anybody have a simple solution that has been eluding me? TIA!
 

CPRsigns

New Member
I've been doing the old fashioned way to create a bounding box (for plotting), and I always thought it would be great to have a simple (even temporary) macro to simplify this. I have a bunch of uniquely shaped graphics on a file, that I would like to add, say 1/2" etc. larger bounding/surrounding box.

I have (for YEARS!) been doing the "Shift+{double click} Rectangle" to add a box, then manually entering the size a bit larger as appropriate. Even a simple macro to do the size part would be great, but would be even nicer to select the shape, then run the macro for the rest. But I cannot even think of a way to give a shape a simple "add 1/2 to the size" function. Does anybody have a simple solution that has been eluding me? TIA!


I am not sure what program you are using but Flexi has a setting in Production Manager to add a weed border
 
Hey, I'm not sure what software you use but you can try this if you like it seems to work in Corel Draw.

Sub CreateBoundingBox()
Dim rc As Double
Dim NewWidth As Double
Dim NewHeight As Double
Dim OrigSelection As ShapeRange 'will allow for multiple groupings
'
Set OrigSelection = ActiveSelectionRange 'remember the currently selected shape
'
rc = CDbl(InputBox("Increase Bounding box by what percentage?", "Select % for bounding box", ""))
'
If rc > 0 Then
NewHeight = ((OrigSelection(1).SizeHeight / 100) * rc) + OrigSelection(1).SizeHeight
NewWidth = ((OrigSelection(1).SizeWidth / 100) * rc) + OrigSelection(1).SizeWidth

'copy the selected shape
OrigSelection(1).Copy
'
'paste to the active layer
ActiveLayer.Paste
'
Dim BoundingBox As ShapeRange
Set BoundingBox = ActiveSelectionRange
BoundingBox(1).SetSize NewWidth, NewHeight

'align the centers
BoundingBox(1).AlignToShape cdrAlignHCenter, OrigSelection(1), cdrTextAlignBoundingBox
BoundingBox(1).AlignToShape cdrAlignVCenter, OrigSelection(1), cdrTextAlignBoundingBox
Else
MsgBox "Size must be greater than 0%", vbInformation, "Invalid size entered"
End If
End Sub
 

myront

CorelDRAW is best
Sub BoundingBoxEach()
Dim s As Shape, sr As ShapeRange, x#, y#, w#, h#
Optimization = True
ActiveDocument.Unit = cdrInch
ActiveDocument.BeginCommandGroup "BoundingBoxEach"
Set sr = ActiveSelectionRange
For Each s In sr
s.GetBoundingBox x, y, w, h
s.Layer.CreateRectangle2 x - 0.5, y - 0.5, w + 1, h + 1
Next s
Optimization = False
ActiveWindow.Refresh
ActiveDocument.EndCommandGroup
End Sub
 

eahicks

Magna Cum Laude - School of Hard Knocks
I am not sure what program you are using but Flexi has a setting in Production Manager to add a weed border
Yes, just tell your RIP to add the weed border. If not that, how hard is it to just draw a box? Your sign layout should have a border around it anyway. Or maybe I'm totally missing what you are asking.
 

myront

CorelDRAW is best
All my cuts, including weed lines etc. are always set up within the CorelDRAW file. All our cuts are made from corel using the FineCut plug-in. Only use Flexi for the Production Manager to manage prints.
 

meltsner

New Member
Wow, thank you guys. That type of code is greek to me but with a little trial and error I could probably figure it out...eventually. myront file works beautifully!!! I edited it for .5" margin instead of 1" (I figured out that much :)) Kris LNP , on mine, yours worked, but created a larger duplicate of the selected shape, rather than a box....

Sorry, I had CDX4 in the title (and under the Corel forum) for using Corel Draw X4, but perhaps I should have been more descriptive :) I do use Flexi and it works GREAT for contour cuts/surround box, but that is about the only reason I like or use it -- only for print/cut jobs (cut only jobs I use Corel only), and at that, I usually design in Corel first and export to Flexi to set up for print/cutlines.
Thanks again, awesomeness!!! Now to just assign a shortcut key to it.....

Sub BoundingBoxEach()
Dim s As Shape, sr As ShapeRange, x#, y#, w#, h#
Optimization = True
ActiveDocument.Unit = cdrInch
ActiveDocument.BeginCommandGroup "BoundingBoxEach"
Set sr = ActiveSelectionRange
For Each s In sr
s.GetBoundingBox x, y, w, h
s.Layer.CreateRectangle2 x - 0.5, y - 0.5, w + 1, h + 1
Next s
Optimization = False
ActiveWindow.Refresh
ActiveDocument.EndCommandGroup
End Sub

Yes, just tell your RIP to add the weed border. If not that, how hard is it to just draw a box? Your sign layout should have a border around it anyway. Or maybe I'm totally missing what you are asking.
No it's not that hard, but when you have a bunch of uniquely sized objects, it takes extra time.......when you can have a macro that can do all of it in one keypress! (I should add, I know {Cutting Master in my case} has a "weed border" option, but I combine multiple "shapes" or sign layouts to maximize my material, so I need a box around each one that Cutting Master can't do)
 

eahicks

Magna Cum Laude - School of Hard Knocks
Wow, thank you guys. That type of code is greek to me but with a little trial and error I could probably figure it out...eventually. myront file works beautifully!!! I edited it for .5" margin instead of 1" (I figured out that much :)) Kris LNP , on mine, yours worked, but created a larger duplicate of the selected shape, rather than a box....

Sorry, I had CDX4 in the title (and under the Corel forum) for using Corel Draw X4, but perhaps I should have been more descriptive :) I do use Flexi and it works GREAT for contour cuts/surround box, but that is about the only reason I like or use it -- only for print/cut jobs (cut only jobs I use Corel only), and at that, I usually design in Corel first and export to Flexi to set up for print/cutlines.
Thanks again, awesomeness!!! Now to just assign a shortcut key to it.....




No it's not that hard, but when you have a bunch of uniquely sized objects, it takes extra time.......when you can have a macro that can do all of it in one keypress! (I should add, I know {Cutting Master in my case} has a "weed border" option, but I combine multiple "shapes" or sign layouts to maximize my material, so I need a box around each one that Cutting Master can't do)
Well Flexi Prod. Mgr. has that feature, called Easy Weed (one click on the checkbox!) not sure about Cutting Master.
 

meltsner

New Member
Well Flexi Prod. Mgr. has that feature, called Easy Weed (one click on the checkbox!) not sure about Cutting Master.
I'm wondering if that's a newer feature........ I'm still running 10.5.1 and I haven't seen that option but I may be missing something ( though I've been using it for several years...). I have Weed Border but I think that's about it. Cutting Master has that, plus horizontal and vertical weed lines (where it's able to on the design). I do like Flexi's rectangle (surround) contour cut option, it makes it pretty snappy to add.
 

meltsner

New Member
Hmmmm.....well I guess I am going to have to hunt that down tomorrow, I have never remembered seeing it before.
 

Big Rice Field

Electrical/Architectural Sign Designer
I am not sure what program you are using but Flexi has a setting in Production Manager to add a weed border
Since this is the Corel Forum I would assume that he wants to do this task with Corel or a custom Corel Draw plug-in. Not all sign designers use Flexisign.
 
Top