示例#1
0
        //private static readonly ILog //_logger = LogManager.GetLogger(typeof(MapUtilities));

        #endregion

        #region MapBreak

        /// <summary>
        /// Maps the break.
        /// </summary>
        /// <param name="polyPoints">The poly points.</param>
        /// <param name="layerFilter">The layer filter.</param>
        /// <returns></returns>
        public static bool MapBreak(IList <GemsPoint2d> polyPoints, string layerFilter)
        {
            bool retval = false;

            //_logger.Debug("Start MapBreak");
            GemsPoint2d minPoint = CoordinateService.GetMinFromPolygon(polyPoints);
            GemsPoint2d maxPoint = CoordinateService.GetMaxFromPolygon(polyPoints);

            // This should return a selection set and check that it contains one or more objects
            // I would need to add a using to get the SelectionSet object in this class...?
            SelectionManager.GetSelectionSet(minPoint.X, minPoint.Y, maxPoint.X, maxPoint.Y, layerFilter, true);

            // The CMDDIA calls should reference SetSystemVariable
            StringBuilder acadCmd = new StringBuilder();

            acadCmd.Append("CMDDIA 0 ");
            acadCmd.Append("_MAPBREAK DEFINE ");
            foreach (GemsPoint2d onePoint in polyPoints)
            {
                acadCmd.Append(onePoint.X.ToString());
                acadCmd.Append(",");
                acadCmd.Append(onePoint.Y.ToString());
                acadCmd.Append("\r");
            }
            acadCmd.Append("\r");
            acadCmd.Append("N Y P  Y Y ");
            acadCmd.Append("CMDDIA 1 ");
            AcadUtilities.SendStringToExecute(acadCmd.ToString());
            retval = true;

            //_logger.Debug("End MapBreak");
            return(retval);
        }
示例#2
0
        /// <summary>
        /// References the current AutoCAD Map Project drawing and sets the AutoCAD Map coordinate system code
        /// Note that this must not be called if a query has been executed.
        /// Behavior is unknown if there are even drawings attached to the project
        /// Best to call this on a new drawing with no attached drawings or queried objects
        /// </summary>
        /// <param name="mapCsCode">The map cs code.</param>
        /// <returns></returns>
        public static bool SetMapCSCode(string mapCsCode)
        {
            bool retVal = false;

            //_logger.Debug("Start SetMapCSCode");
            try
            {
                // Note that setting the coordinate system code causes a zoom window command to be piped to the command line
                // This is getting sent in a manner that causes AutoCAD to get confused
                // Replacing with SendStringToExecute is a work around
                AcadUtilities.SendStringToExecute("ADESETCRDSYS S " + mapCsCode + " X ");
                //MapApplication AcMap;
                //Autodesk.Gis.Map.Project.ProjectModel AcMapProject;
                //AcMap = HostMapApplicationServices.Application;
                //AcMapProject = AcMap.ActiveProject;
                //AcMapProject.Projection = mapCsCode;
                retVal = true;
            }
            catch (System.Exception ex)
            {
                //_logger.Error("Error in SetMapCSCode", ex);
                throw;
            }
            //_logger.Debug("End SetMapCSCode");
            return(retVal);
        }
示例#3
0
 public void ImportPointCloud()
 {
     try
     {
         AcadUtilities.SendStringToExecute("_.AeccCreatePointCloud \n");
     }
     catch (Exception ex)
     {
         AcadUtilities.WriteMessage(ex.Message);
         PGA.MessengerManager.MessengerManager.AddLog(ex.Message);
     }
 }
示例#4
0
 public void ExportToAutoCAD2()
 {
     try
     {
         AcadUtilities.SendStringToExecute("_.EXPORTTOAUTOCAD \n\n");
     }
     catch (Exception ex)
     {
         AcadUtilities.WriteMessage(ex.Message);
         PGA.MessengerManager.MessengerManager.AddLog(ex.Message);
     }
 }
示例#5
0
            public void CheckDrawing()
            {
                try
                {
                    AcadUtilities.WriteMessage("Starting Audit \n\n");

                    AcadUtilities.SendStringToExecute("_.AUDIT Y \n\n");
                }
                catch (Exception ex)
                {
                    AcadUtilities.WriteMessage(ex.Message);
                    PGA.MessengerManager.MessengerManager.AddLog(ex.Message);
                }
            }