示例#1
0
        transferPoints(string direction, string namePntFile, AeccSurveyDocument civDoc)
        {
            if (direction == "Export")
            {
                if (File.Exists(TempPntFile))
                {
                    File.Delete(TempPntFile);
                }

                AeccPointExportOptions pntExportOpts = new AeccPointExportOptions();
                pntExportOpts.AdjustElevation      = false;
                pntExportOpts.ExpandCoordinateData = false;
                pntExportOpts.TransformCoordinate  = false;
                pntExportOpts.UsePointGroup        = false;

                AeccPoints aeccPnts = civDoc.Points;
                aeccPnts.ExportPoints(TempPntFile, "PNEZD (comma delimited)", pntExportOpts);
            }
            else if (direction == "Import")
            {
                AeccPointImportOptions pntImportOpts = new AeccPointImportOptions();
                pntImportOpts.AdjustElevation          = false;
                pntImportOpts.ExpandCoordinateData     = false;
                pntImportOpts.PointDuplicateResolution = AeccPointDuplicateResolutionType.aeccPointDuplicateOverwrite;
                pntImportOpts.TransformCoordinate      = false;
                pntImportOpts.UsePointGroup            = true;
                pntImportOpts.PointGroup = "EXIST";

                Layer.manageLayers("EXIST");

                civDoc.Points.ImportPoints(namePntFile, "PNEZD (comma delimited)", pntImportOpts);
            }
        }
示例#2
0
文件: PF.cs 项目: 15831944/EM
        doProcessFigures()
        {
            bool     exists     = false;
            ObjectId idDictHist = Dict.getNamedDictionary("HISTORY", out exists);

            if (exists)
            {
                bool         def    = true;
                bool         answer = false;
                PromptStatus ps     = UserInput.getUserInputYesNo("Command PF has been executed on this drawing - Continue?", def, out answer);
                if (ps == PromptStatus.OK)
                {
                    if (answer == false)
                    {
                        return;
                    }
                }
                else
                {
                    return;
                }
            }

            if (BaseObjs._acadDocs.Count > 4)
            {
                bool         def    = false;
                bool         answer = false;
                PromptStatus ps     = UserInput.getUserInputYesNo(string.Format("There are {0} drawings open on this machine.  Do you wish to continue?", BaseObjs._acadDocs.Count.ToString()), def, out answer);
                if (ps == PromptStatus.OK)
                {
                    if (answer == false)
                    {
                        return;
                    }
                }
                else
                {
                    return;
                }
            }

            string       JN          = string.Empty;
            string       TOP         = string.Empty;
            string       nameFile    = string.Empty;
            string       nameFileMod = string.Empty;
            ResultBuffer rb          = null;

            ObjectId idDictPPF2 = Dict.getNamedDictionary("PPF2", out exists);

            if (!exists)
            {
                Application.ShowAlertDialog("Dictionary PPF2 is missing - Breaklines will be named \'TEMP\'");

                string nameFull = BaseObjs.docFullName;
                JN  = BaseObjs.docName.Substring(0, 4);
                TOP = "TEMP";
            }
            else
            {
                using (BaseObjs._acadDoc.LockDocument())
                {
                    rb = Dict.getXRec(idDictPPF2, "strTOP");
                }

                TypedValue[] tvs = rb.AsArray();

                if (tvs.Length > 0)
                {
                    JN          = tvs[0].Value.ToString();
                    TOP         = tvs[1].Value.ToString();
                    nameFile    = tvs[2].Value.ToString();
                    nameFileMod = tvs[3].Value.ToString();
                }
            }

            AeccSurveyDocument survDoc   = BaseObjsCom.aeccSurvDoc;
            AeccSurveyProjects survProjs = survDoc.Projects;
            AeccSurveyProject  survProj  = null;

            try
            {
                foreach (AeccSurveyProject sProj in survProjs)
                {
                    if (sProj.Name == JN)
                    {
                        survProj = sProj;
                        survProj.Open();
                        break;
                    }
                }
            }
            catch (System.Exception ex)
            {
                //Application.ShowAlertDialog(ex.Message + " PF.cs: line: 146");
                BaseObjs.writeDebug(ex.Message + " PF.cs: line: 146");
            }

            AeccSurveyFigures survFigures = survProj.Figures;
            List <ObjectId>   idPolys3d   = new List <ObjectId>();
            List <Node3d>     nodes3d     = new List <Node3d>();

            foreach (AeccSurveyFigure figure in survFigures)
            {
                AeccSurveyFigureNodes nodes = figure.FigureNodes;

                foreach (AeccSurveyFigureNode node in nodes)
                {
                    Node3d node3d = new Node3d(node.X, node.Y, node.Z, node.Bulge);
                    nodes3d.Add(node3d);
                }

                ObjectId idPoly3d = buildPoly3dFromNodes(nodes3d);
                Layer.setLayer(idPoly3d, figure.Layer);
                idPolys3d.Add(idPoly3d);
            }

            survProj.Close();

            TransferObjs.transferObjects(idPolys3d, TemplateCONT, nameFileMod);
            TransferObjs.transferObjects(idPolys3d, TemplateTOPO, nameFile);

            string handleLastEnt = string.Empty;

            try
            {
                handleLastEnt = idPolys3d[idPolys3d.Count - 1].getHandle().ToString();
            }
            catch (System.Exception ex)
            {
                //Application.ShowAlertDialog(ex.Message + " PF.cs: line: 176");
                BaseObjs.writeDebug(ex.Message + " PF.cs: line: 176");
            }

            CgPnt_Group.deletePntGroup(Path.GetFileName(nameFileMod));

            rb = new ResultBuffer(new TypedValue(1005, handleLastEnt));

            Dict.addXRec(idDictHist, "lastENT", rb);
        }