- 1、本文档共8页,可阅读全部内容。
- 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
CAD二次实验报告4
实验四 用户交互、选择集及扩展属性
一、主要内容
1、基于用户交互式的信息输入
2、创建选择集
3、给图形实体添加扩展属性
二、学时安排
三、预习内容
回顾用户交互命令的使用、选择集创建的几种方式,
四、实验步骤
4.1 用户交互
Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
//提示输入圆心坐标
PromptPointOptions fristpoint = new PromptPointOptions(\n请输入圆心:);
……
//提示输入半径
PromptDoubleOptions r = new PromptDoubleOptions(\n请输入圆半径:);
……
4.1.1 读入字符串
//获取提示框输入的或点选的坐标
PromptPointResult result = ed.GetPoint(fristpoint);
Point3d p = result.Value;
4.1.2 读入Double型数据
//获取输入半径,并转换为double类型
PromptDoubleResult Temp_radius = ed.GetDouble(r);
//通过PromptDoubleResult下的属性Value转换为.NET下的Double类型
double radius = Temp_radius.Value;
4.1.3 读入Point
//声明圆对象
Circle c = new Circle();
c.Center = p;
c.Radius = radius;
4.1.4 拾取实体
Entity ent = (Entity)acTrans.GetObject(id, OpenMode.ForRead, false);
4.1.5 打开dwg文件
//打开并插入dwg文件
[CommandMethod(insertdwg)]
static public void insertdwg()
{
OpenFileDialog pOpenFileDialog = new OpenFileDialog(打开地形图, null, dwg, openfile, OpenFileDialog.OpenFileDialogFlags.DefaultIsFolder);
pOpenFileDialog.ShowDialog();
string fname = pOpenFileDialog.Filename;
Document doc = Application.DocumentManager.MdiActiveDocument;
Editor ed = doc.Editor;
if (!File.Exists(fname))
fname = HostApplicationServices.Current.FindFile(fname, doc.Database, FindFileHint.Default);
using (Database db = new Database(false, false))
{
db.ReadDwgFile(fname, FileShare.ReadWrite, true, null);
using (Transaction t = doc.TransactionManager.StartTransaction())
{
int n = fname.LastIndexOf(\\);
ObjectId idBTR = doc.Database.Insert(fname.Substring(n + 1, fname.Length - n - 5), db, false);
BlockTable bt = (BlockTable)t.GetObject(doc.Database.Bl
您可能关注的文档
- ATK教程:旋轨耦合导致硅的能带劈裂.pdf
- ATK教程:石墨烯纳米带的透射谱计算.pdf
- ATK教程:非共线磁矩与输运.pdf
- ATransformational Analysis of Expensive Chunks.pdf
- Atomistic computation of liquid diffusivity.pdf
- Atrill_4e_SM_Ch01.pdf
- ATP Comparison of transmission line models.pdf
- ATK教程:模拟石墨烯表面的原子轰击.pdf
- Attract 吸引.doc
- AtSTP11, a pollen tube-speci.pdf
- CAD绘图快捷键+实用命令.pdf
- CaII and NaI absorption signatures from extraplanar gas in the halo of the Milky Way.pdf
- Cadence Allegro OrCAD V16.3 安装步骤.pdf
- Calculating noise figure in op amps.pdf
- Calculating the interior permanent-magnet motor.pdf
- Calculation of accurate permanent dipole moments of the lowest $^{1,3} Sigma^+$ states of h.pdf
- Calibration of Rent’s Rule Models for Three-Dimensional Integrated Circuits.pdf
- Calibre LVS 介绍.pdf
- calibre后仿真参数提取.pdf
- camera 及原理.pdf
文档评论(0)