メッセージ1/9
How to code Fillet function when use the c# laHow nguage,please look at the code

適用対象外
03-02-2016
06:37 PM
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- パーマリンクを表示
- 印刷
- 報告
I want to use code to implement cad function fillet,now here is my code
public class Class1 { [DllImport("acad.exe", EntryPoint = "acedCmd", CharSet = CharSet.Auto, CallingConvention = CallingConvention.Cdecl)] private extern static int acedCmd(IntPtr rbp); public static ObjectId toModelSpace(Entity ent) { Database db = HostApplicationServices.WorkingDatabase; ObjectId endId; using (Transaction trans = db.TransactionManager.StartTransaction()) { BlockTable bt = (BlockTable)trans.GetObject(db.BlockTableId, OpenMode.ForRead); BlockTableRecord btr = (BlockTableRecord)trans.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForWrite); endId = btr.AppendEntity(ent); trans.AddNewlyCreatedDBObject(ent, true); trans.Commit(); } return endId; } public static int AcedCmd(Editor ed, ResultBuffer args) { if (!Application.DocumentManager.IsApplicationContext) return acedCmd(args.UnmanagedObject); else return 0; } [CommandMethod("ArxCommand")] public void ComCommand() { Document doc = Application.DocumentManager.MdiActiveDocument; Editor ed = doc.Editor; Line l1 = new Line(new Point3d(),new Point3d(1000,1000,0)); Line l2 = new Line(new Point3d(0,400,0),new Point3d(500,0,0)); toModelSpace(l1); toModelSpace(l2); ResultBuffer rb = new ResultBuffer(); rb.Add(new TypedValue(5005, "_fillet")); rb.Add(new TypedValue(5005, "r")); rb.Add(new TypedValue(5001, 10)); rb.Add(new TypedValue(5006, l1.ObjectId)); rb.Add(new TypedValue(5006, l2.ObjectId)); rb.Add(new TypedValue()); AcedCmd(ed, rb); } }
After the code runs but does not function,We hope to see where a problem write please,thanks!