private void BeforeTransformObjects(object sender, RhinoTransformObjectsEventArgs e) { foreach (var item in e.Objects) { MainForm.AddChangedItem(item.Id.ToString()); } }
private void RhinoDoc_BeforeTransformObjects(object sender, RhinoTransformObjectsEventArgs e) { //dealing with Alt + Gumball drag duplicate action var isCopied = e.ObjectsWillBeCopied; if (isCopied) { this._isObjectCopied = isCopied; Rhino.RhinoApp.WriteLine($"{e.ObjectCount} will be copied: {e.ObjectsWillBeCopied}"); } else { } }
public void TransformUpdateState(RhinoTransformObjectsEventArgs ea) { bool sendBool = utils.properties.getPushState(); if (sendBool == false) { //Do nothing. } else if (sendBool == true) { //debug.alert("Tranformation event!"); //TODO: Reset document if artboard reference moves. string G00_Path = utils.file_structure.getPathFor("G00"); System.IO.File.WriteAllText(G00_Path, "3"); } }
private void RhinoDocOnBeforeTransformObjects(object sender, RhinoTransformObjectsEventArgs ea) { RhinoObject[] rhinoObjects = ea.Objects; Vector3d traslation; Transform transform; ea.Transform.DecomposeAffine(out transform, out traslation); transform = transform.Transpose(); for (int i = 0; i < rhinoObjects.Length; i++) { //Se il guid é presente nella lista allora fa parte delle jitter forme if (RigidBodyManager.GuidList.Contains(rhinoObjects[i].Id)) { int index = RigidBodyManager.GuidList.IndexOf(rhinoObjects[i].Id); //If it is a rigid transformation (so translation and rotation) if (ea.Transform.RigidType == TransformRigidType.Rigid) { //Rotate the body JMatrix rotation = RigidBodyManager.RigidBodies[index].Orientation * new JMatrix((float)transform.M00, (float)transform.M01, (float)transform.M02, (float)transform.M10, (float)transform.M11, (float)transform.M12, (float)transform.M20, (float)transform.M21, (float)transform.M22); RigidBodyManager.RigidBodies[index].Orientation = rotation; //Move the center of mass of Jitter shape on the center of the BBox of rhino shape Brep rhinoobj = (Brep)(ea.Objects[i].Geometry).Duplicate(); rhinoobj.Transform(ea.Transform); Point3d centerBbox = rhinoobj.GetBoundingBox(true).Center; RigidBodyManager.RigidBodies[index].Position = RigidBodyManager.Point3dtoJVector(centerBbox); //Find the difference between rhino bbx center and jitter bbox center JVector bboxjitter = RigidBodyManager.RigidBodies[index].BoundingBox.Center; JVector diff = bboxjitter - RigidBodyManager.Point3dtoJVector(centerBbox); //Align the center of both bboxes RigidBodyManager.RigidBodies[index].Position -= diff; } else { RhinoApp.WriteLine("You can't apply a non rigid transformation to a shape that has a rigid body property"); rigidTransf = false; } } } }
private void RhinoDocOnBeforeTransformObjects(object sender, RhinoTransformObjectsEventArgs ea) { RhinoApp.WriteLine("Transform Objects Count: {0}", ea.ObjectCount); }
/// <summary> /// Get current transform /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public void TryTraceTransform(object sender,RhinoTransformObjectsEventArgs e) { CurrentTransform = e.Transform; CurrentObj = RhinoDoc.ActiveDoc.Objects.GetSelectedObjects(true, true); // Is there a better way to select objects? (unable to select from e) }