Esempio n. 1
0
        protected override void OnUpdate(Command command)
        {
            Window window = Window.ActiveWindow;

            command.IsEnabled = window != null;
            command.IsChecked = window != null && window.ActiveTool is GyroidRelax;
        }
Esempio n. 2
0
        protected override void OnExecute(Command command, ExecutionContext context, System.Drawing.Rectangle buttonRect)
        {
            base.OnExecute(command, context, buttonRect);
            gyroid = new Gyroid(angleForce, vForce, uAngleForce, uTouchForce, averageVForce, averageTabAngleForce);
            Window window = Window.ActiveWindow;

            window.SetTool(new GyroidRelax(gyroid, this));
        }
Esempio n. 3
0
        protected override void OnExecute(Command command, ExecutionContext context, System.Drawing.Rectangle buttonRect)
        {
            Window activeWindow = Window.ActiveWindow;
            Part   part         = activeWindow.Scene as Part;

            gyroid.CreateSolid(part);

            activeWindow.SetProjection(Matrix.CreateMapping(Frame.Create(Point.Origin, -Direction.DirY, Direction.DirX)), true, true);
            activeWindow.ZoomExtents();
            activeWindow.InteractionMode = InteractionMode.Solid;

            Command.GetCommand("TangentEdge").IsEnabled = true;
            Command.GetCommand("SolidEdges").IsEnabled  = true;
            Command.GetCommand("TangentEdge").IsChecked = false;
            Command.GetCommand("SolidEdges").IsChecked  = false;
        }
Esempio n. 4
0
        protected override void OnExecute(Command command, ExecutionContext context, System.Drawing.Rectangle buttonRect)
        {
            const int count = 24;

            double p             = 0.5;
            double q             = 1;
            double circleAngle   = Math.PI / 2;
            Vector inverseOffset = Vector.Create(0.5, 0, 0);

            Part mainPart = Window.ActiveWindow.Scene as Part;

            Point[] baseCirclePoints = new Point[count];
            for (int i = 0; i < count; i++)
            {
                double  u       = (double)i / count * 2 * Math.PI;
                Point[] vPoints = new Point[3];
                for (int j = 0; j < 3; j++)
                {
                    vPoints[j] = Lawson.Evaluate(PointUV.Create((double)j / 3 * 2 * Math.PI, u), p, q, circleAngle, inverseOffset, true);
                    if (j == 0)
                    {
                        baseCirclePoints[i] = vPoints[j];
                    }
                }

                Circle circle = Circle.CreateThroughPoints(
                    Plane.Create(Frame.Create(vPoints[0], Vector.Cross(vPoints[1] - vPoints[0], vPoints[2] - vPoints[0]).Direction)),
                    vPoints[0], vPoints[1], vPoints[2]
                    );

                DesignCurve.Create(mainPart, CurveSegment.Create(circle));

                //ShapeHelper.CreateTorus(circle.Frame.Origin, circle.Frame.DirZ, circle.Radius * 2,
            }

            Circle baseCircle = Circle.CreateThroughPoints(
                Plane.Create(Frame.Create(baseCirclePoints[0], Vector.Cross(baseCirclePoints[1] - baseCirclePoints[0], baseCirclePoints[2] - baseCirclePoints[0]).Direction)),
                baseCirclePoints[0], baseCirclePoints[1], baseCirclePoints[2]
                );

            DesignCurve.Create(mainPart, CurveSegment.Create(baseCircle));
        }
Esempio n. 5
0
        protected override void OnExecute(Command command, ExecutionContext context, System.Drawing.Rectangle buttonRect)
        {
            bool whichX = quadrantString.Substring(0, 1) == "0" ? false : true;
            bool whichY = quadrantString.Substring(1, 1) == "0" ? false : true;
            bool whichZ = quadrantString.Substring(2, 1) == "0" ? false : true;

            Command.Execute("Select");
            List <IDocObject> iDesBodies = new List <IDocObject>();

            foreach (IDesignBody iDesBody in MainPart.GetDescendants <IDesignBody>())
            {
                Point p = iDesBody.Master.Shape.GetBoundingBox(Matrix.Identity).Center;

                if ((p.X > 0 ^ whichX) && (p.Y > 0 ^ whichY) && (p.Z > 0 ^ whichZ))
                {
                    iDesBodies.Add(iDesBody);
                }
            }

            ActiveWindow.ActiveContext.Selection = iDesBodies;
            Command.Execute("IntersectTool");
        }
Esempio n. 6
0
 protected override void OnExecute(Command command, ExecutionContext context, System.Drawing.Rectangle buttonRect)
 {
     UpdateProperties();
 }
Esempio n. 7
0
        protected override void OnExecute(Command command, ExecutionContext context, System.Drawing.Rectangle buttonRect)
        {
            Window window = Window.ActiveWindow;

            window.SetTool(new LawsonTool());
        }
 protected override void OnExecute(Command command, ExecutionContext context, System.Drawing.Rectangle buttonRect)
 {
     Window window = Window.ActiveWindow;
     window.SetTool(new BrowseTool());
 }
        protected override void OnExecute(Command command, ExecutionContext context, System.Drawing.Rectangle buttonRect)
        {
            bool whichX = quadrantString.Substring(0, 1) == "0" ? false : true;
            bool whichY = quadrantString.Substring(1, 1) == "0" ? false : true;
            bool whichZ = quadrantString.Substring(2, 1) == "0" ? false : true;

            Command.Execute("Select");
            List<IDocObject> iDesBodies = new List<IDocObject>();
            foreach (IDesignBody iDesBody in MainPart.GetDescendants<IDesignBody>()) {
                Point p = iDesBody.Master.Shape.GetBoundingBox(Matrix.Identity).Center;

                if ((p.X > 0 ^ whichX) && (p.Y > 0 ^ whichY) && (p.Z > 0 ^ whichZ))
                    iDesBodies.Add(iDesBody);
            }

            ActiveWindow.ActiveContext.Selection = iDesBodies;
            Command.Execute("IntersectTool");
        }