OberonPlace.com Forums  

Go Back   OberonPlace.com Forums > Developer Forums > VBA > CorelDRAW/Corel DESIGNER VBA

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 06-08-2010, 15:59
nic nic is offline
Member
 
Join Date: May 2009
Posts: 90
Default Reordering for a laser cutter

I have a 500mm square page which has about 1000 circles drawn, which will be cut out by a laser cutter to give a template with 1000 (non touching) holes.

The circles were created in a random order and the laser cutter is charged on a time basis so I would like to reorder the circles so as not to waste time with the cutting head going backwards and forwards to cut the next hole.

This is the code as it stands but I get an error on running it -
unexpected error while executing method coVGshape:: OrderToBack

any help?
Code:
Sub neworder()

Dim x As Double, y As Double, Rd As Double ' x,y co ordinates and radius of area to be checked
Dim myselection As Shape ' shapes found in selected area
ActiveDocument.Unit = cdrMillimeter 'Set Corel to work in Millimeters
ActiveDocument.ReferencePoint = cdrCenter

Set myselection = Nothing

Rd = 22 ' radius of area to be selected

Optimization = True ' turn off updating the screen etc.

For y = 1 To 500 Step 10
For x = 1 To 500 Step 10

Set myselection = ActivePage.SelectShapesFromRectangle(x - Rd, y - Rd, x + Rd, y + Rd, False)
If Not myselection Is Nothing Then myselection.OrderToBack


Next x
Next y

Optimization = False ' turn on updating the screen etc.
ActiveWindow.Refresh

End Sub
Reply With Quote
  #2  
Old 06-08-2010, 16:34
runflacruiser's Avatar
runflacruiser runflacruiser is offline
Senior Member
 
Join Date: Jun 2009
Location: Pigeon Forge, TN USA
Posts: 811
Default

Hi.

SelectShapesFromRectangle return a cdrSelectionShape which can be many.
Try referring to it like this:

Code:
If Not myselection Is Nothing Then myselection.Shapes.All.OrderToBack
or

Code:
If Not myselection Is Nothing Then myselection.Shape(1).OrderToBack
-John
Reply With Quote
  #3  
Old 06-08-2010, 18:13
jemmyell jemmyell is offline
Senior Member
 
Join Date: Jan 2005
Location: Orange County, California, USA, Earth, Solar System, Milky Way Galaxy
Posts: 157
Default Try the Artwork Optimizer

Hi,

I wrote the Artwork Optimizer in collaboration with a laser guy. His test case was 6000 objects which the optimizer rearranges in less than 10 seconds.

This is a commercial tool, but affordable.

http://www.coreldrawtools.com/artwor...ard/index.html

-James Leonard
__________________
-James Leonard
CNC Inlay Guy - www.CorelDRAWCadCam.com

Last edited by jemmyell; 06-08-2010 at 18:14. Reason: spelling
Reply With Quote
  #4  
Old 07-08-2010, 05:40
nic nic is offline
Member
 
Join Date: May 2009
Posts: 90
Default No Joy

Hi John

I think Ive managed to do this using excel to sort the circles and then recreating the image from the sorted list.

That said, the results are crude - it breaks the image into 2cm slices and orders all the circles in that strip from top to bottom (no snaking up and down).

The code
If Not myselection Is Nothing Then myselection.Shape(1).OrderToBack seems to have a syntactical error but the line

If Not myselection Is Nothing Then myselection.Shapes.All.OrderToBack

seems to work but in fact nothing has changed after the macro is run although this may be due to the other parts of the macro.

I had a look at your optimizer James which looks just like what I need. I suspect I'll be buying it.

Thanks
nic
Reply With Quote
  #5  
Old 07-08-2010, 07:03
nic nic is offline
Member
 
Join Date: May 2009
Posts: 90
Default nice rearranger

Hi James

Just a note to say I tried your reordering program and liked it very much.

nic
Reply With Quote
  #6  
Old 07-08-2010, 10:50
jemmyell jemmyell is offline
Senior Member
 
Join Date: Jan 2005
Location: Orange County, California, USA, Earth, Solar System, Milky Way Galaxy
Posts: 157
Default

Hi nic,

Thanks for the compliment! I hope you get a lof of use out of it.

Do you use any commercial lasers that take DXF files directly?

-James
__________________
-James Leonard
CNC Inlay Guy - www.CorelDRAWCadCam.com
Reply With Quote
  #7  
Old 10-08-2010, 13:10
nic nic is offline
Member
 
Join Date: May 2009
Posts: 90
Default laser

Hi James

Yes your program really is very good. I wish I had more use for it tho! I did however recommend it to the laser cutting shop.

This is the first time Ive sent artwork for laser cutting so I cant comment yet.

Best wishes
nick
Reply With Quote
Reply

Tags
order laser cutting


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
CAD/CAM cutter tool paths in Corel Draw cncrouter New product ideas 11 13-07-2010 17:48
Laser cutting puzzles tacarey Jigsaw Puzzle Creator 5 25-11-2009 15:56
Plot Graphics With Rolan CX-300 Cutter m31uk3 Code Critique 1 12-10-2007 00:46
laser printer, glossy stock, registration problem in draw joan General 5 29-05-2006 22:13
Corel to DXF - curves too jagged for laser cut out letters knight74 New product ideas 2 19-02-2004 08:49


All times are GMT -5. The time now is 15:33.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2023, Jelsoft Enterprises Ltd.
Copyright © 2011, Oberonplace.com