资源简介
基于AnyCAD进行开发,集成三维模型展示功能、支持拖拽、平移、旋转等操作。
代码片段和文件信息
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using AnyCAD.Platform;
namespace AnyCAD.Basic
{
public partial class FormMain : Form
{
// The global application object
Platform.Application theApplication = new Platform.Application();
// BREP tool to create geometries.
BrepTools shapeMaker = new BrepTools();
// Default 3d View
Platform.View3d theView;
public FormMain()
{
InitializeComponent();
this.MouseWheel += new System.Windows.Forms.MouseEventHandler(this.onmousewheel);
}
private void FormMain_Load(object sender EventArgs e)
{
// Initialize the Application.
theApplication.Initialize();
Size size = panel3d.Size;
// Create the 3d View
theView = theApplication.CreateView(panel3d.Handle.ToInt32() size.Width size.Height);
theView.RequestDraw();
this.timerDraw.Enabled = true;
}
private void FormMain_SizeChanged(object sender EventArgs e)
{
Size size = panel3d.Size;
if(theView != null)
theView.OnSize(size.Width size.Height);
}
private void panel3d_Paint(object sender PaintEventArgs e)
{
if (theView == null)
return;
theView.Redraw();
}
private void timerDraw_Tick(object sender EventArgs e)
{
theView.RequestDraw();
theView.Redraw();
}
private SceneNode ShowTopoShape(TopoShape topoShape int id)
{
// Add the TopoShape to Scene.
TopoShapeConvert convertor = new TopoShapeConvert();
SceneNode faceNode = convertor.ToFaceNode(topoShape 0.5f);
faceNode.SetId(id);
theView.GetSceneManager().AddNode(faceNode);
return faceNode;
}
private void ClearScene()
{
theView.GetSceneManager().ClearNodes();
}
private void sphereToolStripMenuItem_Click(object sender EventArgs e)
{
TopoShape sphere = shapeMaker.MakeSphere(new Vector3(0 0 0) 40);
ShowTopoShape(sphere 100);
}
private void boxToolStripMenuItem_Click(object sender EventArgs e)
{
TopoShape box = shapeMaker.MakeBox(new Vector3(40 -20 0) new Vector3(0 0 1) new Vector3(30 40 60));
SceneNode sceneNode = ShowTopoShape(box 101);
Facestyle style = new Facestyle();
style.SetColor(new ColorValue(0.5f 0.3f 0 1));
sceneNode.SetFacestyle(style);
}
private void cylinderToolStripMenuItem_Click(object sender EventArgs e)
{
TopoShape cylinder = shapeMaker.MakeCylinder(new V
- 上一篇:系统安全日志、系统日志提取
- 下一篇:自顶向下语法分析器的设计与实现
相关资源
- 体温单 三色单
- Web课程设计
- 房产中介管理系统完整源码
- 条码、二维码批量打印
- 美食网站系统(仿下厨房)
- 作业抄袭检测系统毕业是论文
- WEB作业提交批改系统包括各种文档、
- 餐厅管理系统(管理端与客户端)
- ILSpy中文版
- UNITY代码大全
- 拼图小游戏.zip
- 图片拼图游戏
- 基于gmap和百度地图API开发的GIS应用
- 步进电机控制器.zip
- Win7 仿完整版苹果主题
- 天朝日语2.0(转载)
- .Net网络爬虫
- echartDemo柱状图折线图详解
- Net网络高级编程修订
- 创建PDF文档,加密创建的PDF文档,使
- 原型设计系统原型设计系统
- ERP管理系统源码
-
Mastering Unity sc
ripting - 操作系统进程管理和内存管理demo
- Spire.Doc、Spire.Xls无水印
- .net经典会员管理项目完整源码(包含
- LINQ实战英文版
- PdfPrintingNet完美破解版4.8.2 (官网Re
- [免费PDF]代码整洁之道.rar
- 周立功USBCANI通讯测试源码
评论
共有 条评论