欢迎加我的QQ群:193522571,一起来讨论、交流!

trim c# .net

            #region 剪切
            using (Trimmer trimmer = new Autodesk.AutoCAD.ExportLayout.Trimmer())
            {
              Entity entityToTrim = (Entity)trans.GetObject(id, OpenMode.ForWrite);
              trimmer.Trim(entityToTrim, boundary);
              if (trimmer.HasAccurateResults)
              {
                #region 排除了无法打断的对象
                //有打断对象
                foreach (Entity ent in trimmer.TrimResultObjects)
                {
                  ent.SetPropertiesFrom(entityToTrim);
                  btr.AppendEntity(ent);
                  trans.AddNewlyCreatedDBObject(ent, true);
                }
                if (trimmer.EntityCompletelyOutside || trimmer.EntityOnBoundary)
                {
                  //如果在外部或者在线上
                  entityToTrim.Erase();
                }
                else if (trimmer.EntityCompletelyInside)
                {
                  //去除文字和标注
                  if (entityToTrim is Dimension)
                  {
                    if (cbxDim.Checked)
                    {
                      entityToTrim.Erase();
                    }
                  }
                  else if (entityToTrim is DBText || entityToTrim is MText)
                  {
                    if (cbxText.Checked)
                    {
                      entityToTrim.Erase();
                    }
                  }
                }
                #endregion 排除了无法打断的对象
              }
              else
              {
                entityToTrim.Erase();
              }
            }
            #endregion 剪切

 

posted @ 2018-01-21 19:04  swtool  阅读(500)  评论(0编辑  收藏  举报
欢迎加我的QQ群:193522571,一起来讨论、交流!