protected override void OnDragMove(System.Drawing.Point cursorPos, Line cursorRay) { //if (profile == null) // return; //Point point; //if (!profilePlane.TryIntersectLine(cursorRay, out point)) // return; // plane is side-on p += ((double)lastCursorPos.Value.X - cursorPos.X) * cursorScale; q += ((double)lastCursorPos.Value.Y - cursorPos.Y) * cursorScale; ////circleAngle += ((double)lastCursorPos.Value.X - cursorPos.X) * cursorScale; //inverseOffset = Vector.Create( // ((double)lastCursorPos.Value.X - cursorPos.X) * cursorScale, // ((double)lastCursorPos.Value.Y - cursorPos.Y) * cursorScale, // inverseOffset.Z //); lastCursorPos = cursorPos; circleAngle = Math.PI / 4; Rendering = Graphic.Create(null, null, LawsonToolGraphics.GetGraphic(p, q, circleAngle, inverseOffset)); // Rendering = Graphic.Create(null, null, Profile.GetGraphic(p, q, circleAngle, true, inverseOffset)); //Apply(String.Format("p:{0} q:{1} circleAngle:{2} inverseOffset:{3}", p, q, circleAngle, inverseOffset.ToString())); }
protected override bool OnMouseMove(System.Drawing.Point cursorPos, Line cursorRay, MouseButtons button) { #if false IDocObject preselection = InteractionContext.Preselection; DesignFace desFace = null; Profile existingProfile = Profile.GetWrapper(preselection as CustomObject); if (existingProfile != null) { desFace = existingProfile.Face; } if (desFace == null) { desFace = preselection as DesignFace; } if (desFace == null) // selection filtering is not applied if you (pre)select in the tree { return(false); } Face face = desFace.Shape; var plane = face.GetGeometry <Plane>(); Point point; if (!plane.TryIntersectLine(cursorRay, out point)) { return(false); // plane is side-on } Fin fin; double offset = GetOffset(face, plane, point, out fin); var style = new GraphicStyle { LineColor = Color.DodgerBlue, LineWidth = 3 }; Graphic datumGraphic = Graphic.Create(style, CurvePrimitive.Create(fin.Edge)); if (existingProfile != null) { Rendering = datumGraphic; } else { style = new GraphicStyle { LineColor = Color.Gray }; Rendering = Graphic.Create(style, null, Profile.GetGraphic(0.5, 1, Math.PI / 2, Vector.Create(0.5, 0, 0)), datumGraphic); } #endif return(false); // if we return true, the preselection won't update }
protected override void OnDragMove(System.Drawing.Point cursorPos, Line cursorRay) { //if (profile == null) // return; //Point point; //if (!profilePlane.TryIntersectLine(cursorRay, out point)) // return; // plane is side-on lastCursorPos = cursorPos; //for (int i = 0; i < 20; i++) // lawson.Iterate(); //Rendering = Graphic.Create(null, null, LawsonRelaxGraphics.GetGraphic(lawson)); //Apply(String.Format("Iteration {0}", lawson.Iteration)); }
// Line lastCursorRay; protected override bool OnDragStart(System.Drawing.Point cursorPos, Line cursorRay) { // profile = Profile.GetWrapper(InteractionContext.Preselection as CustomObject); //if (profile == null) // return; //Point? pointOnCustom = InteractionContext.PreselectionPoint; //if (pointOnCustom == null) { // profile = null; // return; //} lastCursorPos = cursorPos; StatusText = "Adjust."; return(false); }
protected override bool OnClickStart(System.Drawing.Point cursorPos, Line cursorRay) { #if false var desFace = InteractionContext.Preselection as DesignFace; if (desFace != null) { Face face = desFace.Shape; var plane = face.GetGeometry <Plane>(); Point point; if (!plane.TryIntersectLine(cursorRay, out point)) { return(false); // plane is side-on } #endif // WriteBlock.ExecuteTask("Create Profile", () => Profile.Create(p, q, circleAngle, inverseOffset)); return(false); }
protected override bool OnClickStart(System.Drawing.Point cursorPos, Line cursorRay) { string urlString = "URL"; IDocObject docObject = InteractionContext.Preselection; if (docObject == null) { return(false); } Document doc = docObject.Document; CustomProperty customProp; if (doc.CustomProperties.TryGetValue(urlString, out customProp)) { OpenURL(customProp.Value as string); } return(false); }