![]() |
#1
|
|||
|
|||
![]()
Hi all,
Can anybody tell me why this code fails? It seems to be correct from all the snippets I have looked at on here and in the CorelDraw 12 docs??? Private Sub newtest_Click() Dim left, right, upper, lower, s As Shape 'draw a rectangle out of line segments 'left Set left = ActiveDocument.ActiveLayer.CreateLineSegment(2#, 2#, 2#, 3#) 'right Set right = ActiveDocument.ActiveLayer.CreateLineSegment(3#, 2#, 3#, 3#) 'upper Set upper = ActiveDocument.ActiveLayer.CreateLineSegment(2#, 3#, 3#, 3#) 'lower Set lower = ActiveDocument.ActiveLayer.CreateLineSegment(2#, 2#, 3#, 2#) 'Clear any currently active selection ActiveDocument.ClearSelection 'Combine the segments into a single curve shape left.Selected = True right.Selected = True upper.Selected = True lower.Selected = True Set s = ActiveSelection.Combine 'close the curve so it can be filled s.Curve.Closed = True If s.Curve.Closed = False Then MsgBox "Failed to close the shape" End If 'Clear the active selection ActiveDocument.ClearSelection End Sub Thanks in advance for all your help. |
#2
|
|||
|
|||
![]()
Try looking at the subpath(s) and node properties of s and close the shape you created by welding the nodes together. As it sits right now, Your square is still an open shape and wont fill.
HTH Andy |
#3
|
|||
|
|||
![]()
Hi Andy,
Thanks, I will look at these things. But, 'Close Path' on the Corel menu works just fine, so I wonder what it is doing that 'Shape.Curve.Close' does not? |
#4
|
|||
|
|||
![]()
Is there any reason why you are creating those lines separately rather than node to node?
I have a shape I create, and it closes, here is a sample: Code:
Set crv = CreateCurve(ActiveDocument) Set sp = crv.CreateSubPath(8.247, 7.829) sp.AppendLineSegment 8.247, 7.401, False sp.AppendCurveSegment 7.351, 7.634, 0.33, 151.967, 0.32, 0.183, False sp.AppendCurveSegment 6.455, 7.402, 0.322, -179.505, 0.316, 28.487, False sp.AppendLineSegment 6.456, 7.823, False sp.AppendCurveSegment 7.353, 8.013, 0.322, 21.935, 0.313, -179.257, False sp.AppendCurveSegment 8.247, 7.829, 0.337, 0.757, 0.311, 157.67, False sp.Closed = True I hope this helps. Dave |
#5
|
|||
|
|||
![]()
Hi Dave,
Thank you! I believe that this will solve my current problem, but I also want to add pre-drawn shapes to the curves. Basically, I have a routine that draws a guitar fingerboard, adds a nut and frets. I also want to add a special heel shape. The fingerboard is a simple taper from nut to last fret, but the heel itself can be any of a number of arbitray shapes. It will be placed after the first three sides of the fingerboard have been drawn. It will be copied from a library of pre-drawn heel shapes, scaled in the Y-axis only and then placed so the endpoints are butted against the ends of the two longs sides of the fingerboard. This shape then needs to be closed so it can be given a bitmap fill of a photo of wood. So, I think it will be better to learn how to attach arbitrarily positioned lines and curves, so this second task can be done also. I have attached a drawing being done by this tool so you can visualize what I am talking about. The fingerboard is still missing the heel, that is the next feature to add, as soon as I get the nut and frets closed so they can be filled. |
#6
|
|||
|
|||
![]()
Hello,
The macro package CurveEffects has a routine 'CloseShape' that is just what the developer wished for! Thanks to all for the comments and help. |
![]() |
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 |
a shape on top of another | Seelenquell | CorelDRAW/Corel DESIGNER VBA | 15 | 01-03-2008 09:08 |
Moving Shape to another page using C++ | moodwin | CorelDRAW/Corel DESIGNER VBA | 4 | 18-03-2005 03:01 |
Howto uniquely identify a shape in VBA code | jemmyell | CorelDRAW/Corel DESIGNER VBA | 9 | 11-02-2005 22:05 |
Shape Looping... | Craig Tucker | CorelDRAW/Corel DESIGNER VBA | 9 | 21-06-2004 10:15 |
finding node angles? | IanVincent | CorelDRAW/Corel DESIGNER VBA | 4 | 13-12-2003 00:32 |