![]() |
#1
|
|||
|
|||
![]()
Hi everyone,
I hope someone can help. I have a programmer who is writing a CorelDraw X6 Macro program for me and is stuck. I have a template with many objects with specific names. The macro is designed to replace the existing objects on the template with imported graphic files (.hpgl) with the same properties ( size, position, rotation etc.) This works well with importing the files into the same position and scale as long as the rotation is zero however if the object (shape) on the template is rotated <>0 then this property is ignored and the new imported graphic file is imported with NO rotation. We do not want to hard code OR have to manually input the rotation. We want to copy, evaluate or inherit this properties from the existing object on the template and apply these properties to the new imported replacement file. Ie. Get Rotation angle from (Object Name: 'Object1') then replace old Object Name: 'Object1' with imported file (to be new Object1) then apply Shape.Rotate = (old rotation angle for Object1) So I can see the shape.rotate command, but can some help me with the code for how to inherit the existing rotation angle? Shape.Rotate = (old rotation angle for Object1) I am not a programmer, so I hope I have made myself clear any guidance would be appreciated cheers Mark |
#2
|
||||
|
||||
![]()
Here is a quick example if I understand you correctly. The following code will import a shape to the currently selected shapes position, change the angle, change the name, then delete the original shape.
Code:
Sub MyAngle() Dim s1 As Shape, s2 As Shape Dim x As Double, y As Double Set s1 = ActiveShape 'Get the selected shape s1.GetPositionEx cdrCenter, x, y ActiveLayer.Import "C:\Temp\Files\MyNewShape.cdr" 'Import a new shape Set s2 = ActiveShape s2.SetPositionEx cdrCenter, x, y 'Move the imported shape to position s2.RotationAngle = s1.RotationAngle 'Set the angle as s1 s2.Name = s1.Name 'Name the shapes the same s1.Delete 'Delete the original shape End Sub |
#3
|
|||
|
|||
![]()
If you just need to replace existing shapes with others ones leaving size, position and rotation then you may not have to use macro for it. Make any shape and convert it to symbol. After this duplicate, distribute, change size and position to make a template. When you need to replace existing shapes with new ones just copy new shape into buffer (Ctrl-C), enter to editing symbols (Ctrl-click on symbol), delete old and paste (Ctrl-V) new shape from buffer. After exiting from edit-mode (another ctrl-click) you can get all shapes are replaced and transformed.
P.S. Sorry for my English, I am from Russia Last edited by shark; 02-10-2012 at 09:25. |
#4
|
|||
|
|||
![]()
Thanks Shelby,
I gave the sample code to the programmer and he tested it successfully. Thanks for your help and support cheers Mark Quote:
|
![]() |
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 |
copy center rotation properties | buga | Macros/Add-ons | 0 | 20-01-2011 06:21 |
Precision in rotation | vindaa | CorelDRAW/Corel DESIGNER VBA | 2 | 02-09-2008 21:05 |
Rotation and PowerClip | Craig Tucker | CorelDRAW/Corel DESIGNER VBA | 3 | 23-08-2007 16:31 |
Rotation Angle | norbert_ds | CorelDRAW/Corel DESIGNER VBA | 1 | 20-04-2007 02:39 |
Corel X3 - object properties bar absolute/relative position issue | JeffDM | General | 4 | 14-11-2006 13:55 |