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 17-10-2005, 07:48
RichT
Guest
 
Posts: n/a
Default Relative position with group

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
Reply With Quote
  #2  
Old 17-10-2005, 08:49
jemmyell jemmyell is offline
Senior Member
 
Join Date: Jan 2005
Location: Orange County, California, USA, Earth, Solar System, Milky Way Galaxy
Posts: 157
Default See this thread

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
__________________
-James Leonard
CNC Inlay Guy - www.CorelDRAWCadCam.com
Reply With Quote
  #3  
Old 17-10-2005, 09:13
RichT
Guest
 
Posts: n/a
Default

Thanks James, Thats excellent!

Rich
Reply With Quote
  #4  
Old 18-10-2005, 06:53
RichT
Guest
 
Posts: n/a
Default

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
Reply With Quote
  #5  
Old 18-10-2005, 10:08
petig
Guest
 
Posts: n/a
Default

Which code did you try?
Reply With Quote
  #6  
Old 18-10-2005, 13:15
RichT
Guest
 
Posts: n/a
Default

I used the second piece of code posted at the link above.

Rich
Reply With Quote
  #7  
Old 18-10-2005, 13:20
Alex's Avatar
Alex Alex is offline
Administrator
 
Join Date: Nov 2002
Posts: 1,940
Blog Entries: 4
Default

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...
Reply With Quote
  #8  
Old 18-10-2005, 15:59
RichT
Guest
 
Posts: n/a
Default

Thanks Alex, I understand, and that is the conclusion I was just reaching

Your example is exactly what I need.

Thanks again

Rich
Reply With Quote
  #9  
Old 18-10-2005, 20:01
petig
Guest
 
Posts: n/a
Default

Hm. I didn't know this codes...

(On the above link there is a FixDistance.zip, did you try that, RichT?)
Reply With Quote
  #10  
Old 19-10-2005, 02:57
RichT
Guest
 
Posts: n/a
Default

Petig

I couldn't find the file you mentioned Only moveobjects.txt and moveobjects2.txt

Rich
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 10 DXF export relative coordinates - VBA solution? asb617 CorelDRAW/Corel DESIGNER VBA 2 01-04-2010 03:34
Position inch to mm GoodLook CorelDRAW/Corel DESIGNER VBA 2 11-11-2008 01:47
Create a Group shelbym CorelDRAW/Corel DESIGNER VBA 1 18-03-2004 20:12
Need help accessing objects in a group ama CorelDRAW/Corel DESIGNER VBA 5 20-02-2004 12:28
Getting the mouse position Rick Randall CorelDRAW/Corel DESIGNER VBA 1 04-12-2002 10:29


All times are GMT -5. The time now is 15:12.


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