Example #1
0
        /// <summary>
        /// Read the next six tokens and parse them as a
        /// Bool6D's X, Y, Z, XX, YY and ZZ boolean values.
        /// The position of the reader will
        /// then move along to the next token after these, such that repeated calls
        /// to Next___() will return each token in sequence.
        /// </summary>
        /// <returns></returns>
        public Bool6D Next6AsBool6D(string trueString = "TRUE")
        {
            var result = Bool6D.FromTokensList(_Tokens, _Index, trueString);

            Index += 6;
            return(result);
        }
Example #2
0
 /// <summary>
 /// Convert a Bool6D to a GWA release description
 /// </summary>
 /// <returns></returns>
 public string ToReleaseString()
 {
     if (SourceObject is Bool6D)
     {
         Bool6D b6D = (Bool6D)SourceObject;
         return(b6D.ToString("R", "F"));
     }
     return("FFFFFF");
 }
Example #3
0
 /// <summary>
 /// Convert a fixity Bool6D to a Brief FE Constraint struct
 /// </summary>
 /// <param name="fixity"></param>
 /// <returns></returns>
 public static BFE.Constraint Convert(Bool6D fixity)
 {
     return(new BFE.Constraint(
                ToConstraint(fixity.X),
                ToConstraint(fixity.Y),
                ToConstraint(fixity.Z),
                ToConstraint(fixity.XX),
                ToConstraint(fixity.YY),
                ToConstraint(fixity.ZZ)));
 }
Example #4
0
 /// <summary>
 /// Reset this particle to its initial position
 /// </summary>
 public void Reset()
 {
     if (Node != null)
     {
         Position = Node.Position;
         Velocity = Vector.Zero;
         if (Node.HasData <NodeSupport>())
         {
             Fixity = Node.GetData <NodeSupport>().Fixity;
         }
         LumpedK = Vector.Zero;
         Mass    = 0;
     }
 }
 protected override void CollectVolatileData_Custom()
 {
     this.m_data.Clear();
     List <GH_ValueListItem> .Enumerator enumerator = this.SelectedItems.GetEnumerator();
     try
     {
         Bool6D result = new Bool6D();
         while (enumerator.MoveNext())
         {
             GH_ValueListItem item  = enumerator.Current;
             Direction        value = (Direction)Enum.Parse(typeof(Direction), item.Expression);
             result = result.With(value, true);
         }
         this.m_data.Append(new Bool6DGoo(result), new GH_Path(0));
     }
     finally
     {
         ((System.IDisposable)enumerator).Dispose();
     }
 }
Example #6
0
 /// <summary>
 /// Initialise a new vertex releases component with the specified
 /// releases and stiffnesses.  Note that the stiffness values will
 /// typically be ignored in directions which are not also released.
 /// </summary>
 /// <param name="releases"></param>
 /// <param name="stiffness"></param>
 public VertexReleases(Bool6D releases, SixVector stiffness) : this(releases)
 {
     _Stiffness = stiffness;
 }
Example #7
0
 /// <summary>
 /// Initialise a new node support with the fixed dimensions specified
 /// </summary>
 /// <param name="fixity"></param>
 public NodeSupport(Bool6D fixity) : base()
 {
     _Fixity = fixity;
 }
Example #8
0
 /// <summary>
 /// Initialise a new vertex releases component with the specified
 /// translational and rotational releases
 /// </summary>
 /// <param name="releases"></param>
 public VertexReleases(Bool6D releases)
 {
     _Releases = releases;
 }
Example #9
0
 /// <summary>
 /// Initialise a new node support with the specified fixed dimensions in the specified
 /// coordinate system.
 /// </summary>
 /// <param name="fixity"></param>
 /// <param name="axes"></param>
 public NodeSupport(Bool6D fixity, CoordinateSystemReference axes) : this(fixity)
 {
     Axes = axes;
 }
Example #10
0
 /// <summary>
 /// Initialise a new node support with the fixed dimensions specified
 /// and the given stiffnesses in the other directions
 /// </summary>
 /// <param name="fixity"></param>
 public NodeSupport(Bool6D fixity, SixVector stiffness) : this(fixity)
 {
     _Stiffness = stiffness;
 }
Example #11
0
 public override bool Execute(ExecutionInfo exInfo = null)
 {
     Bool6D = new Bool6D(X, Y, Z, XX, YY, ZZ);
     return(true);
 }
