Nico_be Posted October 26, 2020 Share Posted October 26, 2020 Hello, Here is a network to put random orientation to an object. It works fine for rectang, poly, symbols, groups, line..; but NOT for pluginObject like VBPlant. Where is my error?? Or is it a bug? In attachement the file (V 2020) with some example to try, change the criteria to select 'Visual Basic Plant" to try. Marionette rotation aléatoire.vwx 1 Quote Link to comment
PatW Posted October 26, 2020 Share Posted October 26, 2020 Try the node "Set Entity Matrix". Quote rotAng3D.SetDescription( "The rotation of the plane about the X, Y, and Z-axis in degrees" ) regards, Patrick Quote Link to comment
Nico_be Posted October 28, 2020 Author Share Posted October 28, 2020 Yes it works now for pliginobjects but not with other objets... Quote Link to comment
PatW Posted November 3, 2020 Share Posted November 3, 2020 (edited) Replace the MOve code by this. If it is a param obj it will use SetEntityMatrix. Quote #Modified April 2017 #Modified June 2020 #Modified Nov. 2020, PatW @Marionette.NodeDefinition class Params(metaclass = Marionette.OrderedClass): #APPEARANCE #Name this = Marionette.Node( 'Rotate' ) this.SetDescription('This node will rotate a 2D or 3D object around "pCent" if provided. If not provided the object will be rotated about its center') #Input Ports input = Marionette.PortIn( vs.Handle(0), 'hObj') input.SetDescription('The object to rotate') rVec = Marionette.PortIn( (0,0,0) , 'vAng') rVec.SetDescription('It could be a 3D vector / Point3 in the Input category. The components x, y, z of the vector are the rotation angles around X, Y and Z-axis. Angles are in radians') center = Marionette.PortIn( (None), 'pCent') center.SetDescription('The point to rotate about, optional') #OIP Controls #Output Ports output = Marionette.PortOut('hObj') output.SetDescription('The rotated object') #BEHAVIOR def RunNode(self): #inputs r = self.Params.rVec.value center = self.Params.center.value obj = self.Params.input.value #script path = vs.GetCustomObjectPath(obj) offset = (0,0,0) if center == None: center = vs.HCenter(obj) center = (center[0], center[1], 0) if path != vs.Handle(0): (ok, offset, rotationXAngle, rotationYAngle, rotationZAngle) = vs.GetEntityMatrix(obj) obj = path planar = Marionette.Is2DObject(obj) cx = center[0] - offset[0] cy = center[1] - offset[1] cz = center[2] - offset[2] if planar: vs.HRotate(obj, (cx, cy), r[2]) else: if vs.GetTypeN(obj) == 86: bool, offset, rotationXAngle, rotationYAngle, rotationZAngle = vs.GetEntityMatrix(obj) vs.SetEntityMatrix(obj, offset, r[0], r[1], r[2]) else: vs.Set3DRot(obj, r[0], r[1], r[2], cx, cy, cz) #outputs self.Params.output.value = obj Edited November 3, 2020 by PatW 1 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.