TheSwamp
Code Red => VB(A) => Topic started by: jura 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.
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
-
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
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
ThisDrawing.SelectionSets.Item("Line").Delete
-
If only all things in life would be that simple.
Thx Keith.
-
no problem.. glad to help
-
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
-
Thx Pieter, (very dutch name btw)
I'm aware of that.
Didn't hurt in tellin' me though.