OberonPlace.com Forums  

Go Back   OberonPlace.com Forums > Corel User Forums > CorelDRAW > Macros/Add-ons

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 22-07-2014, 21:31
HeauxmBru HeauxmBru is offline
Junior Member
 
Join Date: Jan 2011
Posts: 17
Default .AddToPowerclip

Hey out there.

.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
Reply With Quote
  #2  
Old 30-07-2014, 13:15
shark shark is offline
Senior Member
 
Join Date: Aug 2010
Location: Russia, Belgorod
Posts: 145
Default

May be you need all operations - converttocurves, filling, converting to bitmap and bitmapeffects - make before adding to powerclip?
Reply With Quote
  #3  
Old 05-10-2015, 08:32
HeauxmBru HeauxmBru is offline
Junior Member
 
Join Date: Jan 2011
Posts: 17
Default

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?
Reply With Quote
  #4  
Old 05-10-2015, 09:42
shark shark is offline
Senior Member
 
Join Date: Aug 2010
Location: Russia, Belgorod
Posts: 145
Default

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.
Reply With Quote
  #5  
Old 02-02-2016, 08:26
HeauxmBru HeauxmBru is offline
Junior Member
 
Join Date: Jan 2011
Posts: 17
Default

Quote:
Originally Posted by shark View Post
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.
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
CorelDraw 12 VBA : AddToPowerClip Egu2008 CorelDRAW/Corel DESIGNER VBA 7 05-11-2012 23:39


All times are GMT -5. The time now is 23:38.


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