CAD创建不规则形状视口
选择CAD模型空间中多段线,在指定的布局中创建视口,方法如下:
/// <summary>
/// 创建视口
/// </summary>
/// <param name="roundLine">模型空间多段线</param>
/// <param name="curentLayout">当前布局名称</param>
/// <param name="insertPoint">布局空间视口插入点</param>
/// <param name="scale">缩放比例</param>
private void MakeViewport(Polyline roundLine, string curentLayout, Point3d insertPoint, double scale)
{
Database db = HostApplicationServices.WorkingDatabase;
using (Transaction tran = db.TransactionManager.StartTransaction())
{
BlockTable bt = tran.GetObject(db.BlockTableId, OpenMode.ForRead) as BlockTable;
BlockTableRecord btr = tran.GetObject(bt[BlockTableRecord.PaperSpace], OpenMode.ForWrite) as BlockTableRecord; Polyline bound = roundLine.Clone() as Polyline;
bound.Closed = true;
Point3d maxPoint = bound.GeometricExtents.MaxPoint;
Point3d minPoint = bound.GeometricExtents.MinPoint;
Point3d centerPoint = new Point3d((maxPoint.X + minPoint.X) / , (maxPoint.Y + minPoint.Y) / , );
bound.TransformBy(Matrix3d.Scaling(scale, centerPoint));
bound.TransformBy(Matrix3d.Displacement(centerPoint.GetVectorTo(insertPoint)));
btr.AppendEntity(bound);
tran.AddNewlyCreatedDBObject(bound, true); Viewport vp = new Viewport();
btr.AppendEntity(vp);
tran.AddNewlyCreatedDBObject(vp, true);
vp.NonRectClipEntityId = bound.Id; vp.CenterPoint = insertPoint; //视口插入位置
vp.ViewCenter = new Point2d(centerPoint.X, centerPoint.Y); //模型空间中心位置 vp.ViewHeight = maxPoint.Y - minPoint.Y; //模型空间高度
vp.Height = scale * vp.ViewHeight; //视口高度
vp.NonRectClipOn = true;
vp.Locked = true;
vp.On = true;
tran.Commit();
}
}
CAD创建不规则形状视口的更多相关文章
- 使用Win32 API创建不规则形状&带透明色的窗口
前一阵突然想起了9月份电面某公司实习时的二面题,大概就是说怎么用Win32 API实现一个透明的窗口,估计当时我的脑残答案肯定让面试官哭笑不得吧.所以本人决定好好研究下这个问题.经过一下午的摸索,基本 ...
- 使用CSS 3创建不规则图形 文字围绕
前言 CSS 创建复杂图形的技术即将会被广泛支持,并且应用到实际项目中.本篇文章的目的是为大家开启它的冰山一角.我希望这篇文章能让你对不规则图形有一个初步的了解. 现在,我们已经可以使用CSS 3 常 ...
- 使用CSS 3创建不规则图形
前言 CSS 创建复杂图形的技术即将会被广泛支持,并且应用到实际项目中.本篇文章的目的是为大家开启它的冰山一角.我希望这篇文章能让你对不规则图形有一个初步的了解. 现在,我们已经可以使用CSS 3 常 ...
- cocos2d-x 不规则形状按钮的点击判定
cocos2d-x 不规则形状按钮的点击判定 原理: 1.OpeGL ES提供了glReadPixels[^footnote]函数,来获取当前framebuffer上的像素数据 2.cocos2d-x ...
- 不规则形状的Mask动画
不规则形状的Mask动画 效果 源码 https://github.com/YouXianMing/Animations // // MaskShapeViewController.m // Anim ...
- html5 svg实现不规则形状图片触发事件
html5 svg实现不规则形状图片触发事件<pre><!DOCTYPE html><html lang="en"> <head> ...
- 不规则形状的Ifc构件顶点坐标获取
不规则形状的Ifc构件顶点坐标获取 今天有人问我,ifc构件的顶点坐标怎么获取,自己前年的时候写过类似的程序,但有点记不清了,最近一直用C++解析ifc,慎重起见,还是重新再写一次,java版本的获取 ...
- Unity 制作不规则形状button
在游戏开发中,我们有时需要制作不规则形状的按键. Unity3d中使用UGUI的Button控件只能实现规则的长方形按钮.而通过给Button的Image组件添加对应的贴图(sprite)我们可以实现 ...
- 利用C#轻松创建不规则窗体
1.准备一个不规则的位图 可以使用任意一种你喜欢的作图工具,制作一个有形状的位图,背景使用一种其他的颜色.这个颜色在编程中用得着,所以最好使用一种容易记忆的颜色.如黄色,文件名为bk.bmp 2.创建 ...
随机推荐
- OpenStack开启sshd
修改配置sshd的文件 1. 修改sshd配置文件 /etc/ssh/sshd_config 2. 将#PasswordAuthentication no的注释去掉,并将no改为y ...
- 浅谈C语言中的强符号、弱符号、强引用和弱引用
摘自http://www.jb51.net/article/56924.htm 浅谈C语言中的强符号.弱符号.强引用和弱引用 投稿:hebedich 字体:[增加 减小] 类型:转载 时间:2014- ...
- python安装完毕后,提示找不到ssl模块的解决方示
python安装完毕后,提示找不到ssl模块: [root@localhost ~]# python2.7.5 Python 2.7.5 (default, Jun 3 2013, 11:08:43) ...
- Redmine backlogs 安装
之前我们一直用IceScrum的免费版本来运作Scrum项目,用GitLab来做做Issue管理,但是出现了一些问题.GitLab的issue不够好用,不能满足我们的需求,同时issue没有办法放在S ...
- how to translate the text of push button
Background:In a project, the need to translate the buttons on the screen, as shown below,the followi ...
- 热烈祝贺Polymer中文组织站点上线
欢迎来到前端世界的明天 由于官网被墙, 所以 http://docs.polymerchina.org/ 其实是一件很有意义的事. 组件化和重用,一直是编程界几十年来前进的方向和目标,随着时间的推移和 ...
- ORACLE AWR概述及生成AWR报告
1.Overview of the Automatic Workload Repository The Automatic Workload Repository (AWR) collects, pr ...
- 使用repeater开发出现 回发或回调参数无效 的问题
我的就是因为没有加IsPostBack,导致在页面每次刷新时都生成一遍,造成重复绑定Repeater控件,以致事件验证出错,加上就好了 protected void Page_Load(object ...
- Sublime 学习记录(五) Sublime 其他插件(个人喜好)
(一) JSFormat 安装 :命令面板 pci 回车 JSFormat 回车 功能 : javascript的代码格式化插件 简介 : 很多网站的JS代码都进行了压缩,一行式的甚至混淆压缩,这让 ...
- property参数
1,set方法内存管理相关的参数 *retain:release旧值,retain新值(适用于OC对象类型) *assign:直接赋值(默认,只用于非OC对象类型) *copy: release旧 ...