AutoCAD VBNET 获取曲线在3个基本平面的投影
求取空间任意曲线在xoy/yoz/xoz平面的投影
<CommandMethod(NameOf(TT_CurveProjected))> Public Sub TT_CurveProjected() Dim doc As Document = Application.DocumentManager.MdiActiveDocument Dim db As Database = doc.Database Dim ed As Editor = doc.Editor '将用户坐标系转换成世界坐标系 If Application.GetSystemVariable("WORLDUCS").ToString() <> "1" Then ed.CurrentUserCoordinateSystem = Matrix3d.Identity ed.Regen() End If Try Dim peo As New PromptEntityOptions("选择PolyLine") With peo .SetRejectMessage("only Curve can be select") .AddAllowedClass(GetType(Curve), False) End With Dim per = ed.GetEntity(peo) If per.Status <> PromptStatus.OK Then Return Using tr As Transaction = db.TransactionManager.StartTransaction() Dim bt As BlockTable = tr.GetObject(db.BlockTableId, OpenMode.ForRead) Dim ms As BlockTableRecord = tr.GetObject(bt(BlockTableRecord.ModelSpace), OpenMode.ForWrite) Dim oriCurve As Curve = per.ObjectId.GetObject(OpenMode.ForRead) Dim xoyPlane As New Plane(Point3d.Origin, Vector3d.ZAxis) Dim xozPlane As New Plane(Point3d.Origin, Vector3d.YAxis) Dim yozPlane As New Plane(Point3d.Origin, Vector3d.XAxis) '创建曲线在xoy平面的投影 Dim cur = oriCurve.GetOrthoProjectedCurve(xoyPlane) cur.Color = Color.FromColorIndex(ColorMethod.ByAci, 150) ms.AppendEntity(cur) tr.AddNewlyCreatedDBObject(cur, True) '创建曲线在xoz平面的投影 Dim curXoz = oriCurve.GetOrthoProjectedCurve(xozPlane) curXoz.Color = Color.FromColorIndex(ColorMethod.ByAci, 100) ms.AppendEntity(curXoz) tr.AddNewlyCreatedDBObject(curXoz, True) '创建曲线在yoz平面的投影 Dim curYoz = oriCurve.GetOrthoProjectedCurve(yozPlane) curYoz.Color = Color.FromColorIndex(ColorMethod.ByAci, 50) ms.AppendEntity(curYoz) tr.AddNewlyCreatedDBObject(curYoz, True) tr.Commit() End Using Catch ex As System.Exception Application.ShowAlertDialog(ex.StackTrace) End Try 'Application.UpdateScreen() End Sub
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· winform 绘制太阳,地球,月球 运作规律
· 超详细:普通电脑也行Windows部署deepseek R1训练数据并当服务器共享给他人
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· AI 智能体引爆开源社区「GitHub 热点速览」
· 写一个简单的SQL生成工具