资源简介
基于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
- 上一篇:系统安全日志、系统日志提取
- 下一篇:自顶向下语法分析器的设计与实现
相关资源
- WPF USB 网络 串口 通信软件
- B/S 网上订餐系统
- 教室管理系统.rar
- 小鸡快跑游戏.
-
分别适用于.NET fr
amework 2.0和4.0的E - 汽车租赁系统............................
- 德卡D8读写器关于读写感应卡的一些代
- halcon 测量助手
- 图片存储到数据库保存二进制文件并
- 用Socket写的简易FTP服务器和客户端
- 企业销售管理信息系统(全套)
- 串口操作类(justinio)
- 基于Petri网的工作流(完整的原创源代
- 选择题自动考试系统
- 多线程实例:桌面智能弹球小游戏
- 土地信息管理系统
- ServiceStack V3.9 全部dll
- PDF pdfview.ocx 无水印
- 无需共享打印机实现远程打印功能小
- 真正的破解版PDFView4NET
- 网页调用ActiveX控件获取串口数据
- Luence的与盘古分词的使用软件
- Emgu.CV 打开视频与人脸检测
- 麦克纳姆轮程序.rar
- Unity3D 实战视频教程 保卫萝卜 2D 游戏
- net微信支付
- lucene.net+盘古分词多条件全文检索并匹
- 闪电猫-电商下图助手5.0.zip
- FastReport.Net V2014.4.8 For .Net2.0
- NET Reflector 8.3破解版自带代码导出
评论
共有 条评论