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 03-02-2010, 19:34
dragonpaw
Guest
 
Posts: n/a
Default Add object to an existing group WITHOUT destroying it?

I'm stumped.

I can fold spindle and mutilate shapes, but what I can't find is what seems like it should be very obvious: How to add a shape to a group I already have, that doesn't involve unmaking the group.

(Corel Draw X4 BTW.)

In the UI, this is as simple as dragging the shape into the group in the Object Manager. But if I record that and look at the recorded macro, it's calling UnGroupEx, adding the object to the selection and re-Group'ing it. But this obliterates the name and any Object Data on the shape! (I use a lot of properties in Object Data to automate this, as is a map I'm making.)

Any ideas?
Reply With Quote
  #2  
Old 03-02-2010, 20:28
runflacruiser's Avatar
runflacruiser runflacruiser is offline
Senior Member
 
Join Date: Jun 2009
Location: Pigeon Forge, TN USA
Posts: 811
Default

Very interesting.
I haven't thought about that.

Will this help?

Run. Click shapes you want added to group. Hit escape and shapes that you clicked on will be added to group.

Code:
Sub addToGroup()

Dim x As Double, y As Double
Dim Shift As Long
Dim click As Boolean
Dim s As Shape
Dim sr As New ShapeRange
click = False

While Not click
    click = ActiveDocument.GetUserClick(x, y, Shift, 10, False, cdrCursorSmallcrosshair)
    Set s = ActivePage.SelectShapesAtPoint(x, y, False)
    If Not click Then
       sr.Add s
    End If
Wend
sr.Group
End Sub
Hope it helps.
-John
Reply With Quote
  #3  
Old 03-02-2010, 21:07
shelbym's Avatar
shelbym shelbym is offline
Senior Member
 
Join Date: Nov 2002
Location: Cheyenne, WY
Posts: 1,770
Blog Entries: 10
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 Place Inside Group

All you need to do is move the shape in front of one of the shapes already in the group. So say I have a group with three shapes and the one in the middle has a static ID of 5, I could do this:
Code:
Sub PlaceInsideGroup()
    Dim sObj As Shape
    
    Set sObj = ActiveShape
    Set sObjInGroup = ActivePage.FindShape(StaticID:=5)
    
    sObj.OrderFrontOf sObjInGroup
End Sub
Best of luck,

-Shelby
Reply With Quote
  #4  
Old 05-11-2012, 01:59
juran juran is offline
Member
 
Join Date: Oct 2012
Posts: 35
Default move shapes

Sir,
The code given below moves all shapes together in all pages ...
How to select a particular shape and make it move in all pages without disturbing other shapes ??



Private Sub Move_Images_Click()
'This procedure selects all shapes on all pages including the Master page.
'It allows you to move them a specified distance.
'It will ask if you wanted the shapes on the Mastepage moved.
'If you did not then it moves the Master page shapes back.
'This is easier than to select all shapes less the Master page shapes.

'If you write a procedure to select all shapes on all pages.
'Do not attempt to move the shapes using the mouse.
'If you do, all the shapes, on all pages, will move to the active page.

Dim ALL_SHAPES As ShapeRange


Dim intPAGE_No As Integer
Dim IntNo_Pages As Integer
Dim strINPUTBOX_VALUE As String
Dim sngX_POSITION As Single
Dim sngY_POSITION As Single

'Select All Shapes on All Pages.
IntNo_Pages = ActiveDocument.Pages.Count
Set ALL_SHAPES = ActiveDocument.Pages(1).shapes.All


intPAGE_No = 2
While intPAGE_No <= IntNo_Pages

ALL_SHAPES.AddRange ActiveDocument.Pages(intPAGE_No).shapes.All

intPAGE_No = intPAGE_No + 1
Wend

'Enter the horiziontal displacement.
'If there is no input value then do not move across.
strINPUTBOX_VALUE = InputBox("How many millimeters to the right?" & vbCr & "Negatives are OK.", _
"Horizontal Displacement of All Objects!")
If strINPUTBOX_VALUE = "" Then
sngX_POSITION = 0
Else
'Convert string to single.
sngX_POSITION = CSng(strINPUTBOX_VALUE)
End If

'Enter the vertical displacement.
strINPUTBOX_VALUE = InputBox("How many millimeters up?" & vbCr & "Negatives are OK.", _
"Vertical Displacement of All Objects!")
'If there is no input value then do not move up.
If strINPUTBOX_VALUE = "" Then
sngY_POSITION = 0
Else
'Convert string to single.
sngY_POSITION = CSng(strINPUTBOX_VALUE)
End If

'Measuremments are in inches so convert to millimeters and move all the objects.


ALL_SHAPES.Move sngX_POSITION / 25.4, sngY_POSITION / 25.4

Set ALL_SHAPES = Nothing


'Ask if the Master Shapes were to be moved. If not move them back.
If MsgBox("Move Master Shapes as well?", vbYesNo, "") = vbNo Then
'Now select all the Master Shapes and return them to thir original position.
Set ALL_SHAPES = ActiveDocument.MasterPage.shapes.All
'Measuremments are in inches so convert to millimeters and move all the objects.
ALL_SHAPES.Move -1 * sngX_POSITION / 25.4, -1 * sngY_POSITION / 25.4

Set ALL_SHAPES = Nothing
End If

End Sub
Reply With Quote
  #5  
Old 05-11-2012, 12:13
juran juran is offline
Member
 
Join Date: Oct 2012
Posts: 35
Default Shapes declaration

Desperately seeking for help
Can any one guide me in the above move_all_shapes queries ??? .

I feel like drained out trying this
Reply With Quote
  #6  
Old 05-11-2012, 23:34
shelbym's Avatar
shelbym shelbym is offline
Senior Member
 
Join Date: Nov 2002
Location: Cheyenne, WY
Posts: 1,770
Blog Entries: 10
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 Shape

You need a way to identify the single shape. Is it the only rectangle? The only line of text? Is the shape uniquely named? Once you can identify it, then you can move it.

-Shelby
Reply With Quote
  #7  
Old 06-11-2012, 02:13
juran juran is offline
Member
 
Join Date: Oct 2012
Posts: 35
Default same shapes in all pages

Sir, The page has multiple shapes and text works, out of that I just want to select and move only 1 image (shape1). Rest of the shapes, text etc., should not move.

Same thing should repeat simultaneously in all pages of the active document. (same image in all pages)

I tried it many times, for me either only the first page (active selection) is doing it right, otherwise the entire shapes are moving together in all pages... But I don't want this to happen.

If u want me to explain more ? I can. Kindly guide me

Last edited by juran; 06-11-2012 at 02:17.
Reply With Quote
  #8  
Old 07-11-2012, 10:53
juran juran is offline
Member
 
Join Date: Oct 2012
Posts: 35
Default Shapes

Are my questions regarding shapes not understandable ???
Desperately seeking for solutions.
Reply With Quote
  #9  
Old 07-11-2012, 11:10
runflacruiser's Avatar
runflacruiser runflacruiser is offline
Senior Member
 
Join Date: Jun 2009
Location: Pigeon Forge, TN USA
Posts: 811
Default

Hi.
You have to answer Shelby's question. We need to find a characteristic that sets that shape apart so we can find it and move it on each page.

The characteristic can be as simple as it having a certain position that is the same throughout document, or a unique size that is also the same on all pages. The are many characteristics that could be used. The code for this is very simple but you have to answer the question.

~John
Reply With Quote
  #10  
Old 07-11-2012, 12:12
juran juran is offline
Member
 
Join Date: Oct 2012
Posts: 35
Default shapes

First of all thank u all for your kind response

ok.. now i understood..

The shape which i would like to move in all pages is an image file (jpeg) which is placed in the center position.. (But there is another jpeg also in same page)

By order, It is in front of all images, this can be a unique characteristic, i believe. I'm I correct ?!
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
Extract object from the group dear CorelDRAW/Corel DESIGNER VBA 9 05-02-2009 11:03
Find Group ungroup it then process and again group derasje Macros/Add-ons 2 19-11-2008 04:04
Colour swatches from existing document? Gadget CorelDRAW/Corel DESIGNER VBA 2 21-02-2008 03:19
Bug with existing selection m31uk3 Code Critique 1 02-01-2008 18:18
Suggestion - palette from existing drawing Webster CorelDRAW/Corel DESIGNER VBA 3 22-10-2004 03:18


All times are GMT -5. The time now is 06:20.


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