KingChaos Posted October 28, 2021 Share Posted October 28, 2021 (edited) Hi, I have to move some objects in an angle but i only got vectors, so i dont know how to calculate a vector out of an angle and there is only "vector to angle" node. MAybe someone has a reverse node or knows how this goes better with different nodes. I have a list of path extruded rectangles along lines, which generated out of a polyline (red). But the profile which is extruded allways is "placed" in the middle (center of bounding box) of my path extrude. But I need this extrudes BEHIND or INFRONT the line (The Profil has to be extruded in the edge of my ). So i thought i can read out a list of angles of the lines and use the "MOVE" node to move the Boxes half height and half width. But the node needs a vector not an angle. BR KC Extrusionsbauteil_Version_2.vwx Edited October 28, 2021 by KingChaos Quote Link to comment
KingChaos Posted October 28, 2021 Author Share Posted October 28, 2021 yeah offset the single lines half the objects width makes it. Quote Link to comment
KingChaos Posted October 28, 2021 Author Share Posted October 28, 2021 but it would be great to have some "vector to angle" node. Quote Link to comment
Letti R Posted November 1, 2021 Share Posted November 1, 2021 (edited) Hello, there is a VS Function that converts an angle into a vector. You can look it up here. With that Function you can write your own Marionette Node. In Python it could look something like this: @Marionette.NodeDefinition class Params(metaclass = Marionette.OrderedClass): #APPEARANCE #Name this = Marionette.Node( 'Angle to Vector' ) this.SetDescription( 'Converts an angle in degrees to a 2D vector' ) #Input Ports nAngle = Marionette.PortIn(0) nAngle.SetDescription( 'an angle in degrees' ) nLength = Marionette.PortIn(1) nLength.SetDescription( 'the length of the output vector' ) #OIP Controls #Output Ports v = Marionette.PortOut() v.SetDescription( 'a 2D vector' ) #BEHAVIOR def RunNode(self): #inputs nAngle = self.Params.nAngle.value nLength = self.Params.nLength.value #script v = vs.Ang2Vec(nAngle, nLength) #outputs self.Params.v.value = v But, as shown in the example below, in some cases the VS function returns realy small numbers instead of zeros. So i would recommend to round the returned values to a reasonable length. Edited November 1, 2021 by Letti R 1 Quote Link to comment
KingChaos Posted November 1, 2021 Author Share Posted November 1, 2021 Rounding mistake ist Think Quote Link to comment
Recommended Posts
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.