예제 #1
0
 /// <summary>
 /// Set EdgeConnection on all Edges in Region.
 /// </summary>
 public void SetEdgeConnections(Shells.EdgeConnection edgeConnection)
 {
     if (edgeConnection.Release)
     {
         foreach (Contour contour in this.Contours)
         {
             if (contour.Edges != null)
             {
                 int cInstance = 0;
                 foreach (Edge edge in contour.Edges)
                 {
                     cInstance++;
                     string name = "CE." + cInstance.ToString();
                     Shells.EdgeConnection ec = Shells.EdgeConnection.CopyExisting(edgeConnection, name);
                     edge.EdgeConnection = ec;
                 }
             }
             else
             {
                 throw new System.ArgumentException("No edges in contour!");
             }
         }
     }
     else
     {
         // don't modify edges if no releases on edgeConnection.
     }
 }
예제 #2
0
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            Releases.Motions                motions               = null;
            Releases.Rotations              rotations             = null;
            Releases.MotionsPlasticLimits   motionsPlasticLimit   = null;
            Releases.RotationsPlasticLimits rotationsPlasticLimit = null;
            string libraryName = null;

            if (!DA.GetData("Motions", ref motions))
            {
                return;
            }
            if (!DA.GetData("Rotations", ref rotations))
            {
                return;
            }
            if (motions == null || rotations == null)
            {
                return;
            }
            DA.GetData("Plastic Limits Forces Motions", ref motionsPlasticLimit);
            DA.GetData("Plastic Limits Moments Rotations", ref rotationsPlasticLimit);
            DA.GetData("LibraryName", ref libraryName);

            Shells.EdgeConnection edgeConnection = new Shells.EdgeConnection(motions, motionsPlasticLimit, rotations, rotationsPlasticLimit, libraryName);

            DA.SetData("EdgeConnection", edgeConnection);
        }
예제 #3
0
        /// <summary>
        /// Set EdgeConnection on Edge in region by index.
        /// </summary>
        public void SetEdgeConnection(Shells.EdgeConnection edgeConnection, int index)
        {
            int edgeIdx = 0;

            foreach (Contour contour in this.Contours)
            {
                if (contour.Edges != null)
                {
                    int cInstance = 0;
                    foreach (Edge edge in contour.Edges)
                    {
                        cInstance++;
                        if (index == edgeIdx)
                        {
                            if (!edgeConnection.Release)
                            {
                                edge.EdgeConnection = null;
                            }
                            else
                            {
                                string name = "CE." + cInstance.ToString();
                                Shells.EdgeConnection ec = Shells.EdgeConnection.CopyExisting(edgeConnection, name);
                                edge.EdgeConnection = ec;
                            }
                            return;
                        }
                        edgeIdx++;
                    }
                }
                else
                {
                    throw new System.ArgumentException("No edges in contour!");
                }
            }

            // edge not found
            throw new System.ArgumentException("Edge not found.");
        }
예제 #4
0
        /// <summary>
        /// Set EdgeConnection by indices.
        /// </summary>
        /// <param name="fictShell">Fictitious Shell</param>
        /// <param name="edgeConnection">EdgeConnection</param>
        /// <param name="indices">Index. List of items. Deconstruct fictitious shell to extract index for each respective edge.</param>
        /// <returns></returns>
        public static FictitiousShell UpdateEdgeConnection(FictitiousShell fictShell, Shells.EdgeConnection edgeConnection, List <int> indices)
        {
            // deep clone. downstreams objs will contain changes made in this method, upstream objs will not.
            // downstream and uppstream objs will share guid.
            FictitiousShell clone = fictShell.DeepClone();

            foreach (int index in indices)
            {
                if (index >= 0 & index < fictShell.Region.GetEdgeConnections().Count)
                {
                    // pass
                }
                else
                {
                    throw new System.ArgumentException("Index is out of bounds.");
                }

                //
                clone.Region.SetEdgeConnection(edgeConnection, index);
            }

            //
            return(clone);
        }
예제 #5
0
        public static FictitiousShell Define(Autodesk.DesignScript.Geometry.Surface surface, StiffnessMatrix4Type d, StiffnessMatrix4Type k, StiffnessMatrix2Type h, double density, double t1, double t2, double alpha1, double alpha2, bool ignoreInStImpCalc, [DefaultArgument("EdgeConnection.Default()")] Shells.EdgeConnection edgeConnection, [DefaultArgument("Autodesk.DesignScript.Geometry.Vector.ByCoordinates(0,0,0)")] Autodesk.DesignScript.Geometry.Vector localX, [DefaultArgument("Autodesk.DesignScript.Geometry.Vector.ByCoordinates(0,0,0)")] Autodesk.DesignScript.Geometry.Vector localZ, double avgSrfElemSize = 0, string identifier = "FS")
        {
            // convert geometry
            Geometry.Region     region = Geometry.Region.FromDynamo(surface);
            Geometry.FdVector3d x      = Geometry.FdVector3d.FromDynamo(localX);
            Geometry.FdVector3d z      = Geometry.FdVector3d.FromDynamo(localZ);

            // add edge connections to region
            region.SetEdgeConnections(edgeConnection);

            //
            FictitiousShell obj = new FictitiousShell(region, d, k, h, density, t1, t2, alpha1, alpha2, ignoreInStImpCalc, avgSrfElemSize, identifier);

            // set local x-axis
            if (!localX.Equals(Autodesk.DesignScript.Geometry.Vector.ByCoordinates(0, 0, 0)))
            {
                obj.LocalX = FemDesign.Geometry.FdVector3d.FromDynamo(localX);
            }

            // set local z-axis
            if (!localZ.Equals(Autodesk.DesignScript.Geometry.Vector.ByCoordinates(0, 0, 0)))
            {
                obj.LocalZ = FemDesign.Geometry.FdVector3d.FromDynamo(localZ);
            }

            // return
            return(obj);
        }
