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();

         }

       }

     }

    }

  • 相关阅读:
    Jmeter压测
    .NET .Core 选择日志框架
    边缘控制器在边缘计算中的作用
    为何选择NB-IOT,NB-IOT的特点是什么
    RS232协议是什么
    物联网在生活中的应用场景
    透传模块是什么 为何透传
    4G DTU相对于GPRS/3G DTU有什么优势
    MQTT协议和Modbus之间的区别是什么
    4G模块应该怎么选择
  • 原文地址:https://www.cnblogs.com/swtool/p/3832328.html
Copyright © 2011-2022 走看看