Wow thank you so much for the speedy replies!
By the way, I have learnt a lot about scripting from reading your posts on this forum, thank you both for your dedication!
I tried the double comparison as described above, surprisingly all walls are then selected, regardless of the angle.
I was thinking about a lazy workaround: Duplicate the first object and rotate by 180°, get its angle, then use double comparison.
Trying quickly to modify the script as following, unfortunately it is still not working with every angles.
@Pat StanfordActually I wanted to select the angle precisely, the purpose would be to identify Walls with minimal displacement, like between 35.0000° and 34.9999° as you described. But I will look further in the direction you describe. Thank you a lot for your help!
import vs
WallObj = vs.FSActLayer()
Rotation = vs.HAngle(WallObj)
if Rotation < 0: #not sure about this
RotAngle = 180
else:
RotAngle = -180
WallDuplicate = vs.Duplicate(0,0)
vs.SetSelect(WallDuplicate)
DuplRotate = vs.Rotate(RotAngle)
RotationReverse = vs.HAngle(DuplRotate)
vs.DeleteObjs()
vs.DSelectAll()
def SelectIdenticalWallAngle(h1):
ObjType = vs.GetTypeN(h1)
ObjAngle = vs.HAngle(h1)
if (ObjType == 68):
if ObjAngle == Rotation or ObjAngle == RotationReverse:
vs.SetSelect(h1)
vs.ForEachObjectInLayer(SelectIdenticalWallAngle, 1,2,0)