private void OnDrawingPlaneDone(ConstructAction ca, bool success) { if (!success) { return; } frame.ShowPropertyDisplay("View"); if (propertyTreeView != null) { propertyTreeView.SelectEntry(this); } Plane pln = Plane.XYPlane; ConstructPlane cp = ca as ConstructPlane; if (ca is ConstructPlane) { pln = (ca as ConstructPlane).ConstructedPlane; } else if (ca is ConstructTangentialPlane) { pln = (ca as ConstructTangentialPlane).ConstructedPlane; } else { return; } try { if (!Precision.IsPerpendicular(projection.Direction, pln.Normal, false)) { projection.DrawingPlane = pln; } else { Frame.UIService.ShowMessageBox(StringTable.GetString("Error.DrawingPlane.Impossible"), StringTable.GetString("Errormessage.Title.InvalidInput"), MessageBoxButtons.OK); } } catch (ConstructPlane.ConstructPlaneException) { // hat aus irgend einem Grund nicht geklappt Frame.UIService.ShowMessageBox(StringTable.GetString("Error.DrawingPlane.Impossible"), StringTable.GetString("Errormessage.Title.InvalidInput"), MessageBoxButtons.OK); } planeOrigin.Refresh(); planeDirectionX.Refresh(); planeDirectionY.Refresh(); frame.ActiveView.InvalidateAll(); frame.SetControlCenterFocus("View", null, false, false); }
bool ICommandHandler.OnCommand(string MenuId) { switch (MenuId) { case "MenuId.DrawingPlane.StandardXY": if (!projection.Direction.IsPerpendicular(new GeoVector(0, 0, 1))) { projection.DrawingPlane = new Plane(Plane.StandardPlane.XYPlane, 0.0); } else { Frame.UIService.ShowMessageBox(StringTable.GetString("Error.DrawingPlane.Impossible"), StringTable.GetString("Errormessage.Title.InvalidInput"), MessageBoxButtons.OK); } return(true); case "MenuId.DrawingPlane.StandardXY.Offset": if (!projection.Direction.IsPerpendicular(new GeoVector(0, 0, 1))) { ConstrDrawingPlaneOffset cdpo = new Actions.ConstrDrawingPlaneOffset(new Plane(Plane.StandardPlane.XYPlane, 0.0), projection); cdpo.ActionDoneEvent += new CADability.Actions.ConstructAction.ActionDoneDelegate(OnDrawingPlaneDone); frame.SetAction(cdpo); } else { Frame.UIService.ShowMessageBox(StringTable.GetString("Error.DrawingPlane.Impossible"), StringTable.GetString("Errormessage.Title.InvalidInput"), MessageBoxButtons.OK); } return(true); case "MenuId.DrawingPlane.StandardXZ": if (!projection.Direction.IsPerpendicular(new GeoVector(0, 1, 0))) { projection.DrawingPlane = new Plane(Plane.StandardPlane.XZPlane, 0.0); } else { Frame.UIService.ShowMessageBox(StringTable.GetString("Error.DrawingPlane.Impossible"), StringTable.GetString("Errormessage.Title.InvalidInput"), MessageBoxButtons.OK); } return(true); case "MenuId.DrawingPlane.StandardXZ.Offset": if (!projection.Direction.IsPerpendicular(new GeoVector(0, 1, 0))) { ConstrDrawingPlaneOffset cdpo = new Actions.ConstrDrawingPlaneOffset(new Plane(Plane.StandardPlane.XZPlane, 0.0), projection); cdpo.ActionDoneEvent += new CADability.Actions.ConstructAction.ActionDoneDelegate(OnDrawingPlaneDone); frame.SetAction(cdpo); } else { Frame.UIService.ShowMessageBox(StringTable.GetString("Error.DrawingPlane.Impossible"), StringTable.GetString("Errormessage.Title.InvalidInput"), MessageBoxButtons.OK); } return(true); case "MenuId.DrawingPlane.StandardYZ": if (!projection.Direction.IsPerpendicular(new GeoVector(1, 0, 0))) { projection.DrawingPlane = new Plane(Plane.StandardPlane.YZPlane, 0.0); } else { Frame.UIService.ShowMessageBox(StringTable.GetString("Error.DrawingPlane.Impossible"), StringTable.GetString("Errormessage.Title.InvalidInput"), MessageBoxButtons.OK); } return(true); case "MenuId.DrawingPlane.StandardYZ.Offset": if (!projection.Direction.IsPerpendicular(new GeoVector(1, 0, 0))) { ConstrDrawingPlaneOffset cdpo = new Actions.ConstrDrawingPlaneOffset(new Plane(Plane.StandardPlane.YZPlane, 0.0), projection); cdpo.ActionDoneEvent += new CADability.Actions.ConstructAction.ActionDoneDelegate(OnDrawingPlaneDone); frame.SetAction(cdpo); } else { Frame.UIService.ShowMessageBox(StringTable.GetString("Error.DrawingPlane.Impossible"), StringTable.GetString("Errormessage.Title.InvalidInput"), MessageBoxButtons.OK); } return(true); case "MenuId.DrawingPlane.Three.Points": ConstructPlane cp = new ConstructPlane("Construct.DrawingPlane"); cp.ActionDoneEvent += new CADability.Actions.ConstructAction.ActionDoneDelegate(OnDrawingPlaneDone); frame.SetAction(cp); frame.ShowPropertyDisplay("Action"); return(true); case "MenuId.DrawingPlane.Tangential": ConstructTangentialPlane ct = new ConstructTangentialPlane("Construct.DrawingPlane"); ct.ActionDoneEvent += new CADability.Actions.ConstructAction.ActionDoneDelegate(OnDrawingPlaneDone); frame.SetAction(ct); frame.ShowPropertyDisplay("Action"); return(true); case "MenuId.DrawingPlane.Show": projection.ShowDrawingPlane = !projection.ShowDrawingPlane; frame.ActiveView.InvalidateAll(); return(true); } ICommandHandler ch = frame as ICommandHandler; // das sollte immer klappen if (ch != null) { return(ch.OnCommand(MenuId)); } return(false); }