.NET5下的三維應用程序開發


 

終於等到了.NET5的發布,懷着激動的心情體驗了一下:“香”就一個字。

如何基於.NET5開發工業軟件,也廣大三維應用開發者關心的問題。我們的Rapid SDK已經率先支持.NET5,僅需三行代碼即可與WinForms程序集成,使用起來是相當的簡單。

 

創建一個.NET5 WinForms應用

注意選.NET

 

使用.NET5.0,默認是.NET Core 3.1

添加一個SplitContainer,其中一個用來顯示三維內容:

集成AnyCAD Rapid SDK

在Nuget上搜索anycad, 找到AnyCAD.Rapid.Net組件:

集成三維組件:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using AnyCAD.Forms;

namespace My3D
{
    public partial class Form1 : Form
    {
        RenderControl mRenderView;
        public Form1()
        {
            InitializeComponent();

            mRenderView = new RenderControl(this.splitContainer1.Panel2);
        }

    }
}

  

運行一下:

添加一個球

在窗體Load事件中添加點內容:

        private void Form1_Load(object sender, EventArgs e)
        {
            var sphere = ShapeBuilder.MakeSphere(GP.Origin(), 10);
            mRenderView.ShowShape(sphere, Vector3.Red);
            mRenderView.ZoomAll();
        }

  

總結

太過簡單,無需總結。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM