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 06-02-2004, 13:21
ddonnahoe's Avatar
ddonnahoe ddonnahoe is offline
Senior Member
 
Join Date: Jan 2004
Location: Louisville, KY
Posts: 552
Send a message via ICQ to ddonnahoe Send a message via AIM to ddonnahoe Send a message via MSN to ddonnahoe Send a message via Yahoo to ddonnahoe
Default Too many nodes

I was wondering if anyone knows of a script or could help me write a short script that I can use to reduce the amount of nodes in a resulting shape "contour", <CTRL-F9> in CD 11, and still maintain the new shapes integrity. What I would ulimately like to do is create a user form that will take a selected outline shape and ask for an offset amount, inside or outside, and then break apart the resulting countour and clean up the excessive nodes on the new shape.
__________________
Sean
Waiting for a ride in the T.A.R.D.I.S.
Reply With Quote
  #2  
Old 09-02-2004, 12:17
Alex's Avatar
Alex Alex is offline
Administrator
 
Join Date: Nov 2002
Posts: 1,941
Blog Entries: 4
Default Re: Too many nodes

Here is a simple macro for you to start with. It creates a single-step contour outside with offset of 0.1", then breaks it apart and if the resulting contour step object is a curve, it reduces the number of nodes so that the shape of the curve stays accurate within 0.01". The reason why we need to test if the result is a curve is because controur will produce, say, rectangles if the original shape is a rectangle.

Code:
Sub CreateSimpleContour()
    Dim sCurve As Shape
    Dim eff As Effect
    Set eff = ActiveShape.CreateContour(cdrContourOutside, 0.1, 1, _
                                cdrDirectFountainFillBlend, _
                                CreateCMYKColor(0, 0, 0, 100), _
                                CreateCMYKColor(0, 0, 0, 100), _
                                CreateCMYKColor(0, 0, 0, 100), 0, 0)
    Set sCurve = eff.Separate(1)
    If sCurve.Type = cdrCurveShape Then
        sCurve.Curve.Nodes.All.AutoReduce 0.01
    End If
End Sub
You can tweak the above code to specify different offset or the direction of the controur. You also must ensure that there is a valid selection and, in case of inside contours, the offset isn't big enough and the shape is closed. But I will leave this to you to check
Reply With Quote
  #3  
Old 09-02-2004, 12:45
ddonnahoe's Avatar
ddonnahoe ddonnahoe is offline
Senior Member
 
Join Date: Jan 2004
Location: Louisville, KY
Posts: 552
Send a message via ICQ to ddonnahoe Send a message via AIM to ddonnahoe Send a message via MSN to ddonnahoe Send a message via Yahoo to ddonnahoe
Default

Thanks! I'll keep the group posted on the progress of this project.
__________________
Sean
Waiting for a ride in the T.A.R.D.I.S.
Reply With Quote
  #4  
Old 27-02-2004, 07:14
ddonnahoe's Avatar
ddonnahoe ddonnahoe is offline
Senior Member
 
Join Date: Jan 2004
Location: Louisville, KY
Posts: 552
Send a message via ICQ to ddonnahoe Send a message via AIM to ddonnahoe Send a message via MSN to ddonnahoe Send a message via Yahoo to ddonnahoe
Default

So far I have created the Module and form below to work out this problem. It works fine up to a point. For some reason, depending on the shape or whatever, the new outline "flattens" out some of the areas where there should be curves. It seems to happen on areas where the curve angle between two nodes is greater than 90º, but this is just a theory right now. Is there something that I can do to keep those lines between the nodes curved, or am I just wishful thinking?
Attached Files
File Type: zip AutoContour.zip (1.9 KB, 930 views)
__________________
Sean
Waiting for a ride in the T.A.R.D.I.S.
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
problems with nodes jmalmsteen CorelDRAW/Corel DESIGNER VBA 1 14-06-2005 12:23
It is a bug? (Reflecting Nodes) Hernán General 0 26-10-2004 01:13
Reducing Nodes Semi Automatic Superfreak New product ideas 2 05-10-2004 02:10
Convert cure or segment to many Nodes -=HKLC=- CorelDRAW/Corel DESIGNER VBA 2 04-10-2004 20:30
Select all nodes if the subpath d-signer CorelDRAW/Corel DESIGNER VBA 2 12-05-2004 23:47


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


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