예제 #1
0
        //static Plane CreatePlane(Point origin, Direction normal)
        //{
        //    return Plane.Create(Frame.Create(origin, normal));
        //}

        static DesignBody CreatePPBar(Part part)
        {
            Window window = Window.ActiveWindow;

            Debug.Assert(part != null, "part 1= null");

            double barRadius = 0.002;
            double barLenght = 0.020;

            Point pointStart = Point.Create(0, 0.03, 0.07);
            Point pointEnd   = Point.Create(0.02, 0.04, 0.09);

            DesignCurve.Create(part, CurveSegment.Create(pointStart, pointEnd));

            //Plane plane = CreatePlane(pointStart, normal);
            //DesignCurve line = DesignCurve.Create();
            //Direction direction = Direction.Equals(CurveSegment);
            //Frame frame = Frame.Create(pointStart);
            //Plane plane = Plane.Create(frame);


            Body bar = Body.ExtrudeProfile(new CircleProfile(Plane.PlaneYZ, barRadius), barLenght);

            return(DesignBody.Create(part, "Cylinder", bar));
        }
예제 #2
0
        public static DesignBody CreateBar(Part part)
        {
            Debug.Assert(part != null, "part != null");

            double barRadius = 0.002;
            double barLenght = 0.020;

            Point pointStart = Point.Create(0, 0, 0);
            Point pointEnd   = Point.Create(0, 0.04, 0.05);

            DesignCurve.Create(part, CurveSegment.Create(pointStart, pointEnd));

            Body cylinder1 = Body.ExtrudeProfile(new CircleProfile(Plane.PlaneZX, barRadius), barLenght);

            DesignBody.Create(part, "Cylinder1", cylinder1);


            Body cylinder2 = Body.ExtrudeProfile(new CircleProfile(Plane.PlaneXY, barRadius), barLenght);

            DesignBody.Create(part, "Cylinder2", cylinder2);


            Body cylinder3 = Body.ExtrudeProfile(new CircleProfile(Plane.PlaneYZ, barRadius), barLenght);

            return(DesignBody.Create(part, "Cylinder3", cylinder3));
        }
예제 #3
0
        static void CreateLine(Part line)
        {
            Window window     = Window.ActiveWindow;
            Point  pointStart = Point.Create(0.10, 0.04, 0.07);
            Point  pointEnd   = Point.Create(0.02, 0.11, 0.09);

            DesignCurve.Create(line, CurveSegment.Create(pointStart, pointEnd));
            MessageBox.Show($"Line between {pointStart} and {pointEnd} will be created", "Info");
        }
예제 #4
0
        static void CreatePoints(Part part)
        {
            Window window = Window.ActiveWindow;

            List <PointTarget> points = ImportingFun.LoadSampleData();

            foreach (var PointTarget in points)
            {
                //MessageBox.Show($"Line between {points[0]} and will be created");
                Point.Create(PointTarget.xPoint, PointTarget.yPoint, PointTarget.zPoint);
            }
        }
예제 #5
0
        static void CreateLines(Part multiLine)
        {
            Window window = Window.ActiveWindow;

            List <PointTarget> points = ImportingFun.LoadSampleData();

            foreach (var PointTarget in points)
            {
                //MessageBox.Show($"Line between {points[0]} and will be created");
                DesignCurve.Create(multiLine, CurveSegment.Create(Point.Create(PointTarget.xPoint, PointTarget.yPoint, PointTarget.zPoint), Point.Create(PointTarget.x2Point, PointTarget.y2Point, PointTarget.z2Point)));
            }
        }
예제 #6
0
        static void MultiBeamCreator(Part part)
        {
            try
            {
                //Document doc = Document.GetDocument(Settings.Default.ProjectPath + "/" + Settings.Default.ProjectName + ".scdoc");
                Document doc = Window.ActiveWindow.Document;
                Part     p   = doc.MainPart;

                int id = 0;
                List <PointLocation> pointLocations = CsvDataRead.ReadData();  // Get all beams out of file

                foreach (var location in pointLocations)
                {
                    Point startPoint = Point.Create(Double.Parse("" + (location.xPoint / 1000), new CultureInfo("de-DE")), Double.Parse("" + (location.yPoint / 1000), new CultureInfo("de-DE")), Double.Parse("" + (location.zPoint / 1000), new CultureInfo("de-DE")));
                    Point endPoint   = Point.Create(Double.Parse("" + (location.x2Point / 1000), new CultureInfo("de-DE")), Double.Parse("" + (location.y2Point / 1000), new CultureInfo("de-DE")), Double.Parse("" + (location.z2Point / 1000), new CultureInfo("de-DE")));
                    if (location.diameter != 0)
                    {
                        try
                        {
                            double diameter = location.diameter;
                            double radi     = Double.Parse("" + (location.diameter / 2000), new CultureInfo("de-DE"));

                            var lineSegment = CurveSegment.Create(startPoint, endPoint);
                            var designLine  = DesignCurve.Create(p, lineSegment);

                            Vector heightVector = endPoint - startPoint;
                            Frame  frame        = Frame.Create(startPoint, heightVector.Direction);
                            Plane  plane        = Plane.Create(frame);
                            var    profi        = new CircleProfile(plane, radi);

                            //var doc = DocumentHelper.GetActiveDocument();
                            //Document doc = Document.GetDocument(Path.GetDirectoryName("Document1"));
                            //Document doc = window.ActiveContext.Context.Document;


                            Part beamProfile = Part.CreateBeamProfile(doc, "Beam" + id, profi);

                            Beam.Create(beamProfile, designLine);
                            id += 1;
                        }
                        catch (Exception ex)
                        {
                            MessageBox.Show(ex.ToString(), "Info");
                        }
                    }
                }
            }
            catch (Exception exe)
            {
                MessageBox.Show(exe.ToString(), "Info");
            }
        }
예제 #7
0
        public static DesignBody CylinderPtPt(Part part)
        {
            Point  point1   = Point.Create(0.00, 0.01, 0.00);
            Point  point2   = Point.Create(0.03, 0.05, 0.04);
            double diameter = 0.004;
            double radi     = diameter / 2;

            Vector heightVector = point2 - point1;
            Frame  frame        = Frame.Create(point1, heightVector.Direction);
            Plane  plane        = Plane.Create(frame);


            Body cylinder4 = Body.ExtrudeProfile(new CircleProfile(plane, radi), heightVector.Magnitude);

            return(DesignBody.Create(part, "Cylinder3", cylinder4));
        }