示例#1
0
        internal static Point3d GetWallTagPosition(string idOrder, StbWallOffset[] offsets, IEnumerable <StbNode> nodes)
        {
            string[] nodeIds = idOrder.Split(' ');
            var      pts     = new Point3d[nodeIds.Length];

            for (int i = 0; i < nodeIds.Length; i++)
            {
                string  nodeId    = nodeIds[i];
                StbNode node      = nodes.First(n => n.id == nodeId);
                var     offsetVec = new Vector3d();
                if (offsets != null)
                {
                    foreach (var offset in offsets.Where(offset => nodeId == offset.id_node))
                    {
                        offsetVec = new Vector3d(offset.offset_X, offset.offset_Y, offset.offset_Z);
                    }
                }
                pts[i] = new Point3d(node.X, node.Y, node.Z) + offsetVec;
            }

            return(new Point3d(pts.Average(n => n.X), pts.Average(n => n.Y), pts.Average(n => n.Z)));
        }