OberonPlace.com Forums  

Go Back   OberonPlace.com Forums > Corel User Forums > CorelDRAW > General

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 07-03-2012, 22:04
prongs
Guest
 
Posts: n/a
Default CreateBlend

While creating blend using the CreateBlend command, it always fails the 21st time. It is wierd. When I try to use the command in a loop of 21 objects it fails. When I try to use on 21 different objects one after another seperately it fails again.

This is the code that I used.
Set shp1 = ActiveLayer.CreateEllipse(12,12,12+size, 12-size)
shp1.Copy
Set shp2 = ActiveLayer.Paste
With shp1.CreateBlend(shp2)
.Blend.Mode = cdrBlendSpacing
.Blend.Spacing = spacing
.Blend.LinkAcceleration = True
.Blend.FullPath = True
.Blend.Path = OrigSelection(i)
.Blend.MapNodes = True
actualsteps = .Blend.Steps
End With
Clipboard.Clear

Could somebody please help me with what the problem is?
Thanks in advance

prongs
Reply With Quote
  #2  
Old 07-03-2012, 22:22
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 21 Time Fail

Just curious, what is your undo level set to? Tools | Customization | Workspace | General, my guess is 20 :-)

-Shelby
Reply With Quote
  #3  
Old 07-03-2012, 22:28
prongs
Guest
 
Posts: n/a
Default

The undo level is set to 20.
But INCREDIBLE!! after I increased the undo level to a higher level it worked perfectly.
Amazing!!!! Thank you
Could you please let me know how they are related?
Thanks a lot
Reply With Quote
  #4  
Old 07-03-2012, 22:34
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 Undo Level

It means that something in your Macro is corrupting the Undo stack, so by increasing the level you never hit it, however you if you increase to say 50, it will fail at 51, so this is not the best answer.

The better answer it to solve why the macro is doing so, is this the entire macro, or only a part? What version including build number of CorelDRAW are you running? Help | About CorelDRAW, will be something like: 15.2.0.695

Thanks,

-Shelby
Reply With Quote
  #5  
Old 07-03-2012, 23:00
prongs
Guest
 
Posts: n/a
Default CorelVersion

The corel Draw version I'm using is 15.2.0.686 and the complete macro is

ActiveDocument.BeginCommandGroup "Create Blend"
On Error Goto ErrHandler

For Each sh In OrigSelection
'Create the two ellipses
Set shp1 = ActiveLayer.CreateEllipse(12, 12, (12 + CDbl(CmbObjSize.Value)), (12 - CDbl(CmbObjSize.Value)))
If CmbFill.Value = "Fountain Fill" And Not c_start.Type = 0 And Not c_end.Type = 0 Then
shp1.Fill.ApplyFountainFill StartColor:=c_start, EndColor:=c_end
ElseIf CmbFill.Value = "Uniform Fill" And Not c_start.Type = 0 Then
shp1.Fill.ApplyUniformFill c_start
End If
shp1.Copy
Set shp2 = ActiveLayer.Paste

If txtBlendNum.Value = "" Then
With shp1.CreateBlend(shp2)
.Blend.Mode = cdrBlendSpacing
.Blend.Spacing = CDbl(CmbObjSpace.Value) + CDbl(CmbObjSize.Value)
.Blend.FullPath = True
.Blend.Path = sh
actualsteps = .Blend.Steps
.Clear
End With
Else
actualsteps = CInt(txtBlendNum.Value) - 2
End If

With shp1.CreateBlend(shp2).Blend
.Mode = cdrBlendSteps
.Steps = actualsteps
.FullPath = True
.Path = sh
End With
Clipboard.Clear
Next

txtBlendNum.Value = ""
ActiveDocument.EndCommandGroup
Exit Sub

Errhandler:
MsgBox "ERROR:" & Err.Description, vbCritical
ActiveDocument.EndCommandGroup

I create a blend with the given spacing and since there is overlapping, I get the number of steps and rearrange the same blend again with a slightly modified spacing.
DO let me know what the problem could be
Thanks a lot

Last edited by prongs; 08-03-2012 at 08:10.
Reply With Quote
  #6  
Old 08-03-2012, 07:46
prongs
Guest
 
Posts: n/a
Default BeginCommandGroup

In the above code, when I removed the BeginCommandGroup/EndCommandGroup, it worked great at all values for Undo Level

Last edited by prongs; 08-03-2012 at 08:08.
Reply With Quote
  #7  
Old 24-04-2012, 13:06
byteme67's Avatar
byteme67 byteme67 is offline
Junior Member
 
Join Date: Apr 2010
Location: Fort Misery
Posts: 25
Default

I found this in the Macros Help

Quote:
The BeginCommandGroup and EndCommandGroup commands must be used with extreme caution. If an error occurs after BeginCommandGroup but before EndCommandGroup, and the macro is terminated, the undo stack of CorelDRAW for the current document becomes corrupt. You must ensure that EndCommandGroup is always issued after BeginCommandGroup. Proper error-trapping is strongly recommended.
Don't know if that helps you out either but found it interesting.
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 13:50.


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