Beispiel #1
0
        //通过参数的方式生成圆柱形巷道
        static public List <DBTunnel> StaticDrawCylinderTunnel(List <DBTunnel> inList)
        {
            if (inList == null)
            {
                return(null);
            }

            List <DBTunnel> outList = new List <DBTunnel>();

            Document doc = Application.DocumentManager.MdiActiveDocument;
            Database db  = doc.Database;

            foreach (var v in inList)
            {
                if (v.HandleValue > 0)
                {
                    outList.Add(v);
                    continue;
                }
                Utils.TransactionControl(() =>
                {
                    List <Point3d> points = new List <Point3d>();
                    foreach (var point in v.BasePoints)
                    {
                        points.Add(new Point3d(
                                       point.X,
                                       point.Y,
                                       point.Z
                                       ));
                    }
                    CylinderTunnel tunnel = new CylinderTunnel();
                    tunnel.TunnelType     = DBTunnel.Tunnel_type_s;
                    tunnel.BasePoints     = points;
                    tunnel.Name           = (v.Name == null || v.Name == "") ? "巷道" : v.Name;
                    try
                    {
                        tunnel.Location = (v.Location != null && v.Location != "") ?
                                          v.Location : Project.Instance.getCurrentSurface(doc).Path;
                    }
                    catch (System.Exception) { }
                    Utils.AppendEntity(tunnel);
                    appendNode(tunnel);
                    appendTag(tunnel);

                    DBTunnel dbTunnel = new DBTunnel();
                    dbTunnel.SetProperty(tunnel);
                    tunnel.Dispose();
                    outList.Add(dbTunnel);
                });
            }
            return(outList);
        }
Beispiel #2
0
        private void UpdataDimension()
        {
            CylinderTunnel Tunnel = (CylinderTunnel)Entity;

            if (m_dims.Count <= mPromptCounter)
            {
                Dimension _dim = new AlignedDimension();
                _dim.SetDatabaseDefaults();
                m_dims.Add(new DynamicDimensionData(_dim, true, true));
                _dim.DynamicDimension = true;
            }

            AlignedDimension dim = (AlignedDimension)m_dims[mPromptCounter].Dimension;

            dim.XLine1Point  = Tunnel.BasePoints[mPromptCounter];
            dim.XLine2Point  = mPoints[mPromptCounter + 1];
            dim.DimLinePoint = Tunnel.BasePoints[mPromptCounter];
        }
Beispiel #3
0
        static public void DynamicDrawCylinderTunnel(DBTunnel inTunnel = null)
        {
            Document doc = Application.DocumentManager.MdiActiveDocument;
            Database db  = doc.Database;
            Editor   ed  = doc.Editor;

            //输入起点坐标
            PromptPointOptions opts = new PromptPointOptions("\nEnter Tunnel Start Point:");
            PromptPointResult  res  = ed.GetPoint(opts);

            if (res.Status == PromptStatus.Cancel)
            {
                return;
            }

            Point3d firstPoint = res.Value;

            //create Tunnel
            CylinderTunnelJig jig       = new CylinderTunnelJig(firstPoint);
            CylinderTunnel    tmpTunnel = (CylinderTunnel)jig.GetEntity();

            for (int i = 0; ; i++)
            {
                jig.setPromptCounter(i);
                PromptResult drag = ed.Drag(jig);
                if (drag.Status == PromptStatus.Cancel || drag.Status == PromptStatus.None)//画完了
                {
                    Utils.TransactionControl(() =>
                    {
                        List <Point3d> points = tmpTunnel.BasePoints;
                        points.RemoveAt(points.Count - 1);
                        if (points.Count < 2)
                        {
                            return;
                        }
                        CylinderTunnel tunnel = new CylinderTunnel();
                        tunnel.TunnelType     = DBTunnel.Tunnel_type_c;
                        tunnel.BasePoints     = points;
                        tunnel.Radius         = 10;
                        tunnel.Name           = "巷道";
                        try
                        {
                            tunnel.Location = Project.Instance.getCurrentSurface(doc).Path;
                        }
                        catch (System.Exception) { }

                        Utils.AppendEntity(tunnel);

                        appendNode(tunnel);
                        appendTag(tunnel);

                        tunnel.Dispose();
                        tmpTunnel.Dispose();
                    });
                    break;
                }
                else if (drag.Status == PromptStatus.OK)
                {
                }
            }
        }