protected override void SolveInstance(IGH_DataAccess DA) { // get input FemDesign.Sections.SectionDatabase sectionDatabase = null; string sectionName = null; if (!DA.GetData(0, ref sectionDatabase)) { return; } if (!DA.GetData(1, ref sectionName)) { return; } if (sectionDatabase == null || sectionName == null) { return; } // FemDesign.Sections.Section section = sectionDatabase.SectionByName(sectionName); // set output DA.SetData(0, section); }
public static Dictionary <string, object> SectionDeconstruct(FemDesign.Sections.Section section) { return(new Dictionary <string, object> { { "Guid", section.Guid }, { "Name", section.Name }, { "Surfaces", section.RegionGroup.ToDynamo() }, { "SectionType", section.Type }, { "MaterialType", section.MaterialType }, { "GroupName", section.GroupName }, { "TypeName", section.TypeName }, { "SizeName", section.SizeName } }); }
protected override void SolveInstance(IGH_DataAccess DA) { FemDesign.Sections.Section obj = null; if (!DA.GetData(0, ref obj)) { return; } DA.SetData(0, obj.Guid); DA.SetData(1, obj.Name); DA.SetDataList(2, obj.RegionGroup.ToRhino()); DA.SetData(3, obj.Type); DA.SetData(4, obj.MaterialType); DA.SetData(5, obj.GroupName); DA.SetData(6, obj.TypeName); DA.SetData(7, obj.SizeName); }
protected override void SolveInstance(IGH_DataAccess DA) { // get input Curve curve = null; if (!DA.GetData(0, ref curve)) { return; } FemDesign.Materials.Material material = null; if (!DA.GetData(1, ref material)) { material = FemDesign.Materials.MaterialDatabase.GetDefault().MaterialByName("C30/37"); } FemDesign.Sections.Section section = null; if (!DA.GetData(2, ref section)) { section = FemDesign.Sections.SectionDatabase.GetDefault().SectionByName("Concrete sections, Rectangle, 250x600"); } Vector3d v = Vector3d.Zero; if (!DA.GetData(3, ref v)) { // pass } bool orientLCS = true; if (!DA.GetData(4, ref orientLCS)) { // pass } string identifier = "T"; if (!DA.GetData(5, ref identifier)) { // pass } // convert geometry if (curve.GetType() != typeof(LineCurve)) { throw new System.ArgumentException("Curve must be a LineCurve"); } FemDesign.Geometry.Edge edge = Convert.FromRhinoLineCurve((LineCurve)curve); // bar var type = FemDesign.Bars.BarType.Truss; FemDesign.Bars.Bar bar = new FemDesign.Bars.Bar(edge, type, material, section, identifier); // set local y-axis if (!v.Equals(Vector3d.Zero)) { bar.BarPart.LocalY = v.FromRhino(); } // else orient coordinate system to GCS else { if (orientLCS) { bar.BarPart.OrientCoordinateSystemToGCS(); } } // return DA.SetData(0, bar); }
protected override void SolveInstance(IGH_DataAccess DA) { // get input Curve curve = null; if (!DA.GetData(0, ref curve)) { return; } FemDesign.Materials.Material material = null; if (!DA.GetData(1, ref material)) { return; } FemDesign.Sections.Section section = null; if (!DA.GetData(2, ref section)) { return; } double maxCompression = 0; if (!DA.GetData(3, ref maxCompression)) { return; } bool compressionPlasticity = false; if (!DA.GetData(4, ref compressionPlasticity)) { return; } double maxTension = 0; if (!DA.GetData(5, ref maxTension)) { return; } bool tensionPlasticity = false; if (!DA.GetData(6, ref tensionPlasticity)) { return; } Vector3d v = Vector3d.Zero; if (!DA.GetData(7, ref v)) { // pass } bool orientLCS = true; if (!DA.GetData(8, ref orientLCS)) { // pass } string identifier = "T"; if (!DA.GetData(9, ref identifier)) { // pass } if (curve == null || material == null || section == null || identifier == null) { return; } // convert geometry if (curve.GetType() != typeof(LineCurve)) { throw new System.ArgumentException("Curve must be a LineCurve"); } FemDesign.Geometry.Edge edge = Convert.FromRhinoLineCurve((LineCurve)curve); // bar var type = FemDesign.Bars.BarType.Truss; FemDesign.Bars.Bar bar = new FemDesign.Bars.Bar(edge, type, material, section, identifier); bar.MaxCompression = maxCompression; bar.MaxTension = maxTension; bar.CompressionPlasticity = compressionPlasticity; bar.TensionPlasticity = tensionPlasticity; // set local y-axis if (!v.Equals(Vector3d.Zero)) { bar.BarPart.LocalY = v.FromRhino(); } // else orient coordinate system to GCS else { if (orientLCS) { bar.BarPart.OrientCoordinateSystemToGCS(); } } // return DA.SetData(0, bar); }
protected override void SolveInstance(IGH_DataAccess DA) { // get input Curve curve = null; if (!DA.GetData(0, ref curve)) { return; } FemDesign.Materials.Material material = null; if (!DA.GetData(1, ref material)) { return; } FemDesign.Sections.Section section = null; if (!DA.GetData(2, ref section)) { return; } FemDesign.Bars.Connectivity connectivity = FemDesign.Bars.Connectivity.GetRigid(); if (!DA.GetData(3, ref connectivity)) { // pass } FemDesign.Bars.Eccentricity eccentricity = FemDesign.Bars.Eccentricity.GetDefault(); if (!DA.GetData(4, ref eccentricity)) { // pass } Vector3d v = Vector3d.Zero; if (!DA.GetData(5, ref v)) { // pass } bool orientLCS = true; if (!DA.GetData(6, ref orientLCS)) { // pass } string identifier = "B"; if (!DA.GetData(7, ref identifier)) { // pass } if (curve == null || material == null || section == null || connectivity == null || eccentricity == null || identifier == null) { return; } // convert geometry FemDesign.Geometry.Edge edge = curve.FromRhinoLineOrArc2(); // create bar var type = FemDesign.Bars.BarType.Beam; FemDesign.Bars.Bar bar = new FemDesign.Bars.Bar(edge, type, material, section, eccentricity, connectivity, identifier); // set local y-axis if (!v.Equals(Vector3d.Zero)) { bar.BarPart.LocalY = v.FromRhino(); } // else orient coordinate system to GCS else { if (orientLCS) { bar.BarPart.OrientCoordinateSystemToGCS(); } } // output DA.SetData(0, bar); }
protected override void SolveInstance(IGH_DataAccess DA) { // get input Brep surface = null; if (!DA.GetData(0, ref surface)) { return; } FemDesign.Materials.Material material = null; if (!DA.GetData(1, ref material)) { return; } FemDesign.Sections.Section section = null; if (!DA.GetData(2, ref section)) { return; } FemDesign.Shells.ShellEccentricity eccentricity = FemDesign.Shells.ShellEccentricity.GetDefault(); if (!DA.GetData(3, ref eccentricity)) { // pass } double orthoRatio = 1; if (!DA.GetData(4, ref orthoRatio)) { // pass } FemDesign.Shells.EdgeConnection edgeConnection = FemDesign.Shells.EdgeConnection.GetHinged(); if (!DA.GetData(5, ref edgeConnection)) { // pass } Rhino.Geometry.Vector3d x = Vector3d.Zero; if (!DA.GetData(6, ref x)) { // pass } Rhino.Geometry.Vector3d z = Vector3d.Zero; if (!DA.GetData(7, ref z)) { // pass } double meshSize = 0; if (!DA.GetData(8, ref meshSize)) { // pass } string identifier = "PP"; if (!DA.GetData(9, ref identifier)) { // pass } if (surface == null || material == null || section == null || eccentricity == null || edgeConnection == null || identifier == null) { return; } FemDesign.Geometry.Region region = surface.FromRhino(); // FemDesign.Shells.Panel obj = FemDesign.Shells.Panel.DefaultContreteContinuous(region, edgeConnection, material, section, identifier, orthoRatio, eccentricity); // set local x-axis if (!x.Equals(Vector3d.Zero)) { obj.LocalX = x.FromRhino(); } // set local z-axis if (!z.Equals(Vector3d.Zero)) { obj.LocalZ = z.FromRhino(); } // set uniform average mesh size obj.UniformAvgMeshSize = meshSize; // return DA.SetData(0, obj); }
protected override void SolveInstance(IGH_DataAccess DA) { List <Rhino.Geometry.Brep> breps = new List <Rhino.Geometry.Brep>(); if (!DA.GetDataList(0, breps)) { return; } string name = null; if (!DA.GetData(1, ref name)) { return; } string matType = null; if (!DA.GetData(2, ref matType)) { return; } string groupName = null; if (!DA.GetData(3, ref groupName)) { return; } string typeName = null; if (!DA.GetData(4, ref typeName)) { return; } string sizeName = null; if (!DA.GetData(5, ref sizeName)) { return; } if (name == null || matType == null || groupName == null || typeName == null || sizeName == null) { return; } // convert geometry List <FemDesign.Geometry.Region> regions = new List <FemDesign.Geometry.Region>(); foreach (Rhino.Geometry.Brep brep in breps) { regions.Add(brep.FromRhino()); } // create region group FemDesign.Geometry.RegionGroup regionGroup = new FemDesign.Geometry.RegionGroup(regions); // get mat type FemDesign.Materials.MaterialTypeEnum matTypeEnum = (FemDesign.Materials.MaterialTypeEnum)Enum.Parse(typeof(FemDesign.Materials.MaterialTypeEnum), matType); // create section FemDesign.Sections.Section section = new FemDesign.Sections.Section(regionGroup, name, "custom", matTypeEnum, groupName, typeName, sizeName); // return DA.SetData(0, section); }