Exemplo n.º 1
0
 public override bool Execute(ExecutionInfo exInfo = null)
 {
     if (Nodes.Count > 0)
     {
         NodeSupport support = new NodeSupport(Fixity);
         foreach (Node node in Nodes)
         {
             node.SetData(support);
         }
     }
     return(true);
 }
Exemplo n.º 2
0
        /// <summary>
        /// Convert RobotNodeSupportData to a Nucleus node support
        /// </summary>
        /// <param name="support"></param>
        /// <returns></returns>
        public static NodeSupport Convert(RobotNodeSupportData support)
        {
            var result = new NodeSupport(
                new Base.Bool6D(support.UX != 0, support.UY != 0, support.UZ != 0,
                                support.RX != 0, support.RY != 0, support.RX != 0));

            if (support.Alpha != 0 || support.Beta != 0 || support.Gamma != 0)
            {
                // TODO
            }
            return(result);
        }
        public override IList <IAvatar> GenerateRepresentations(Node source)
        {
            List <IAvatar> result = new List <IAvatar>();

            if (source != null)
            {
                NodeSupport support = source.GetData <NodeSupport>();
                if (support != null && !support.Fixity.AllFalse)
                {
                    double      scale = 0.75;
                    IMeshAvatar mAv   = CreateMeshAvatar();
                    mAv.Builder.AddNodeSupport(source, support, scale);
                    mAv.Brush = new ColourBrush(new Colour(0.8f, 0.8f, 0.2f, 0f)); //TODO: Make customisable
                    mAv.FinalizeMesh();
                    result.Add(mAv);
                }
            }
            return(result);
        }
Exemplo n.º 4
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);
        }