Ejemplo n.º 1
0
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            GH_Surface surface = new GH_Surface();
            GH_String level = new GH_String();
            GH_String family = new GH_String("");
            GH_String type = new GH_String("");

            GH_Boolean structural = new GH_Boolean(false); 
            GH_Number slope = new GH_Number(0.0);
            List<Parameter> parameters = new List<Parameter>();
            if (!DA.GetDataList<Parameter>("Parameters", parameters)) parameters = new List<Parameter>();
            DA.GetData<GH_Surface>("Surface", ref surface);

            GH_Point slopeTopPoint = new GH_Point(surface.Value.Edges[0].PointAtStart);
            GH_Point slopeBottomPoint = new GH_Point(surface.Value.Edges[0].PointAtEnd);

            //DA.GetData<GH_String>("Family", ref family);
            //DA.GetData<GH_String>("Type", ref type);
            DA.GetData<GH_String>("Levelbottom", ref level);
            DA.GetData<GH_Boolean>("Structural", ref structural);
            DA.GetData<GH_Point>("SlopeTopPoint", ref slopeTopPoint);
            DA.GetData<GH_Point>("SlopeBottomPoint", ref slopeBottomPoint);
            DA.GetData<GH_Number>("Slope", ref slope);

            

            Slab slab = new Slab();
            slab.FamilyOrStyle = family.Value;
            slab.TypeOrLayer = type.Value;
            slab.levelbottom = level.Value;
            slab.structural = structural.Value;
            slab.surface = new Profile();
            slab.surface.profile = new List<Loop>();
            
            Loop loop = new Loop();
            loop.outline = new List<Component>();

            foreach (Rhino.Geometry.BrepEdge be in surface.Value.Edges)
            {
                loop.outline.Add(be.ToNurbsCurve().ToGrevitCurve());
            }

            slab.surface.profile.Add(loop);

            slab.parameters = parameters;
            slab.top = slopeTopPoint.ToGrevitPoint();
            slab.bottom = slopeBottomPoint.ToGrevitPoint();
            slab.slope = slope.Value;
            slab.GID = this.InstanceGuid.ToString();



            DA.SetData("GrevitComponent", slab);
        }
Ejemplo n.º 2
0
        public static Grevit.Types.Profile ToGrevitProfile(this SketchUpNET.Surface surface, SketchUpNET.Transform t = null)
        {
            Types.Profile profile = new Types.Profile();
            profile.profile = new List<Loop>();

            Loop outerloop = new Loop();

            outerloop.outline = new List<Types.Component>();
            foreach (SketchUpNET.Edge corner in surface.OuterEdges.Edges)
                outerloop.outline.Add(corner.ToGrevitLine(t));

            profile.profile.Add(outerloop);


            foreach (SketchUpNET.Loop skploop in surface.InnerEdges)
            {
                Loop innerloop = new Loop();

                innerloop.outline = new List<Types.Component>();
                foreach (SketchUpNET.Edge corner in skploop.Edges)
                    innerloop.outline.Add(corner.ToGrevitLine(t));

                profile.profile.Add(innerloop);
            }

            return profile;
        }
Ejemplo n.º 3
0
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            GH_Surface surface = new GH_Surface();
            GH_String lvlbtm = new GH_String("");
            GH_String style = new GH_String("");
            GH_String layer = new GH_String("");
            GH_Number taperAng = new GH_Number(0);
            GH_Number height = new GH_Number();
            GH_Point stop = new GH_Point();
            GH_Point sbtm = new GH_Point();
            GH_Boolean structural = new GH_Boolean(true);
          
            List<Parameter> param = new List<Parameter>();
            if (!DA.GetDataList<Parameter>("Parameters", param)) param = new List<Parameter>();
            DA.GetData<GH_Surface>("Surface", ref surface);

            DA.GetData<GH_String>("Layer", ref layer);
            //DA.GetData<GH_String>("Style", ref style);
            DA.GetData<GH_Number>("taperAngle", ref taperAng);
            DA.GetData<GH_Number>("height", ref height);

            Slab s = new Slab();
            s.FamilyOrStyle = style.Value;
            s.TypeOrLayer = layer.Value;
            s.levelbottom = lvlbtm.Value;
            s.structural = structural.Value;
            s.surface = new Profile();
            s.surface.profile = new List<Loop>();
            Loop loop = new Loop() { outline = new List<Component>() };

            foreach (Rhino.Geometry.BrepEdge be in surface.Value.Edges)
            {
                loop.outline.Add(be.ToNurbsCurve().ToGrevitCurve());
            }
            s.surface.profile.Add(loop);


            s.height = height.Value;
            s.parameters = param;
            //s.top = ComponentUtilities.GHPoint2Point(stop);
            //s.bottom = ComponentUtilities.GHPoint2Point(sbtm);
            s.slope = taperAng.Value;
            s.GID = this.InstanceGuid.ToString();


            //SetPreview(s.GID, surface.Value);
            DA.SetData("GrevitComponent", s);
        }