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 26-07-2005, 21:11
jemmyell jemmyell is offline
Senior Member
 
Join Date: Jan 2005
Location: Orange County, California, USA, Earth, Solar System, Milky Way Galaxy
Posts: 157
Default cannot close combined shape

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.
__________________
-James Leonard
CNC Inlay Guy - www.CorelDRAWCadCam.com
Reply With Quote
  #2  
Old 27-07-2005, 08:56
xombie
Guest
 
Posts: n/a
Default Close shape

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
Reply With Quote
  #3  
Old 27-07-2005, 09:15
jemmyell jemmyell is offline
Senior Member
 
Join Date: Jan 2005
Location: Orange County, California, USA, Earth, Solar System, Milky Way Galaxy
Posts: 157
Default Why does 'close path' on the UI work?

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?
__________________
-James Leonard
CNC Inlay Guy - www.CorelDRAWCadCam.com
Reply With Quote
  #4  
Old 27-07-2005, 12:37
Jadus
Guest
 
Posts: n/a
Default Separate shapes?

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
Note that I append, not create each segment, therefore I don't have to combine them. The last statement closes the object.

I hope this helps.

Dave
Reply With Quote
  #5  
Old 27-07-2005, 14:06
jemmyell jemmyell is offline
Senior Member
 
Join Date: Jan 2005
Location: Orange County, California, USA, Earth, Solar System, Milky Way Galaxy
Posts: 157
Default I want to append pre-drawn shapes also

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.
Attached Files
File Type: cdr stormbringer.cdr (37.8 KB, 649 views)
__________________
-James Leonard
CNC Inlay Guy - www.CorelDRAWCadCam.com
Reply With Quote
  #6  
Old 27-07-2005, 15:25
jemmyell jemmyell is offline
Senior Member
 
Join Date: Jan 2005
Location: Orange County, California, USA, Earth, Solar System, Milky Way Galaxy
Posts: 157
Default problem solved by Alex quite a while ago

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.
__________________
-James Leonard
CNC Inlay Guy - www.CorelDRAWCadCam.com
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
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


All times are GMT -5. The time now is 05:06.


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