如果需要从当前模型空间中选择部分图形,直接另存为一个新文件,可用如下方法
//spObjectId 对象的ID //path 保存路径 //注意,实际内部使用了ObjectIdCollection 对象,一次可以保存多个ID public static void SaveObject(ObjectId spObjectId, string path) { var sourceDb = spObjectId.Database; using (var targetDb = new Database(true, true)) { var ids = new ObjectIdCollection { spObjectId}; sourceDb.Wblock(targetDb, ids, Point3d.Origin, DuplicateRecordCloning.Ignore); targetDb.SaveAs(path, DwgVersion.Current); } }
本方法来自:https://forums.autodesk.com/t5/net/how-to-save-the-current-file-to-a-specific-location-on-the-hard/m-p/12342659#M79291
标签:AutoCAD,另存为,targetDb,var,spObjectId,二次开发,path From: https://www.cnblogs.com/TheRedHouse/p/17867770.html