代码语言
.
CSharp
.
JS
Java
Asp.Net
C
MSSQL
PHP
Css
PLSQL
Python
Shell
EBS
ASP
Perl
ObjC
VB.Net
VBS
MYSQL
GO
Delphi
AS
DB2
Domino
Rails
ActionScript
Scala
代码分类
文件
系统
字符串
数据库
网络相关
图形/GUI
多媒体
算法
游戏
Jquery
Extjs
Android
HTML5
菜单
网页交互
WinForm
控件
企业应用
安全与加密
脚本/批处理
开放平台
其它
【
CSharp
】
STEP文件读取与显示
作者:
AnyCAD
/ 发布于
2014/4/8
/
1026
基于AnyCAD .Net 三维图形平台,使用C#开发。支持读取STEP文件模型的名字,根据STEP文件的结构以树形显示内容,支持三维显示模型内容。支持把STEP导出为STL文件。
--基于AnyCAD.Net三维图形平台,使用C#开发。支持读取STEP文件模型的名字,根据STEP文件的结构以树形显示内容,支持三维显示模型内容。支持把STEP导出为STL文件。 MainForm.cs ?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 StpViewer { public partial class MainForm : Form { private AnyCAD.Presentation.RenderWindow3d renderView = null; public MainForm() { InitializeComponent(); this.renderView = new AnyCAD.Presentation.RenderWindow3d(); this.renderView.Location = new System.Drawing.Point(0, 0); this.renderView.Size = this.Size; this.renderView.TabIndex = 1; this.splitContainer1.Panel2.Controls.Add(this.renderView); this.renderView.MouseClick += new System.Windows.Forms.MouseEventHandler(this.OnRenderWindow_MouseClick); } private void OnRenderWindow_MouseClick(object sender, MouseEventArgs e) { } private void MainForm_Resize(object sender, EventArgs e) { if (renderView != null) renderView.Size = this.splitContainer1.Panel2.Size; } private void MainForm_Load(object sender, EventArgs e) { this.renderView.View3d.ShowCoordinateAxis(true); renderView.ExecuteCommand("ShadeWithEdgeMode"); this.renderView.RequestDraw(); } private void openToolStripMenuItem_Click(object sender, EventArgs e) { OpenFileDialog dlg = new OpenFileDialog(); dlg.Filter = "STEP File(*.stp;*.step)|*.stp;*.step|All Files(*.*)|*.*"; if (DialogResult.OK == dlg.ShowDialog()) { this.treeViewStp.Nodes.Clear(); this.renderView.ClearScene(); StpBrower browser = new StpBrower(this.treeViewStp, this.renderView); browser.ReadFile(dlg.FileName); } renderView.View3d.FitAll(); } private void treeViewStp_AfterSelect(object sender, TreeViewEventArgs e) { } } } StpBrower.cs ?using System; using System.Collections.Generic; using System.Linq; using System.Text; using AnyCAD.Platform; using AnyCAD.Presentation; namespace StpViewer { class StpBrower : AnyCAD.Platform.ITopoShapeReaderContext { private System.Windows.Forms.TreeView treeView = null; private AnyCAD.Presentation.RenderWindow3d renderView = null; private Stack<System.Windows.Forms.TreeNode> nodeStack = new Stack<System.Windows.Forms.TreeNode>(); private int nShapeCount = 100; public StpBrower(System.Windows.Forms.TreeView _treeView, AnyCAD.Presentation.RenderWindow3d _renderView) { treeView = _treeView; renderView = _renderView; } public bool ReadFile(String fileName) { AnyCAD.Exchange.StepReader reader = new AnyCAD.Exchange.StepReader(); return reader.Read(fileName, this); } public override void OnBeginGroup(String name) { if (name.Length == 0) { name = "<UNKNOWN>"; } if (nodeStack.Count == 0) { System.Windows.Forms.TreeNode node = treeView.Nodes.Add(name); nodeStack.Push(node); } else { nodeStack.Push(nodeStack.Peek().Nodes.Add(name)); } } public override void OnEndGroup() { nodeStack.Pop(); } public override void OnCompound(TopoShape shape) { ++nShapeCount; nodeStack.Peek().Nodes.Add(String.Format("{0}", nShapeCount), "Assembly"); renderView.ShowGeometry(shape, nShapeCount); } public override void OnSolid(TopoShape shape) { ++nShapeCount; nodeStack.Peek().Nodes.Add(String.Format("{0}", nShapeCount), "Solid"); renderView.ShowGeometry(shape, nShapeCount); } public override void OnShell(TopoShape shape) { ++nShapeCount; nodeStack.Peek().Nodes.Add(String.Format("{0}", nShapeCount), "Shell"); renderView.ShowGeometry(shape, nShapeCount); } public override void OnFace(TopoShape shape) { ++nShapeCount; nodeStack.Peek().Nodes.Add(String.Format("{0}", nShapeCount), "Face"); renderView.ShowGeometry(shape, nShapeCount); } } }
试试其它关键字
STEP文件
同语言下
.
文件IO 操作类库
.
Check图片类型[JPEG(.jpg 、.jpeg),TIF,GIF,BMP,PNG,P
.
机器名和IP取得(IPV4 IPV6)
.
Tiff转换Bitmap
.
linqHelper
.
MadieHelper.cs
.
RegHelper.cs
.
如果关闭一个窗体后激活另一个窗体的事件或方法
.
创建日志通用类
.
串口辅助开发类
可能有用的
.
C#实现的html内容截取
.
List 切割成几份 工具类
.
SQL查询 多列合并成一行用逗号隔开
.
一行一行读取txt的内容
.
C#动态修改文件夹名称(FSO实现,不移动文件)
.
c# 移动文件或文件夹
.
c#图片添加水印
.
Java PDF转换成图片并输出给前台展示
.
网站后台修改图片尺寸代码
.
处理大图片在缩略图时的展示
AnyCAD
贡献的其它代码
(
2
)
.
dxf文件显示与转换
.
STEP文件读取与显示
Copyright © 2004 - 2024 dezai.cn. All Rights Reserved
站长博客
粤ICP备13059550号-3