032集——圆转多段线(Circle to Polyline)(CAD—C#二次开发入门)

CAD中圆可转为带有凸度的多段线以方便后期数据计算、处理,效果如下:

白色为圆,红色为转换后的多段线(为区分,已手工偏移多段线)

cs 复制代码
  public static  void XX()
  {
      var curves = Z.db.SelectEntities<Entity>();
      foreach (var item in curves)
      {
          if (item is Circle)
          {
              Circle temp = (Circle)item;
              Point3d pt = temp.Center;
              double leftx = pt.X - temp.Radius;
              double rightx = pt.X + temp.Radius;
              double topx = pt.X;
              double bottomx = pt.X;
              double lefty = pt.Y;
              double righty = pt.Y;
              double topy = pt.Y + temp.Radius;
              double bottomy = pt.Y - temp.Radius;
              Point2d left = new Point2d(leftx, lefty);
              Point2d right = new Point2d(rightx, righty);
              Point2d top = new Point2d(topx, topy);
              Point2d bottom = new Point2d(bottomx, bottomy);
              Polyline pl = new Polyline();
              pl.AddVertexAt(0, bottom, 1, 0, 0);
              pl.AddVertexAt(1, top, 1, 0, 0);
              pl.AddVertexAt(2, bottom, 0, 0, 0);
              pl.ColorIndex = 1;
              Z.db.AddEntityToModeSpace(pl);
              pl.Highlight();
              // Debugger.Break();
          }
          //else
          //{
          //    Z.db.Erase(item);
          //}
      }
     

   

  }
相关推荐
mudtools1 天前
.NET驾驭Word之力:玩转文本与格式
c#·.net
唐青枫1 天前
C#.NET 数据库开发提速秘籍:SqlSugar 实战详解
c#·.net
mudtools2 天前
.NET驾驭Word之力:理解Word对象模型核心 (Application, Document, Range)
c#·.net
大飞pkz2 天前
【设计模式】C#反射实现抽象工厂模式
设计模式·c#·抽象工厂模式·c#反射·c#反射实现抽象工厂模式
唐青枫2 天前
从入门到进阶:C#.NET Stopwatch 计时与性能测量全攻略
c#·.net
私人珍藏库2 天前
[Windows] 微软 .Net 运行库离线安装包 | Microsoft .Net Packages AIO_v09.09.25
microsoft·.net·运行库
路由侠内网穿透2 天前
本地部署 GPS 跟踪系统 Traccar 并实现外部访问
运维·服务器·网络·windows·tcp/ip
研华嵌入式3 天前
如何在高通跃龙QCS6490 Arm架构上使用Windows 11 IoT企业版?
arm开发·windows·嵌入式硬件
未来之窗软件服务3 天前
幽冥大陆(二)RDIFSDK 接口文档:布草洗涤厂高效运营的技术桥梁C#—东方仙盟
开发语言·c#·rdif·仙盟创梦ide·东方仙盟
1uther3 天前
Unity核心概念⑨:Screen
开发语言·游戏·unity·c#·游戏引擎