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 31-01-2005, 17:31
bbolte
Guest
 
Posts: n/a
Default counting curve and line segments

is there a way to count curve and line segments in one line of code like i can when counting the total segments?

below is what i'm doing currently and it seems really slow:
Code:
For Each seg In ActiveShape.Curve.Segments
        Select Case seg.Type
            Case cdrLineSegment
                LineCount = LineCount + 1
                LineLength = LineLength + seg.Length
            Case cdrCurveSegment
                CurveCount = CurveCount + 1
                curveLength = curveLength + seg.Length
        End Select
Next seg
to do total segments i use:
Code:
ActiveShape.Curve.Segments.Count
i was hoping there was something similar to count segment types?
Reply With Quote
  #2  
Old 31-01-2005, 18:40
shelbym's Avatar
shelbym shelbym is offline
Senior Member
 
Join Date: Nov 2002
Location: Cheyenne, WY
Posts: 1,769
Blog Entries: 9
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

I am guess what you have is the only way. The help file says to do it like this, which is just like you have it.

Code:
Sub Test()

 Dim seg As Segment, ls As Long, cs As Long

 If ActiveShape Is Nothing Then Exit Sub
 If ActiveShape.Type <> cdrCurveShape Then Exit Sub
 ls = 0
 cs = 0

 For Each seg In ActiveShape.Curve.Segments
  Select Case seg.Type
   Case cdrLineSegment
    ls = ls + 1
   Case cdrCurveSegment
    cs = cs + 1
  End Select

 Next seg

 MsgBox "The current curve has " & ActiveShape.Curve.Segments.Count & _

" segments including:" & vbCr & _
"Line segments: " & ls & vbCr & _
"Curve segments: " & cs

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
New user - curve default? - dxf conversion? Anonymous CurveWorks 2 16-05-2003 11:23
I can't let the text on a curve line Dino CorelDRAW/Corel DESIGNER VBA 2 11-04-2003 05:13


All times are GMT -5. The time now is 12:51.


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