![]() |
#1
|
|||
|
|||
![]()
Being somewhat new to draw, I know very little about it and less about vba. However, here it is.
I am creating a macro for coreldraw 11 that creates a shape for a laser cutting process. The macro prompts the user to enter dimensions for hieght and width. It creates a box in corel and sets the corner radius to 10 then scales the box to the dimensions required. The problem becomes once you scale the box the corner radius gets skewed. Is this known to be an issue in cd? The only solutions I could see are to either be able to enter dimensions into corel and have it place your object on the canvas correctly porportioned (can it do that?), or create it with a script. If a script is required I can use the macro software to replace the "dimension" text before corel runs it. Is there a create box script out there? I would not know where to begin trying to write one. Any other suggestions are welcome. |
#2
|
||||
|
||||
![]()
Why don't you just create the rectangle with the right dimensions from the start? I don't know your exact requirements, but I believe it should be possible to calculate the final rectangle size right in the macro and create it with perfect round corners in a single step...
|
#3
|
|||
|
|||
![]()
I am not aware of a way to do that. The only way I see to make a box is to click and drag. The dimensions for the basic shape will be different every time but it will have consistent rules that determine it's overall apearance(holes, position, ect...).
The macro software I'm doing this in (macro express), creates the box in draw, prompts me for hieght and width values then inserts the numeric values for me into the Object size boxes in the property tool bar. If I could copy those vaues into input boxes in draw and tell it to create the box to those dimentions it would be great. |
#4
|
|||
|
|||
![]()
Just found Oberon Instant Object Creator and it is what I need but I get 611 runtime error(could not create specified OLE automation object). Is there a cd11 version out there? Or a fix?
|
#5
|
||||
|
||||
![]()
The script gives you the error because it was designed to be used with an earlier version of CorelDRAW. It can be easily updated by opening the CSC file in Notepad and looking for "CorelDRAW.Automation.7" (or whatever version of the script you have) and replace the 7 with 11.
Or better yet, use VBA for this. You can do it much easier with it. Here I created a really small simple version which should run in CorelDRAW 10-12. Just drop the attached GMS file in Program Files\\Corel\Corel Graphics 11\Draw\GMS, then go to Tools>Visual Basic>Play in CorelDRAW to run the macro (for more information about using GMS files, click here). The actual code that creates the objects is quite simple: Code:
Private Sub cmCreate_Click() Dim x As Double, y As Double Dim sx As Double, sy As Double sx = Val(txtWidth.Text) sy = Val(txtHeight.Text) If sx <= 0 Or sy <= 0 Then MsgBox "Invalid object size", vbCritical Exit Sub End If If rRectangle.Value Then x = ActivePage.CenterX - sx / 2 y = ActivePage.CenterY - sy / 2 ActiveLayer.CreateRectangle2 x, y, sx, sy Else x = ActivePage.CenterX y = ActivePage.CenterY ActiveLayer.CreateEllipse2 x, y, sx / 2, sy / 2 End If End Sub |
#6
|
|||
|
|||
![]()
This appears to be exactly what I needed. I will try it out at work on Monday and post again if I have any problems.
Many Thanks, ![]() |
#7
|
|||
|
|||
![]()
Hi Alex
I just downloaded round corner macro but I am not able to make it work I am using Corel X6 is it a version problem or what My real need is to put a radius, measure or anything at an acute angle on the shape looking outside of the object My problem is, with the acute angles looking outside the object. As in the cdr shape you can see there -40 , 41, 117 and -118 degree angles. Why does it say -40 and not 320 degrees and -118 not 242 degrees. And which angle looks outside the object? these angles are inside the object These angles are outside the object . How can I say they are outside the object with a macro? I couldn’t understand exactly but there is a solution in round corners because the radius is always in the right direction and place Best regards Cabir Bilirgen |
#8
|
||||
|
||||
![]()
The following code will show the angles with positive values instead of negative as you wanted:
Code:
Sub WhatIsMyAngle() Dim n As Node Dim sShape As Shape Dim segBefore As Segment Dim segAfter As Segment Dim da As Double Set sShape = ActiveShape If sShape Is Nothing Then MsgBox "Nothing selected", vbCritical Exit Sub End If If sShape.Type <> cdrCurveShape Then MsgBox "A curve object must be selected", vbCritical Exit Sub End If For Each n In sShape.Curve.Nodes Set segBefore = n.PrevSegment Set segAfter = n.NextSegment If Not segBefore Is Nothing And Not segAfter Is Nothing Then da = segBefore.EndingControlPointAngle - segAfter.StartingControlPointAngle If da < 0 Then da = 360 + da ActiveLayer.CreateArtisticText n.PositionX, n.PositionY, Round(da, 0) & " degrees", , , "Ariel", 8, , , , cdrCenterAlignment End If Next n End Sub -Shelby |
#9
|
|||
|
|||
![]()
Hi Shelby
This not what I asked. I am just trying to find the face of the angle. May be I can find it on the way you showed me by adding or subtracting the angle with 180 or 360. I hoped that you should show me how to calculate with tangent or sinus just as in "round corners script". Anyway I am really happy to know you. You spent your very valuable time to me. Thank you very much and greetings to your family. You have a friend in Turkey. Best for you Cabir Bilirgen |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | Search this Thread |
Display Modes | |
|
|