|
创建一个UserController,在Controller中访问数据库,cad崩溃的问题。。求大神解惑。。。
[CommandMethod("caishow")]
public void ShowPaletter()
{
KgController kgController =new KgController();
PaletteSet ps =new PaletteSet("控规面板");
ps.Add("KG", kgController);
ps.Visible = true;
} using (Transaction trans =cadDb.TransactionManager.StartTransaction())
{
BlockTable bt = (BlockTable)trans.GetObject(cadDb.BlockTableId, OpenMode.ForRead);
BlockTableRecord btRecord = (BlockTableRecord)trans.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForWrite);
Polyline line =new Polyline();
line.AddVertexAt(0,new Point2d(0,0),0,1,1);
line.AddVertexAt(1, new Point2d(10, 10), 0, 1,1);
btRecord.AppendEntity(line);
trans.AddNewlyCreatedDBObject(line,true);
trans.Commit();
}
cad崩溃错误
2texzobkvzx.jpg
0paudw34j2a.jpg
|
|