Jump to content
Developer Wiki and Function Reference Links ×

rotate 2D object by absolute angle


relume

Recommended Posts

Hello

 

I have to rotate 2D objects in vectorscript/python by an individual absolute angle. With vs.HRotate the rotation is executed in relation to the actual angle  - so the actual object angle value is added by the angle value set with vs.HRotate ( actual angle is for examble 30d, the angle for rotation is 45d so with HRotate the resulting angle will be 75d - but I want the object to be rotate to the absolute angle of 45d) . Is there any alternative command to set an absolute angle - e.g. set/access the object angle field directly?

 

Many thanks in advance

Link to comment

Hello Josh

 

Thank you very much - finally I went the way you proposed also.

I tried also the command "vs.SetAngle" and that is the command I searched for (absolute rotation), but unfortunately this command works only on "pure" 2D Objects but not on 2D Symbols.

 

 

Link to comment

Accidentally, we all try to solve the same problem at the same time :-) My solution:

SollWinkel = 45

def DoSomething(h):
    if vs.GetType(h) == 15: #Symbol in Drawing
        x,y = vs.GetSymLoc(h)
        #vs.Locus(x,y) #Test Symbol insertion Point
        IstWinkel = vs.GetSymRot(h)
        Winkel = SollWinkel-IstWinkel        
        vs.HRotate(h, x,y, Winkel)
    return()
    
vs.ForEachObject(DoSomething, "SEL=TRUE")

Always most difficult to find the right script commands.

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.

Guest
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...