예제 #6
0
 public static FictitiousShell SetEdgeConnection(FictitiousShell fictShell, Shells.EdgeConnection edgeConnection, List <int> indices)
 {
     return(UpdateEdgeConnection(fictShell, edgeConnection, indices));
 }
예제 #7
0
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            // get input
            Brep surface = null;

            if (!DA.GetData("Surface", ref surface))
            {
                return;
            }

            Materials.TimberPanelType timberPlateMaterialData = null;
            if (!DA.GetData("TimberPlateMaterial", ref timberPlateMaterialData))
            {
                return;
            }

            Vector3d spanDirection = new Vector3d();

            if (!DA.GetData("SpanDirection", ref spanDirection))
            {
                return;
            }

            double panelWidth = 1.5;

            DA.GetData("PanelWidth", ref panelWidth);

            Shells.ShellEccentricity eccentricity = Shells.ShellEccentricity.GetDefault();
            DA.GetData("ShellEccentricity", ref eccentricity);

            Shells.EdgeConnection edgeConnection = Shells.EdgeConnection.GetHinged();
            DA.GetData("BorderEdgeConnection", ref edgeConnection);

            Rhino.Geometry.Vector3d x = Vector3d.Zero;
            DA.GetData("LocalX", ref x);

            Rhino.Geometry.Vector3d z = Vector3d.Zero;
            DA.GetData("LocalZ", ref z);

            double meshSize = 0;

            DA.GetData("AvgMeshSize", ref meshSize);

            string identifier = "PP";

            DA.GetData("Identifier", ref identifier);

            if (surface == null || timberPlateMaterialData == null || eccentricity == null || edgeConnection == null || identifier == null)
            {
                return;
            }


            Geometry.Region     region = surface.FromRhino();
            Geometry.FdVector3d dir    = spanDirection.FromRhino();
            Shells.Panel        obj    = Shells.Panel.DefaultTimberContinuous(region, timberPlateMaterialData, dir, edgeConnection, identifier, eccentricity, panelWidth);

            // 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);
        }
예제 #8
0
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            Rhino.Geometry.Brep brep = null;
            if (!DA.GetData(0, ref brep))
            {
                return;
            }

            ModellingTools.StiffnessMatrix4Type d = null;
            if (!DA.GetData(1, ref d))
            {
                return;
            }

            ModellingTools.StiffnessMatrix4Type k = null;
            if (!DA.GetData(2, ref k))
            {
                return;
            }

            ModellingTools.StiffnessMatrix2Type h = null;
            if (!DA.GetData(3, ref h))
            {
                return;
            }

            double density = 1;

            if (!DA.GetData(4, ref density))
            {
                // pass
            }

            double t1 = 0.1;

            if (!DA.GetData(5, ref t1))
            {
                // pass
            }

            double t2 = 0.1;

            if (!DA.GetData(6, ref t2))
            {
                // pass
            }

            double alpha1 = 0.00001;

            if (!DA.GetData(7, ref alpha1))
            {
                // pass
            }

            double alpha2 = 0.00001;

            if (!DA.GetData(8, ref alpha2))
            {
                // pass
            }

            bool ignore = false;

            if (!DA.GetData(9, ref ignore))
            {
                // pass
            }

            Shells.EdgeConnection edgeConnection = Shells.EdgeConnection.GetDefault();
            if (!DA.GetData(10, ref edgeConnection))
            {
                // pass
            }

            Rhino.Geometry.Vector3d x = Vector3d.Zero;
            if (!DA.GetData(11, ref x))
            {
                // pass
            }

            Rhino.Geometry.Vector3d z = Vector3d.Zero;
            if (!DA.GetData(12, ref z))
            {
                // pass
            }

            double mesh = 0;

            if (!DA.GetData(13, ref mesh))
            {
                // pass
            }

            string identifier = "FS";

            if (!DA.GetData(14, ref identifier))
            {
                // pass
            }

            // convert geometry
            Geometry.Region region = brep.FromRhino();

            // add edge connection
            region.SetEdgeConnections(edgeConnection);

            //
            ModellingTools.FictitiousShell obj = new ModellingTools.FictitiousShell(region, d, k, h, density, t1, t2, alpha1, alpha2, ignore, mesh, identifier);

            // 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();
            }

            // return
            DA.SetData(0, obj);
        }