zoukankan      html  css  js  c++  java
  • cad.net创建wipeout仅支持2008及以后版本

    using Autodesk.AutoCAD.Runtime;

    using Autodesk.AutoCAD.ApplicationServices;

    using Autodesk.AutoCAD.DatabaseServices;

    using Autodesk.AutoCAD.Geometry;

    namespace WipeoutApplication

    {

     public class Commands

     {

       [CommandMethod("CW")]

       public void CreateWipeout()

       {

         Document doc =

           Application.DocumentManager.MdiActiveDocument;

         Database db = doc.Database;

         Transaction tr =

           db.TransactionManager.StartTransaction();

         using (tr)

         {

           BlockTable bt =

             (BlockTable)tr.GetObject(

               db.BlockTableId,

               OpenMode.ForRead,

               false

             );

           BlockTableRecord btr =

             (BlockTableRecord)tr.GetObject(

               bt[BlockTableRecord.ModelSpace],

               OpenMode.ForWrite,

               false

             );

           Point2dCollection pts =

             new Point2dCollection(5);

           pts.Add(new Point2d(0.0, 0.0));

           pts.Add(new Point2d(100.0, 0.0));

           pts.Add(new Point2d(100.0, 100.0));

           pts.Add(new Point2d(0.0, 100.0));

           pts.Add(new Point2d(0.0, 0.0));

           Wipeout wo = new Wipeout();

           wo.SetDatabaseDefaults(db);

           wo.SetFrom(pts, new Vector3d(0.0, 0.0, 0.1));

           btr.AppendEntity(wo);

           tr.AddNewlyCreatedDBObject(wo, true);

           tr.Commit();

         }

       }

     }

    }

  • 相关阅读:
    Java生产环境线上栈故障排查问题(COPY)
    Java集合HashMap,List底层
    图算法--染色法判定二图
    图算法--kruskal
    图算法--最小生成树prim
    图算法--判负环
    图算法--floyd
    图算法--spfa
    图算法--bellman-ford (nm)
    图算法--堆优化版dijkstra
  • 原文地址:https://www.cnblogs.com/swtool/p/3832328.html
Copyright © 2011-2022 走看看