OberonPlace.com Forums

OberonPlace.com Forums (http://forum.oberonplace.com/index.php)
-   General (http://forum.oberonplace.com/forumdisplay.php?f=26)
-   -   CreateBlend (http://forum.oberonplace.com/showthread.php?t=8107)

prongs 07-03-2012 22:04

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

shelbym 07-03-2012 22:22

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

-Shelby

prongs 07-03-2012 22:28

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

shelbym 07-03-2012 22:34

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

prongs 07-03-2012 23:00

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

prongs 08-03-2012 07:46

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

byteme67 24-04-2012 13:06

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.


All times are GMT -5. The time now is 14:09.

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