OberonPlace.com Forums  

Go Back   OberonPlace.com Forums > Developer Forums > VBA > Code Critique

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 11-10-2007, 18:22
m31uk3
Guest
 
Posts: n/a
Default Plot Graphics With Rolan CX-300 Cutter

Hello

I have a script that formats my graphics on the page for cutting on my Roland cutter. It works great most of the time with the occasional CorelDraw crash. I am guessing I am not managing memory correctly or something similar because other wise Corel would not be crashing.

More troubling is the fact that sometimes when I submit the job to the cutter it gets corrupted by Corel and the cutter goes crazy. The number of jobs this happens to seems to increase after Corel crashes and the longer it runs.

Please any help would be greatly appreciated.

Code:
Sub CutnClean()
    'Unlock and Ungroup all objects
    ActivePage.Shapes.All.Unlock
    ActivePage.Shapes.All.UngroupAll
    'Repeat for sub-nested objects
    ActivePage.Shapes.All.Unlock
    ActivePage.Shapes.All.UngroupAll
    'Find Null Shapes and Delete
    Dim shC As Color, sCount As Long
    sCount = ActivePage.Shapes.count
    If sCount <= 2 Then
        Set shC = CreateCMYKColor(0, 0, 0, 100)
    ElseIf ActivePage.Shapes.Item(2).Fill.Type <> cdrNoFill Then
        Set shC = ActivePage.Shapes.Item(2).Fill.UniformColor
    End If
    'Convert text to curves
    ActivePage.Shapes.All.ConvertToCurves
    'Group to prevent overlap
    ActivePage.Shapes.All.Group
    'Mirror for cutting
    ActivePage.Shapes.All.Flip cdrFlipHorizontal
    'Copy fill color to outline, set width to hairline, remove fill
    ActivePage.Shapes.All.SetOutlineProperties width:=0.003, Color:=shC
    ActivePage.Shapes.All.ApplyNoFill
    'Clear group and selection
    ActivePage.Shapes.All.UngroupAll
    ActiveDocument.ClearSelection
End Sub
Thanks,

-Lucas

Last edited by m31uk3; 12-10-2007 at 07:51.
Reply With Quote
  #2  
Old 12-10-2007, 01:46
shelbym's Avatar
shelbym shelbym is offline
Senior Member
 
Join Date: Nov 2002
Location: Cheyenne, WY
Posts: 1,769
Blog Entries: 9
Send a message via ICQ to shelbym Send a message via AIM to shelbym Send a message via MSN to shelbym Send a message via Yahoo to shelbym
Default My Version

Maybe it will give you some ideas.
Code:
Sub CleanNCut()
    Dim sr As ShapeRange
    Dim cColor As Color
    
    ActivePage.UnlockAllShapes
    
    Set sr = ActivePage.Shapes.All.UngroupAllEx
    Set cColor = CreateCMYKColor(0, 0, 0, 100)
    
    sr.ConvertToCurves
    sr.Flip cdrFlipHorizontal
    sr.SetOutlineProperties Width:=0.003, Color:=cColor
    sr.ApplyNoFill
    ActiveDocument.ClearSelection
End Sub
Happy coding,

-Shelby
Reply With Quote
Reply


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


All times are GMT -5. The time now is 03:55.


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