Example #12
0
        /// <summary>
        /// Update the properties of a Nucleus node from a GWA string
        /// in NODE.2 version syntax
        /// </summary>
        /// <param name="node"></param>
        /// <param name="gwa"></param>
        public void ReadNode(string gwa, Model.Model model, GSAConversionContext context)
        {
            // NODE.2 | num | name | colour | x | y | z |
            // is_grid { | grid_plane | datum | grid_line_a | grid_line_b } | axis |
            // is_rest { | rx | ry | rz | rxx | ryy | rzz } |
            // is_stiff { | Kx | Ky | Kz | Kxx | Kyy | Kzz } |
            // is_mesh { | edge_length | radius | tie_to_mesh | column_rigidity | column_prop | column_node | column_angle | column_factor | column_slab_factor }

            var tr = new TokenReader(gwa);

            tr.Next();                            // NODE
            string gsaID = tr.Next();             // num

            string name = tr.Next();              // name

            tr.Next();                            // colour
            Vector position = tr.Next3AsVector(); // x | y | z

            var node = context.IDMap.GetModelObject <Node>(model, gsaID);

            if (node == null)
            {
                node = model.Create.Node(position);
            }
            else
            {
                node.Position = position;
            }

            node.Name = name;

            if (tr.NextIs("GRID"))
            {
                tr.Skip(4); // is_grid { | grid_plane | datum | grid_line_a | grid_line_b }
            }
            tr.Next();      // axis !!!TODO!!!
            Bool6D fixity = new Bool6D();

            if (tr.NextIs("REST")) // is_rest
            {
                fixity = tr.Next6AsBool6D("1");
            }
            SixVector stiffness = null;

            if (tr.NextIs("STIFF")) // is_stiff
            {
                stiffness = tr.Next6AsSixVector();
            }
            if (!fixity.AllFalse || (stiffness != null && !stiffness.IsZero()))
            {
                var nodeSupport = new NodeSupport(fixity);
                if (stiffness != null)
                {
                    nodeSupport.Stiffness = stiffness;
                }
                //TODO: Axis
                node.SetData(nodeSupport);
            }
            else
            {
                node.Data.RemoveData <NodeSupport>(); //Clear restraints on existing nodes
            }
            context.IDMap.Add(node, gsaID);
        }
Example #13
0
        /// <summary>
        /// Update the properties of a Nucleus node from a GWA string
        /// in EL.2 version syntax
        /// </summary>
        /// <param name="element"></param>
        /// <param name="gwa"></param>
        public void ReadElement(string gwa, Model.Model model, GSAConversionContext context)
        {
            // EL.2 | num | name | colour | type | prop | group | topo() | orient_node | orient_angle |
            // is_rls { | rls { | k } }
            // is_offset { | ox | oy | oz } | dummy

            Element element;

            var tr = new TokenReader(gwa);

            tr.Next();                                 // EL
            string gsaID = tr.Next();                  // num
            string name  = tr.Next();                  // name

            tr.Next();                                 // colour
            int    nodeCount = NodeCountOf(tr.Next()); // type
            string propID    = tr.Next();              // prop

            tr.NextInt();                              // group
            if (nodeCount == 0)
            {
                return;                 //Not valid!
            }
            else if (nodeCount == 2)
            {
                // Linear element
                var linEl = context.IDMap.GetModelObject <LinearElement>(model, gsaID.ToString());
                if (linEl == null)
                {
                    linEl = model.Create.LinearElement(null);
                }
                element = linEl;
                var family = context.IDMap.GetModelObject <SectionFamily>(model, propID);
                if (family == null)
                {
                    family = model.Create.SectionFamily();
                    context.IDMap.Add(family, propID);
                }
                linEl.Family = family;
                Node n0 = context.IDMap.GetModelObject <Node>(model, tr.Next()); // Start node
                Node n1 = context.IDMap.GetModelObject <Node>(model, tr.Next()); // End node
                linEl.Geometry = new Line(n0, n1);
            }
            else
            {
                //Panel element
                var panEl = context.IDMap.GetModelObject <PanelElement>(model, gsaID.ToString());
                if (panEl == null)
                {
                    panEl = model.Create.PanelElement(null);
                }
                element = panEl;
                var family = context.IDMap.GetModelObject <BuildUpFamily>(model, propID);
                if (family == null)
                {
                    family = model.Create.BuildUpFamily();
                    context.IDMap.Add(family, propID);
                }
                panEl.Family = family;
                var nodes = new NodeCollection();
                for (int i = 0; i < nodeCount; i++)
                {
                    var node = context.IDMap.GetModelObject <Node>(model, tr.Next());
                    if (node != null && !nodes.Contains(node.GUID))
                    {
                        nodes.Add(node);
                    }
                }
                panEl.Geometry = new Mesh(nodes, true);
            }
            tr.Next(); // orient_node   TODO: Make orientation relative to this
            element.Orientation = Angle.FromDegrees(tr.NextDouble());
            var    verts  = element.ElementVertices;
            string is_rls = tr.Next(); // is_rls

            if (is_rls.EqualsIgnoreCase("RLS") || is_rls.EqualsIgnoreCase("STIFF"))
            {
                for (int i = 0; i < nodeCount; i++)
                {
                    string rls = tr.Next(); // rls
                    if (i < verts.Count)
                    {
                        Bool6D        fixity = Bool6D.FromTokensList(rls.ToCharArray(), 0, 'R');
                        ElementVertex v      = verts[i];
                        v.Releases = fixity;

                        if (is_rls.EqualsIgnoreCase("STIFF"))
                        {
                            for (int j = 0; j < rls.Length; j++)
                            {
                                char c = rls[j];
                                if (c.EqualsIgnoreCase('K'))
                                {
                                    v.Stiffness = v.Stiffness.With(j, tr.NextDouble()); // k
                                }
                            }
                        }
                    }
                }
            }
            if (tr.NextIs("OFFSET")) // is_offset
            {
                for (int i = 0; i < nodeCount; i++)
                {
                    if (verts.Count > i)
                    {
                        var vert = verts[i];
                        vert.Offset = vert.Offset.WithX(tr.NextDouble()); // ox
                        vert.Offset = vert.Offset.WithY(tr.NextDouble()); // oy
                        vert.Offset = vert.Offset.WithZ(tr.NextDouble()); // oz
                    }
                    else
                    {
                        tr.Skip(3);
                    }
                }
                //TODO: Local offsets
            }
            // TODO: Dummy?
            context.IDMap.Add(element, gsaID);
        }