Discussion:
Select by length
(too old to reply)
Frantisek Horalek
2005-03-10 13:25:51 UTC
Permalink
Hi,
I am trying to select all curves with length shorter than some value.
.GetCurveLength() or Length are not working in Corel 12 VBA.

Could anybody help me, PLEASE?

Thank you,
Imagino
Frantisek Horalek
2005-03-10 14:50:51 UTC
Permalink
On Thu, 10 Mar 2005 14:25:51 +0100, Frantisek Horalek
Post by Frantisek Horalek
Hi,
I am trying to select all curves with length shorter than some value.
.GetCurveLength() or Length are not working in Corel 12 VBA.
Could anybody help me, PLEASE?
Thank you,
Imagino
As usuall, as soon as I post a message here, I resolve my problem ;o)
Done, sorry.

Imagino
Brian
2005-03-10 14:53:25 UTC
Permalink
Post by Frantisek Horalek
On Thu, 10 Mar 2005 14:25:51 +0100, Frantisek Horalek
Post by Frantisek Horalek
Hi,
I am trying to select all curves with length shorter than some value.
.GetCurveLength() or Length are not working in Corel 12 VBA.
Could anybody help me, PLEASE?
Thank you,
Imagino
As usuall, as soon as I post a message here, I resolve my problem ;o)
Done, sorry.
Imagino
Well, do tell, Imagino. Aren't you going to share with us your
resolution of the problem?

Brian :-)
Frantisek Horalek
2005-03-10 15:24:20 UTC
Permalink
Post by Brian
Well, do tell, Imagino. Aren't you going to share with us your
resolution of the problem?
Brian :-)
OK, but it is really pritimitive ;o) I am programming VBA first time
today. Working in Corel Draw 12.

=============
Sub CurveLength()

Dim s As Shape
Dim Delka As Double
Dim Velikost As Double

ActiveDocument.Unit = cdrMillimeter

Velikost = CDbl(InputBox("Do kolika mm?"))

ActiveDocument.BeginCommandGroup "CurveLength"
For Each s In ActiveLayer.Shapes.All
Delka = CDec(s.Curve.Length)
' MsgBox "Je " & Delka & " milimetrů dlouhá."
If Delka <= Velikost Then
s.AddToSelection
End If
Next s
ActiveDocument.EndCommandGroup

' Grouping
ActiveDocument.BeginCommandGroup "GroupCurveLength"
Set s = ActiveSelection.Group
s.Layer = ActiveLayer
ActiveDocument.EndCommandGroup

End Sub
=============

That is all ;o)
Imagino
Brian
2005-03-10 16:46:36 UTC
Permalink
Post by Frantisek Horalek
Post by Brian
Well, do tell, Imagino. Aren't you going to share with us your
resolution of the problem?
Brian :-)
OK, but it is really pritimitive ;o) I am programming VBA first time
today. Working in Corel Draw 12.
=============
Sub CurveLength()
Dim s As Shape
Dim Delka As Double
Dim Velikost As Double
ActiveDocument.Unit = cdrMillimeter
Velikost = CDbl(InputBox("Do kolika mm?"))
ActiveDocument.BeginCommandGroup "CurveLength"
For Each s In ActiveLayer.Shapes.All
Delka = CDec(s.Curve.Length)
' MsgBox "Je " & Delka & " milimetrů dlouhá."
If Delka <= Velikost Then
s.AddToSelection
End If
Next s
ActiveDocument.EndCommandGroup
' Grouping
ActiveDocument.BeginCommandGroup "GroupCurveLength"
Set s = ActiveSelection.Group
s.Layer = ActiveLayer
ActiveDocument.EndCommandGroup
End Sub
=============
That is all ;o)
Imagino
thanks very much for that, Imagino. I have never tried Visual Basic in
Corel, but it is getting to a time when I ought to have a go. Thanks for
the inspiration with your above script. I think I need to do some
studying up before I start.

Brian.

Loading...