OberonPlace.com Forums  

Go Back   OberonPlace.com Forums > Developer Forums > VBA > CorelDRAW/Corel DESIGNER VBA

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 23-10-2008, 14:36
Egu2008
Guest
 
Posts: n/a
Default CorelDraw 12 VBA : AddToPowerClip

Hello,

Here is a sample.
A map and a circle, and a macro named "test".

My goal is to export a little part (rectangle) of the picture(including text, curve and bitmap) as a jpeg file.
In order to do that, I used the AddToPowerClip method.

It seems OK, but if you look really, you see that all objects in the page move in such way that the clip rectangle is set at the center !!!
This is not what I want, because the visible area is not the one I looking for !!
So the exported image is wrong.

Could you help me ?
Thanks a lot.
Best regard.
Emmanuel
Attached Files
File Type: cdr AddToPowerClip.cdr (132.9 KB, 16 views)
Reply With Quote
  #2  
Old 23-10-2008, 16:44
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 Try this...

First in CorelDRAW X4 you can stop the auto centering inside the powerclip. As for 12 my suggestion would be to group the shapes get their position, then move them. Code would look like this:
Code:
Sub Test()
    Dim s1 As Shape, sGroup As Shape
    Dim sr As New ShapeRange
    Dim x As Double, y As Double
    
    ActiveDocument.Unit = cdrCentimeter
    
    'Creation du cadre
    Set s1 = ActiveLayer.CreateRectangle(15, 15, 16, 16)
    s1.Fill.ApplyNoFill
    s1.Outline.SetProperties 0.003, OutlineStyles(0), CreateCMYKColor(0, 0, 0, 100), ArrowHeads(0), ArrowHeads(0), False, False, cdrOutlineButtLineCaps, cdrOutlineMiterLineJoin, 0#, 100
    s1.Name = "Cadre"
    
    'Création de l'enveloppe
    sr.Add ActivePage.Shapes("XXX") 'ajoute l'objet
    sr.Add ActivePage.Shapes("YYY") 'ajoute l'objet
    Set sGroup = sr.Group

    sGroup.GetPosition x, y

    sGroup.AddToPowerClip s1 'fixe le contour
    sGroup.SetPosition x, y

    MsgBox ("It's OK !!")

    'Retour en arrière : extract et suppression du cadre
    ActivePage.Shapes("Cadre").PowerClip.ExtractShapes
    sGroup.Ungroup
    s1.Delete
End Sub
Best of luck,

-Shelby
Reply With Quote
  #3  
Old 24-10-2008, 03:04
Egu2008
Guest
 
Posts: n/a
Default

This works fine !!!
Thanks a lot.

I can keep my CorelDraw 12 version !!!!

Best regards.

Emmanuel
Reply With Quote
  #4  
Old 25-10-2012, 15:49
juran juran is offline
Member
 
Join Date: Oct 2012
Posts: 35
Default auto power clipping

Please help !

Sir, I have 2 queries...

1. How to add auto powerclip to all the images in all pages at a time?

The code given below does the auto powerclip job for shape 1 - 1 page only.

'Recorded macro

Private Sub CommandButton1_Click()

Dim OrigSelection As ShapeRange
Set OrigSelection = ActiveSelectionRange
OrigSelection.AddToPowerClip ActiveLayer.Shapes(1), cdrTrue

End Sub

---------------------------------------------------

2. How to align the (shape) image to center excluding other (shapes) images?

This code given below brings all items to center, I need only a particular selected image (shape) to align center.


Private Sub centerall_Click()
Dim OrigSelection As ShapeRange

Set OrigSelection = ActiveSelectionRange
Dim i&

For i = 1 To ActiveDocument.Pages.Count
Set OrigSelection = ActiveDocument.Pages(i).shapes.All
OrigSelection.AlignToPageCenter cdrAlignLeft + cdrAlignRight + cdrAlignTop + cdrAlignBottom, cdrTextAlignBoundingBox
Next i

End Sub

Kindly Sir..

Last edited by juran; 27-10-2012 at 11:49.
Reply With Quote
  #5  
Old 29-10-2012, 06:33
juran juran is offline
Member
 
Join Date: Oct 2012
Posts: 35
Default Please help!

Eagerly waiting for the solution. Kindly guide me !
Reply With Quote
  #6  
Old 29-10-2012, 10:36
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 PowerClip

Could you please make a simple before and after .cdr file. This would help me clearly understand what you are wanting the macro to do.

Thank you,

-Shelby
Reply With Quote
  #7  
Old 30-10-2012, 08:40
juran juran is offline
Member
 
Join Date: Oct 2012
Posts: 35
Default

Sir, I'm Unable to upload my cdr since file size exceeds the forum's limit.

Request No.1

This code aligns everything to center, i want to define only 1 shape to align center, other shapes should remain same.

Private Sub centerall_Click()
Dim OrigSelection As ShapeRange

Set OrigSelection = ActiveSelectionRange
Dim i&

For i = 1 To ActiveDocument.Pages.Count
Set OrigSelection = ActiveDocument.Pages(i).shapes.All
OrigSelection.AlignToPageCenter cdrAlignLeft + cdrAlignRight + cdrAlignTop + cdrAlignBottom, cdrTextAlignBoundingBox
Next i

End Sub

--------------------------------------------------------

Request No. 2

This code creates frame for an image only for an active selection (page 1)
I want this to happen in all pages at a time.



Dim s1 As Shape
Set s1 = ActiveLayer.Shapes(2).CustomCommand("Boundary", "CreateBoundary")
s1.Outline.SetProperties 0.02778


Sorry to trouble u often ...
Reply With Quote
  #8  
Old 05-11-2012, 23:39
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 Vba

Request 1:

What makes the shape unique so that we can find it, the align it?

Request 2:

You can only have one active selection. So you can't select across pages, so how are you selecting the shapes on the other pages to create the boundary?

-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

Similar Threads
Thread Thread Starter Forum Replies Last Post
How about VBA macros for NEW CorelDRAW GS X4 14.0 ??? DMS Other Oberon Commercial Products 6 21-05-2008 23:15
Where to begin with CorelDRAW and VBA shelbym CorelDRAW/Corel DESIGNER VBA 2 03-04-2007 09:15
CorelDRAW X3 VBA Documentation keytecstaff CorelDRAW/Corel DESIGNER VBA 1 21-09-2006 10:31
VBA for CorelDRAW 12 ajacques CorelDRAW/Corel DESIGNER VBA 1 04-02-2005 10:14
CorelDraw 11 VBA DOM? sdickson CorelDRAW/Corel DESIGNER VBA 2 03-12-2002 15:05


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


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