Author Topic: Switch Start/Eindpoints for linetypes with text  (Read 2580 times)

0 Members and 1 Guest are viewing this topic.

jura

  • Guest
Switch Start/Eindpoints for linetypes with text
« on: October 13, 2004, 03:04:30 AM »
I'm using customer define linetypes. There is text in them and the text is upside down if the line is drawn from right to left. I started this simple routine to change all lines that were drawn the wrong way. But i get a type mismatch in the line "If Lijn.StartPoint < Lijn.EndPoint Then..."

What am I doing wrong?
Is there a way to check if a selection set (SS) already exists? Deleting a non-existing SS or Creating an existing SS generates an error.

Code: [Select]

Sub LineChange()
Dim Lijn As AcadLine
Dim templijn As AcadLine
Dim LijnenSSet As AcadSelectionSet

Set LijnenSSet = ThisDrawing.SelectionSets.Add("Line")
LijnenSSet.SelectOnScreen

For Each Lijn In LijnenSSet
    If Lijn.StartPoint < Lijn.EndPoint Then
    templijn.StartPoint = Lijn.StartPoint
    Lijn.StartPoint = Lijn.EndPoint
    Lijn.EndPoint = templijn.StartPoint
    End If
Next Lijn

LijnenSSet.Delete
End Sub

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16717
  • Superior Stupidity at its best
Switch Start/Eindpoints for linetypes with text
« Reply #1 on: October 13, 2004, 08:15:58 AM »
The StartPoint and EndPoint of a line returns an array of the three coordinate values ... i.e. X,Y,Z So...since you are wanting to determine the left and right of the line, use the X (0th element of array) to compare...

Similar to
Code: [Select]

PT1 = Lijn.StartPoint
PT2 = Lijn.EndPoint
If PT1(0) > PT2(0) Then
 Lijn.StartPoint = PT2
 Lijn.EndPoint = PT1
End If


To delete an existing selection set that you know the name of, but do not have a reference object
Code: [Select]

ThisDrawing.SelectionSets.Item("Line").Delete
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

jura

  • Guest
Switch Start/Eindpoints for linetypes with text
« Reply #2 on: October 13, 2004, 08:51:07 AM »
If only all things in life would be that simple.

Thx Keith.

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16717
  • Superior Stupidity at its best
Switch Start/Eindpoints for linetypes with text
« Reply #3 on: October 13, 2004, 12:02:25 PM »
no problem.. glad to help
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

pmvliet

  • Guest
Switch Start/Eindpoints for linetypes with text
« Reply #4 on: October 13, 2004, 02:15:15 PM »
I believe that text will also be backward from top to bottom or from bottom to top. To catch all instances you would have to compare the "Y" values as well because a vertical line will have the same "x" coordinate.

Pieter

jura

  • Guest
Switch Start/Eindpoints for linetypes with text
« Reply #5 on: October 19, 2004, 04:03:49 PM »
Thx Pieter, (very dutch name btw)

I'm aware of that.

Didn't hurt in tellin' me though.