private void AddFrameElementLoad(MeshBuilder bldr, FrameElement2Node elm, Point[] localPoints)
        {
            var n = SamplingCount;

            var diagramPoints     = new Point[n]; //Y=Fx or Fy or etc
            var baseDiagramPoints = new Point[n]; //Y=0



            #region calculating the graph nodes

            var delta = (elm.EndNode.Location - elm.StartNode.Location).Length / (SamplingCount - 1);

            var xs = Enumerable.Range(0, SamplingCount).Select(i => i * delta).ToList();

            var st = elm.StartNode.Location;


            for (var i = 0; i < n; i++)
            {
                var x           = delta * i;
                var localPoint  = localPoints[i];//new Vector(x, y*scale, z*scale);
                var globalPoint = st + elm.TransformLocalToGlobal((Vector)localPoint);

                var globalBase = st + elm.TransformLocalToGlobal(new Vector(x, 0, 0));

                diagramPoints[i]     = globalPoint;
                baseDiagramPoints[i] = globalBase;
            }


            #endregion

            for (var i = 0; i < n - 1; i++)
            {
                var p1 = baseDiagramPoints[i];
                var p2 = baseDiagramPoints[i + 1];
                var p3 = diagramPoints[i];
                var p4 = diagramPoints[i + 1];

                var p13d = new Point3D(p1.X, p1.Y, p1.Z);
                var p23d = new Point3D(p2.X, p2.Y, p2.Z);
                var p33d = new Point3D(p3.X, p3.Y, p3.Z);
                var p43d = new Point3D(p4.X, p4.Y, p4.Z);


                bldr.AddTriangle(p13d, p23d, p33d);
                bldr.AddTriangle(p33d, p23d, p43d);
            }
        }
        private void AddFrameElement(MeshBuilder bldr, FrameElement2Node elm)
        {
            PolygonYz section = null;

            var r = ElementVisualThickness / 2;


            if (elm.UseOverridedProperties)
            {
                section = new PolygonYz(
                    new PointYZ(-r, -r),
                    new PointYZ(-r, r),
                    new PointYZ(r, r),
                    new PointYZ(r, -r),
                    new PointYZ(-r, -r));
            }
            else
            {
                section = elm.Geometry;
            }


            for (var i = 0; i < section.Count - 1; i++)
            {
                var v1 = new Vector(0, section[i].Y, section[i].Z);
                var v2 = new Vector(0, section[i + 1].Y, section[i + 1].Z);

                var p1 = elm.StartNode.Location + elm.TransformLocalToGlobal(v1);
                var p2 = elm.StartNode.Location + elm.TransformLocalToGlobal(v2);

                var v = elm.EndNode.Location - elm.StartNode.Location;

                if (Math.Abs(v.Z) < 0.01)
                {
                    Guid.NewGuid();
                }

                var p3 = p1 + v;
                var p4 = p2 + v;

                var p13d = new Point3D(p1.X, p1.Y, p1.Z);
                var p23d = new Point3D(p2.X, p2.Y, p2.Z);
                var p33d = new Point3D(p3.X, p3.Y, p3.Z);
                var p43d = new Point3D(p4.X, p4.Y, p4.Z);

                bldr.AddTriangle(p13d, p33d, p23d);
                bldr.AddTriangle(p43d, p23d, p33d);
            }
        }