コード例 #1
0
        /**
         * Does the computation
         */
        protected override void SolveRabbitInstance(IGH_DataAccess DA)
        {
            //GET THE INPUT PARAMS:
            Double defaultThickness = 1.0;

            DA.GetData <Double>(0, ref defaultThickness);

            Double defaultThicknessScale = 0.7;

            DA.GetData <Double>(1, ref defaultThicknessScale);//param index, variable

            //Curve defaultProfile = new Circle(5.0).ToNurbsCurve();
            Curve profile = null;

            DA.GetData <Curve>(2, ref profile);//param index, variable

            Plane profilePivot = Plane.Unset;

            DA.GetData <Plane>(3, ref profilePivot);//param index, variable

            //init the LoftSkeletonSettings object
            GH_TubeSettings settings = new GH_TubeSettings(defaultThickness, defaultThicknessScale, profile, profilePivot);

            //Set the resulting Graphics in the output:
            DA.SetData(0, settings);
        }
コード例 #2
0
        /**
         * Does the computation
         */
        protected override void SolveRabbitInstance(IGH_DataAccess DA)
        {
            //PARSE THE INPUT PARAMS:
            String sourceString = null;

            DA.GetData <String>(0, ref sourceString);//param index, place holder

            Double defaultStep = 0.0;

            DA.GetData <Double>(1, ref defaultStep);//param index, variable

            Double stepLengthScale = 0.0;

            DA.GetData <Double>(2, ref stepLengthScale);//param index, variable

            Double defaultAngleIncrement = 0.0;

            DA.GetData <Double>(3, ref defaultAngleIncrement);

            Double defaultAngleScale = 0.7;

            DA.GetData <Double>(4, ref defaultAngleScale);//param index, variable

            GH_Plane ghPlane = null;

            DA.GetData <GH_Plane>(5, ref ghPlane);//param index, variable
            Plane rhinoPlane = ghPlane.Value;


            //Loft settings
            Boolean loftSkeleton = false;

            GH_ObjectWrapper loftSkeletonSettingsWrapper = null;

            DA.GetData <GH_ObjectWrapper>(6, ref loftSkeletonSettingsWrapper);


            Double defaultThickness      = -1;
            Double defaultThicknessScale = -1;
            Curve  profile      = new Circle(5).ToNurbsCurve();
            Plane  profilePivot = Plane.Unset;

            if (loftSkeletonSettingsWrapper != null && loftSkeletonSettingsWrapper.Value != null)
            {
                loftSkeleton = true;
                GH_TubeSettings loftSkeletonSettings = (GH_TubeSettings)loftSkeletonSettingsWrapper.Value;

                defaultThickness      = loftSkeletonSettings.defaultThickness;
                defaultThicknessScale = loftSkeletonSettings.defaultThicknessScale;
                profile      = loftSkeletonSettings.profile;
                profilePivot = loftSkeletonSettings.profilePivot;
            }

            //clear the canvas
            canvas.Clear();

            Turtle3d Turtle = new Turtle3d(canvas, new Point3d(rhinoPlane.Origin.X, rhinoPlane.Origin.Y, rhinoPlane.Origin.Z), new Plane(rhinoPlane.Origin, rhinoPlane.XAxis, rhinoPlane.YAxis), defaultStep, stepLengthScale, defaultAngleIncrement, profile, profilePivot, defaultThickness, defaultThicknessScale, loftSkeleton);//clone the input variables, because they could have been modified in a previous solution
            //interpret the specified source string
            RLogoInterpreter rlogoInterpreter = new RLogoInterpreter(Turtle);

            rlogoInterpreter.Interpret(sourceString);

            if (loftSkeleton)
            {
                Brep[] breps = Turtle.LoftSkeleton();
                foreach (Brep brep in breps)
                {
                    canvas.AddGeometry(brep);
                }
            }

            Boolean showTurtlePositions = false;

            //Set the resulting Graphics in the output:
            DA.SetDataList(0, canvas.GetEdges());
            DA.SetDataList(1, canvas.GetVertices());
            DA.SetDataList(2, canvas.GetGeometry());
            if (showTurtlePositions)
            {
                DA.SetDataList(3, canvas.GetPlanes());
            }
            DA.SetDataList(4, canvas.GetProfiles());
            //DA.SetDataTree
        }