Jump to content

vs.SetAngle(h, value) - running issues

Recommended Posts

Dear VectorWorks forum:


I need to write a script in order to change the rotation angle of some object with a specified parameter.

But I have an issue using this python function: - vs.SetAngle(h, value) - cause nothing change after the script run. 
vs.HAngle(h) works perfectly, I can get the rotation parameter.
I think I'm writing something wrong in the parameters method.

Here the script:

def SetRot(h):
  rotValue = vs.HAngle(h)
  vs.SetAngle(h, 75.0 )
vs.SelectObj("INSYMBOL & INVIEWPORT & ((PON='Data Tag') & (PST=''))")
vs.ForEachObjectInLayer(SetRot, 2, 0, 2)


Link to comment

Hello @Andreas,

   I tried to use vs.SetAngle() on Lines, Arcs, and Rects to no avail. I tried in VW 2024 and VW 2015 with the same result. I also tried in Python and Pascal, still nothing. It appears the command is not functioning as advertised. There are other ways to set the angle of objects. Here's a short Pascal script that shows the current angle of a Symbol or PIO (which includes the Data Tag), and changes it to the user's value.


Here's a short script to show how to set an angle without using vs.SetAngle()

import vs
# Example script to change the angle of a Symbol or PIO.

Ang0 = vs.GetSymRot(vs.FSActLayer())
Ang = vs.RealDialog("Angle: ", vs.Concat(Ang0))

InsPt = vs.GetSymLoc(vs.FSActLayer())
vs.HRotate(vs.FSActLayer(), InsPt, Ang-Ang0)



Link to comment

I launched VW 2009 on an older Mac and confirmed SetAngle() does work, but only on Rectangles and Ovals as far as I could discern. It does not work on Arcs, Lines, Images, Symbols, or PIOs. I then restarted VW 2024, and got the same results.


Conclusion: The function SetAngle() is not broken, it is just severely limited in what it will operate upon. For most needs, use HAngle() instead.



Link to comment

Thanks for yours replies @MullinRJ and @Marissa Farrell 

I changed function and using " vs.Set3DRot( handle , angX, angY, angZ, oX, oY, oZ ) " works well for all objects types.


15 hours ago, MullinRJ said:

Here's a short Pascal script that shows the current angle of a Symbol or PIO (which includes the Data Tag), and changes it to the user's value

Thanks also for this solution, I'll keep " vs.HRotate() " in mind 🙂 

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...