![]() |
#1
|
||||
|
||||
![]()
Hello All,
This one I wouldnt know where to begin: Need a series of objects on maps that point to a reference point. Doing this manually is time consuming as there are bunches of maps and each one is different. Some maps are to zoomed into. We are working in Coreldraw X4 Selected objects (Blue Box Arrows) must rotate to the reference point (Red Star), the pink dash lines are just for the path view, not to be included see pic below: Thanks! ![]() |
#2
|
|||
|
|||
![]()
One way of doing this might be to set the point from which you wish to measure the rotation as the origin and then work out the tangents from there
This is a bit of code that works in X6 it might do as a base for you to work with Code:
Sub RotEach() Dim s As Shape Dim x As Double Dim y As Double Dim ro As Double ActiveDocument.Unit = cdrMillimeter ActiveDocument.DrawingOriginX = 0 ' x and y = 0 - seems to set origin ActiveDocument.DrawingOriginY = 0 ' to centre of page ActiveDocument.ReferencePoint = cdrCenter Optimization = True For Each s In ActivePage.Shapes ' could be changed to activeselection x = s.PositionX y = s.PositionY If x < 0 And y <> 0 Then ro = Atn(y / x) * 57.29577 + 90 'Atan in radians - converts to degrees and adds right angle If x > 0 And y <> 0 Then ro = Atn(y / x) * 57.29577 - 90 If x = 0 And y > 0 Then ro = 0 If x = 0 And y < 0 Then ro = 180 If y = 0 And x > 0 Then ro = 270 If y = 0 And x < 0 Then ro = 90 If y = 0 And x = 0 Then ro = 0 s.Rotate ro Next s Optimization = False ActiveWindow.Refresh End Sub Last edited by nic; 15-11-2013 at 14:02. Reason: to prevent division by zero |
#3
|
||||
|
||||
![]()
Thanks Nic
Sometimes hangs in X4 But otherwise like a charm. ![]() |
![]() |
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 |
Object reference | xombie | CorelDRAW/Corel DESIGNER VBA | 2 | 25-05-2011 13:20 |
Macro to rotate | first5mins | General | 2 | 21-01-2010 14:57 |
Is the a X3 to X4 Object Code difference reference? | Steve | CorelDRAW/Corel DESIGNER VBA | 22 | 19-03-2008 09:48 |
Pick a Point | met | CorelDRAW/Corel DESIGNER VBA | 1 | 02-11-2005 07:31 |
Rotate around a centre | Anonymous | Code Critique | 3 | 14-01-2005 17:07 |