![]() |
#1
|
|||
|
|||
![]()
Hi
I'm trying to write a simple macro to move a move a bunch of objects individually a certain amount relative to each other. eg. I have some objects that are spaced 1mm apart vertically. I want them to be spaced 0.5mm instead. Normally it's a pain to move each object as they all move together. Anyway, I got to this point : **************************************************** Dim s As Shape Dim MoveX, MoveY As Double MoveX = Form.XMoveTextBox.Text / 25.4 MoveY = Form.YMoveTextBox.Text / 25.4 For Each s In ActiveSelection.Shapes s.Move MoveX, MoveY If Form.IndividualCheckbox.Value = True Then MoveX = MoveX + (Form.XMoveTextBox.Text / 25.4) MoveY = MoveY + (Form.YMoveTextBox.Text / 25.4) End If Next s **************************************************** which almost works , except that the movements are pretty random within that group. It does not start at the top most object and work down, so the end up out of order. How do I get the top most object, process that, then move down until finished, so preserving the order? Thanks for your time, Rich |
#2
|
|||
|
|||
![]()
Hi Rich,
There was some very good code done by some group members that is very close to what you want I think. http://forum.oberonplace.com/showthread.php?t=1128 -James |
#3
|
|||
|
|||
![]()
Thanks James, Thats excellent!
Rich |
#4
|
|||
|
|||
![]()
James/all
Hhhm. Not quite what I had in mind, It scatters them across the page at fixed distances still in random order. I need to keep the order the same and just change the vertical distance between them. The above code is easy to change for just the vertical distance, but couldn't see how to set it up so that it keeps the relative order the same. (Its generally for numbered bullet points so the order is important) Any more ideas to point me in the right direction anyone? Thanks Rich |
#5
|
|||
|
|||
![]()
Which code did you try?
|
#6
|
|||
|
|||
![]()
I used the second piece of code posted at the link above.
Rich |
#7
|
||||
|
||||
![]()
Well, objects in a group may not go in the same order as they appear on the page. For example, first object in the group could be somewhere in the middle of the page, second could be on the top and third on the bottom. So if you just loop through them and offset each individually you will create a mess.
What you need to do is to go through each object on the page, get its size/position (that is, bounding box), then sort the bounding box position horizontally and/or vertically to find which object in the group is located at the top of the page, which one is below it and so on. After you do this, you can then just offset objects in the order they are on the page, and not in the group. There is an old script I created that did that. You can find it here: http://www.oberonplace.com/draw/drawscripts/repossh.htm You can look at it and convert it into VBA macro I guess... |
#8
|
|||
|
|||
![]()
Thanks Alex, I understand, and that is the conclusion I was just reaching
![]() Your example is exactly what I need. Thanks again Rich |
#9
|
|||
|
|||
![]()
Hm. I didn't know this codes...
(On the above link there is a FixDistance.zip, did you try that, RichT?) |
#10
|
|||
|
|||
![]()
Petig
I couldn't find the file you mentioned Only moveobjects.txt and moveobjects2.txt Rich |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
CorelDraw 10 DXF export relative coordinates - VBA solution? | asb617 | CorelDRAW/Corel DESIGNER VBA | 2 | 01-04-2010 02:34 |
Position inch to mm | GoodLook | CorelDRAW/Corel DESIGNER VBA | 2 | 11-11-2008 00:47 |
Create a Group | shelbym | CorelDRAW/Corel DESIGNER VBA | 1 | 18-03-2004 19:12 |
Need help accessing objects in a group | ama | CorelDRAW/Corel DESIGNER VBA | 5 | 20-02-2004 11:28 |
Getting the mouse position | Rick Randall | CorelDRAW/Corel DESIGNER VBA | 1 | 04-12-2002 09:29 |