凸度(bulge)是AutoCAD 中独有的概念

转载:AutoCAD 中凸度(bulge)的概念 - BensonLaur - 博客园 (cnblogs.com)

重点:

1.凸度(bulge)是AutoCAD 中一个非常重要和强大的数学工具,它可以以非常简洁的方式表示一段弧的信息。已知平面内具体两点坐标,以及一个凸度值,即可唯一确定一段弧。

2.多段线中,凸度的数值放置在线段的两个端点中的前一个端点上。

3.凸度的具体含义:

bulge 的具体值定义为这段弧所对应的弧度(角度)的1/4的正切值,即

bulge = tan(θ/4)  , 其中 θ 是弧本身在其所在圆中所对应的弧度(角度)

bulge 值可以为正,也可以为负。约定当 bulge 为正时表示这段弧是逆时针弧当 bulge 为负时表示这段弧为顺时针弧

根据定义,不难看出,已知起点 A,终点 B,以及其间的凸度值,可以唯一确定一段弧线。

并且,可以推出,bulge 有以下特性:

bulge 的值为 0,线段 AB 为一段直线

bulge 的绝对值小于 1 时,弧线段 AB 为劣弧bulge 的绝对值大于 1 时,弧线段 AB 为优弧

  • 0
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
要修改CAD多段线某一段弧的凸度,您可以使用以下C#代码: ```csharp using Autodesk.AutoCAD.ApplicationServices; using Autodesk.AutoCAD.DatabaseServices; using Autodesk.AutoCAD.EditorInput; using Autodesk.AutoCAD.Geometry; using Autodesk.AutoCAD.Runtime; public void ModifyPolylineArcBulge() { // 获取当前文档和数据库 Document doc = Application.DocumentManager.MdiActiveDocument; Database db = doc.Database; // 提示用户选择多段线 PromptEntityOptions peo = new PromptEntityOptions("\n请选择多段线:"); peo.SetRejectMessage("\n请选择有效的多段线。"); peo.AddAllowedClass(typeof(Polyline), true); PromptEntityResult per = doc.Editor.GetEntity(peo); if (per.Status != PromptStatus.OK) return; // 获取多段线对象 Polyline polyline = (Polyline)per.ObjectId.GetObject(OpenMode.ForWrite); // 提示用户选择要修改的段 PromptIntegerOptions pio = new PromptIntegerOptions("\n请选择要修改的段:"); pio.AllowZero = false; pio.AllowNegative = false; pio.LowerLimit = 1; pio.UpperLimit = polyline.NumberOfVertices - 1; PromptIntegerResult pir = doc.Editor.GetInteger(pio); if (pir.Status != PromptStatus.OK) return; // 获取段的起点和终点 Point3d start = polyline.GetPoint3dAt(pir.Value - 1); Point3d end = polyline.GetPoint3dAt(pir.Value); // 计算段的点 Point3d midpoint = start + ((end - start) / 2.0); // 提示用户输入新的凸度值 PromptDoubleOptions pdo = new PromptDoubleOptions("\n请输入新的凸度值:"); pdo.AllowZero = false; pdo.AllowNegative = false; PromptDoubleResult pdr = doc.Editor.GetDouble(pdo); if (pdr.Status != PromptStatus.OK) return; // 计算新的弦长和半径 double chordLength = start.DistanceTo(end); double radius = (chordLength / 2.0) / Math.Abs(pdr.Value); // 计算新的圆心和起始角度和终止角度 Vector3d direction = end - start; double angle = direction.AngleOnPlane(Vector3d.ZAxis); if (direction.Y < 0) angle = 2 * Math.PI - angle; Point3d center = midpoint + (Vector3d.ZAxis * radius * Math.Sign(pdr.Value)); double startAngle = (start - center).AngleOnPlane(Vector3d.ZAxis); double endAngle = (end - center).AngleOnPlane(Vector3d.ZAxis); if (Math.Abs(pdr.Value) < 0.0001) endAngle = startAngle + Math.PI; // 修改凸度值 polyline.SetBulgeAt(pir.Value - 1, Math.Tan(angle / 4.0) * Math.Sign(pdr.Value)); // 修改弧的属性 Arc arc = new Arc(center, radius, startAngle, endAngle); polyline.SetArcSegmentAt(pir.Value - 1, arc); polyline.Closed = false; // 更新视图 doc.Editor.UpdateScreen(); } ``` 这段代码首先提示用户选择多段线以及要修改的段,然后计算新的凸度值对应的圆弧属性,最后修改凸度值并更新多段线的属性和视图。请注意,这段代码未经过完整测试,实际使用时可能需要进行调整和优化。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值