Jump to content

arcobaleno

Member
  • Posts

    2
  • Joined

  • Last visited

Reputation

0 Neutral

Personal Information

  • Location
    Switzerland
  1. 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)
  2. Hello everyone, I am trying to write a script to select every wall objects which have the same angle as the currently selected object. How can I include the wall objects with reverse direction? For example: If the selected object has an angle of 0°, then the walls with an angle of -180° should be selected as well (which is not the case in my script). Actually I want to select parallel walls only, regardless of the direction. Is there a vectorscript function for this, or a function that gets the wall direction? I was looking for a way to invert the angle values with modulo division, for example: -10° %180 = 170°, and 10° % -180 = -170°. I also tried to convert the angle in vector with vs.Ang2Vec, reverse and convert it back, but I couldn't get it to work for every angle value. Plus it seems that some rounding errors would also occur. My poor maths and programming skills are being quite challenged here! Thank you very much for your help! pythonscript: import vs Rotation = vs.HAngle(vs.FSActLayer()) vs.DSelectAll() def SelectIdenticalWallAngle(h): ObjType = vs.GetTypeN(h) ObjAngle = vs.HAngle(h) if (ObjType == 68): #Wall Type = 68, as defined in Appendix if ObjAngle == Rotation: vs.SetSelect(h) vs.ForEachObjectInLayer(SelectIdenticalWallAngle, 1,1,0)
×
×
  • Create New...