public void setTunnelClosed() { Utils.SelectOne("选择巷道", (entity) => { if (entity is BaseTunnel) { BaseTunnel tunnel = entity as BaseTunnel; if (tunnel.Closed == false) { tunnel.SetClose(true); } else { tunnel.SetClose(false); } } }); }
//通过数据库对象修改cad对象 public void ToCADObject(BaseTunnel tunnel) { int segmentCount = this.BasePoints.Count; var dbVertices = this.BasePoints; List <Point3d> points3d = new List <Point3d>(); List <Handle> nodesHandle = new List <Handle>(); foreach (var dbVertice in dbVertices) { points3d.Add(new Point3d(dbVertice.X, dbVertice.Y, dbVertice.Z)); nodesHandle.Add(new Handle(dbVertice.NodeHandleValue)); } for (int i = 0; i < nodesHandle.Count; i++) { if (nodesHandle[i].Value == 0) //新产生的Node { Node node = new Node(); node.Position = points3d[i]; node.Location = this.Location; Utils.AppendEntity(node); node.AppendTunnel(tunnel.Handle, i); nodesHandle[i] = node.Handle; } else //之前的Node,改变索引 { Node node = Utils.GetEntityByHandle(nodesHandle[i]) as Node; if (node == null) { continue; } node.ChangeIndex(tunnel.Handle, i); } } if (this.Type == Tunnel_type_s || this.Type == Tunnel_type_t) { ((SquareTunnel)tunnel).Width_t = this.Width_t; ((SquareTunnel)tunnel).Width_b = this.Width_b; ((SquareTunnel)tunnel).Height = this.Height; } else if (this.Type == Tunnel_type_c) { ((CylinderTunnel)tunnel).Radius = this.Radius; } else { throw new System.Exception("类型错误"); } tunnel.TunnelType = this.Type; tunnel.BasePoints = points3d; tunnel.NodesHandle = nodesHandle; tunnel.Name = this.Name; tunnel.TagData = this.TagData; tunnel.Location = this.Location; tunnel.DisplayTag = this.DisplayTag; tunnel.Segment = this.Segment; tunnel.Temperatures = this.Temperatures; tunnel.Colors = this.Colors; tunnel.SetClose(this.IsClosed); }