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 12-08-2003, 05:19
jobar
Guest
 
Posts: n/a
Default Curve2Line script !

Hi !

Please forget my previous message. I did it!
Here is the script that transforms all the curves of all the objects into straight lines.
Thanks to Alex for his "Object Cycler" script.
I don't need VBA any more even if I am not really happy that it does not work on my computer...

Joseph 8)

REM ============================================
REM Curve2Line for CorelDRAW 10
REM 12 August 2003 by Joseph Barraud
REM Finds all the object in the current document and
REM converts all the curves into lines.
REM
REM Based on Object cycler by Alex I. Vakulenko
REM http://www.oberonplace.com
REM ============================================


' To use the script with CorelDRAW 7, 8 or 9 change "10" for the version of your CorelDRAW
' in the line below
#define DRAWOBJECT "CorelDraw.automation.10"

DECLARE SUB SearchAll(ID&, StartID&amp
DECLARE SUB ProcessObject

WITHOBJECT DRAWOBJECT
.UnSelectAll
.SelectNextObject 0
ID1& = .GetObjectsCDRStaticID()
CALL SearchAll ID1&, 0
.UnSelectAll
END WITHOBJECT
MessageBox "Done !","Bravo !",48
stop

SUB SearchAll(ID&, StartID&amp
LocalID& = ID
LocalStart& = StartID
WITHOBJECT DRAWOBJECT
DIM Booltest as boolean
Booltest = TRUE
DO WHILE Booltest
IF .GetObjectType() = 12 THEN ' A group is found. Enter into it
GroupID& = .GetObjectsCDRStaticID()
.SelectNextObject -1
IDNext& = .GetObjectsCDRStaticID()
CALL SearchAll IDNext, GroupID
.SelectNextObject 0
ELSE
CALL ProcessObject ' Process the current object
.SelectNextObject 0
END IF
IF .GetObjectsCDRStaticID() = LocalID THEN Booltest = False
LOOP
.SelectObjectOfCDRStaticID LocalStart
END WITHOBJECT
END SUB

'====================================
' Subroutine Curve2Line
'====================================
SUB ProcessObject
WITHOBJECT DRAWOBJECT

.BeginEditObject
.SelectNode 0


num = .GetCurveNodeCount()

index = 0

DO WHILE index < num
.SelectNextNode
.SetSegmentType 0
index = index + 1
LOOP


.EndEditObject
END WITHOBJECT
END SUB
Reply With Quote
  #2  
Old 14-08-2003, 11:40
shelbym's Avatar
shelbym shelbym is offline
Senior Member
 
Join Date: Nov 2002
Location: Cheyenne, WY
Posts: 1,769
Blog Entries: 10
Send a message via ICQ to shelbym Send a message via AIM to shelbym Send a message via MSN to shelbym Send a message via Yahoo to shelbym
Default VBA Example

Here is the same thing in VBA. It is much faster. Will also convert non curve objects to curves, then to lines.

Hope if works for you,

Shelby



Code:
Sub ProcessAllObjects()
    CurveToLine ActivePage.Shapes
End Sub

Private Sub CurveToLine(ss As Shapes)

Dim s As Shape
Dim seg As Segment

For Each s In ss
    If s.Type = cdrGroupShape Then
        CurveToLine s.Shapes
    Else
        If s.Type <> cdrCurveShape Then s.ConvertToCurves
        If s.Type = cdrCurveShape Then
            For Each seg In s.Curve.Segments
            seg.Type = cdrLineSegment
            Next seg
        End If
    End If
Next s

End Sub
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
NEED HELP ON CORELDRAW SCRIPT. FREE PHOTO CALENDAR IF U CAN! johnlfitz CorelDRAW/Corel DESIGNER VBA 8 06-06-2008 22:59
problem with script or macro. Dr Morpheus CorelDRAW/Corel DESIGNER VBA 1 12-02-2004 13:46
Script through CorelDRAW and CorelPHOTO-PAINT d-signer Corel Photo-Paint VBA 3 14-01-2004 08:55
Cropmarks script Peter Macros/Add-ons 0 06-11-2003 03:51
Corel 10 file conversion script doesn't convert files Kevin CorelDRAW CS 0 13-04-2003 20:28


All times are GMT -5. The time now is 16:03.


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