0 Members and 1 Guest are viewing this topic.
(command "-wblock" newBlockFilePath blockName)I can use lisp to save a block as a single file. How can I achieve this use .net?
Quote from: guohq on March 11, 2016, 05:58:49 AM (command "-wblock" newBlockFilePath blockName)I can use lisp to save a block as a single file. How can I achieve this use .net?Look into WBlockCloneObjectsCode - C#: [Select] ////Clones all objectId's to a new drawing and saves it to your path & filename. Database newdata = new Database(true, true); string SavPath = @"C:\Path\" + DwgName; using (Transaction ntrans = newdata.TransactionManager.StartTransaction()) { BlockTableRecord newbtr = (BlockTableRecord)ntrans.GetObject(SymbolUtilityServices.GetBlockModelSpaceId(newdata), OpenMode.ForRead); IdMapping IDMap = new IdMapping(); database.WblockCloneObjects(oidc, newbtr.ObjectId, IDMap, DuplicateRecordCloning.Replace, false); newdata.SaveAs(SavPath, DwgVersion.Current); ntrans.Commit(); }