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 剪切