Example #1
0
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            GH_String level = new GH_String("none");
            GH_String family = new GH_String("none");
            GH_String type = new GH_String("none");
            GH_Point topPoint = new GH_Point();
            GH_Point bottomPoint = new GH_Point();
            GH_String gid = new GH_String("");
            List<Parameter> parameters = new List<Parameter>();
            if (!DA.GetDataList<Parameter>("Parameters", parameters)) parameters = new List<Parameter>();



            DA.GetData<GH_String>("Family", ref family);
            DA.GetData<GH_String>("Type", ref type);
            DA.GetData<GH_String>("Level", ref level);
            DA.GetData<GH_Point>("PointTop", ref topPoint);
            DA.GetData<GH_Point>("PointBottom", ref bottomPoint);
            DA.GetData<GH_String>("GID", ref gid);

            Column column = new Column(family.Value,type.Value,parameters, topPoint.ToGrevitPoint(), bottomPoint.ToGrevitPoint(),level.Value,true);


            SetGID(column);

            Rhino.Geometry.Circle circle = new Rhino.Geometry.Circle(bottomPoint.Value,0.5);
  
            Rhino.Geometry.Surface srf = Rhino.Geometry.NurbsSurface.CreateExtrusion(circle.ToNurbsCurve(), new Rhino.Geometry.Vector3d(new Rhino.Geometry.Point3d(topPoint.Value.X-bottomPoint.Value.X,topPoint.Value.Y-bottomPoint.Value.Y,topPoint.Value.Z-bottomPoint.Value.Z)));

            SetPreview(column.GID, srf.ToBrep());

            DA.SetData("GrevitComponent", column);
        }
Example #2
0
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            GH_String style = new GH_String("");
            GH_String layer = new GH_String("");
            GH_Point stop = new GH_Point();
            GH_Point sbtm = new GH_Point();
            List<Parameter> param = new List<Parameter>();
            if (!DA.GetDataList<Parameter>("Parameters", param)) param = new List<Parameter>();

            DA.GetData<GH_String>("Style", ref style);
            DA.GetData<GH_String>("Layer", ref layer);

            DA.GetData<GH_Point>("PointTop", ref stop);
            DA.GetData<GH_Point>("PointBottom", ref sbtm);

            Column s = new Column(style.Value,layer.Value,param,sbtm.ToGrevitPoint(),stop.ToGrevitPoint(),"",true );
            SetGID(s);

            Rhino.Geometry.Circle c = new Rhino.Geometry.Circle(sbtm.Value, 0.5);
            Rhino.Geometry.Surface srf = Rhino.Geometry.NurbsSurface.CreateExtrusion(c.ToNurbsCurve(), new Rhino.Geometry.Vector3d(new Rhino.Geometry.Point3d(stop.Value.X - sbtm.Value.X, stop.Value.Y - sbtm.Value.Y, stop.Value.Z - sbtm.Value.Z)));
            SetPreview(s.GID, srf.ToBrep());
            DA.SetData("GrevitComponent", s);
        }