OberonPlace.com Forums

OberonPlace.com Forums (http://forum.oberonplace.com/index.php)
-   Macros/Add-ons (http://forum.oberonplace.com/forumdisplay.php?f=21)
-   -   .AddToPowerclip (http://forum.oberonplace.com/showthread.php?t=24688)

HeauxmBru 22-07-2014 21:31

.AddToPowerclip
 
Hey out there. :confused:

.AddToPowerclip is generating an "out of stack" error, then crashing Corel X6. Is this a bug or am I doing this wrong?

I've tried a couple ways, but the result is the same. Everything works except powerclip.

Code:

Set s2 = s1.Duplicate
   
s2.AddToPowerClip s1, cdrTrue
s1.PowerClip.EnterEditMode
   
With s2
      .ConvertToCurves
      .Fill.UniformColor.CMYKAssign 0, 0, 0, 10
End With
   
Set s2 = s2.ConvertToBitmapEx(cdrCMYKColorImage, , True, 300)
   
s2.Bitmap.ApplyBitmapEffect "AddNoise", "AddNoiseEffect NoiseType=Gaussian, Level=50," _
                                        & "Density = 50, ColorMode=Intensity"
s2.Bitmap.ApplyBitmapEffect "MotionBlur", "MotionBlurEffect Distance=15, Direction=0"
   
's2.AddToPowerClip s1, cdrTrue
   
's1.CreateSelection
s1.PowerClip.LeaveEditMode

:icon_frow

shark 30-07-2014 13:15

May be you need all operations - converttocurves, filling, converting to bitmap and bitmapeffects - make before adding to powerclip?

HeauxmBru 05-10-2015 08:32

I simplified it down and still am having problems with .powerclip.
I want to take a selected shape and make a duplicate, do some stuff to it, then powerclip into the original shape.

.duplicate and .powerclip must not be compatible as I get an over stack error and then crash

So I turned to .getBoundingBox (for lack of anything better) but I now get a "powerclip operation failed" error

The funny thing is that I can create two shapes and powerclip one into the other.

Here is my code:
Code:

   
Set s1 = d.Selection

s1.GetBoundingBox x, y, w, h                  THIS DOES NOT WORK
Set s2 = lr.CreateRectangle2(x, y, w, h)
       
'    Set s1 = lr.CreateRectangle2(2, 2, 2, 2)    THIS WORKS
'    Set s2 = lr.CreateRectangle2(3, 3, 3, 3)

'    Set s2 = s1.Duplicate                          THIS CRASHES X6
       
s1.AddToPowerClip s2

I would like to know why it doesn't work or what I am overlooking.
Can anyone help?

shark 05-10-2015 09:42

it looks like you are fighting for a year on this issue.

Try change Set s1 = d.Selection to Set s1 = ActiveShape. d.selection returns shape with a cdrSelectionShape type.

HeauxmBru 02-02-2016 08:26

Quote:

Originally Posted by shark (Post 37839)
it looks like you are fighting for a year on this issue.

Try change Set s1 = d.Selection to Set s1 = ActiveShape. d.selection returns shape with a cdrSelectionShape type.

Thanks shark!

That did the trick! I would not have thought of ActiveShape

I was trying to make a kind of brushed aluminum fill. Now the code works perfectly.

Code:

  Set s1 = ActiveShape
    s1.GetBoundingBox x, y, w, h
    Set s2 = lr.CreateRectangle2(x, y, w, h)

    s2.Fill.UniformColor.CMYKAssign 0, 0, 0, 10

    Set s2 = s2.ConvertToBitmapEx(cdrCMYKColorImage, , True, 300)

    With s2
        .Bitmap.ApplyBitmapEffect "AddNoise", "AddNoiseEffect NoiseType=Gaussian, Level=50, Density = 50, ColorMode=Intensity"
        .Bitmap.ApplyBitmapEffect "MotionBlur", "MotionBlurEffect Distance=15, Direction=0"
    End With
       
    s2.AddToPowerClip s1

The only other change I had to make was last line of the code by placing s2 in the correct place. I had it backwards.
This was wrong:

Code:

s1.AddToPowerClip s2
Thanks again.


All times are GMT -5. The time now is 08:00.

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