当前位置:网站首页>CAD ARX 获取当前的视口设置
CAD ARX 获取当前的视口设置
2022-07-06 07:51:00 【zxt_net】
AcDbViewTableRecord GetCurrentView()
{
AcDbViewTableRecord view;
struct resbuf rb;
struct resbuf wcs, ucs, dcs; // 转换坐标时使用的坐标系统标记
wcs.restype = RTSHORT;
wcs.resval.rint = 0;
ucs.restype = RTSHORT;
ucs.resval.rint = 1;
dcs.restype = RTSHORT;
dcs.resval.rint = 2;
// 获得当前视口的“查看”模式
acedGetVar(“VIEWMODE”, &rb);
view.setPerspectiveEnabled(rb.resval.rint & 1);
view.setFrontClipEnabled(rb.resval.rint & 2);
view.setBackClipEnabled(rb.resval.rint & 4);
view.setFrontClipAtEye(!(rb.resval.rint & 16));
// 当前视口中视图的中心点(UCS坐标)
acedGetVar(“VIEWCTR”, &rb);
acedTrans(rb.resval.rpoint, &ucs, &dcs, 0, rb.resval.rpoint);
view.setCenterPoint(AcGePoint2d(rb.resval.rpoint[X],
rb.resval.rpoint[Y]));
// 当前视口透视图中的镜头焦距长度(单位为毫米)
acedGetVar(“LENSLENGTH”, &rb);
view.setLensLength(rb.resval.rreal);
// 当前视口中目标点的位置(以 UCS 坐标表示)
acedGetVar(“TARGET”, &rb);
acedTrans(rb.resval.rpoint, &ucs, &wcs, 0, rb.resval.rpoint);
view.setTarget(AcGePoint3d(rb.resval.rpoint[X],
rb.resval.rpoint[Y], rb.resval.rpoint[Z]));
// 当前视口的观察方向(UCS)
acedGetVar(“VIEWDIR”, &rb);
acedTrans(rb.resval.rpoint, &ucs, &wcs, 1, rb.resval.rpoint);
view.setViewDirection(AcGeVector3d(rb.resval.rpoint[X],
rb.resval.rpoint[Y], rb.resval.rpoint[Z]));
// 当前视口的视图高度(图形单位)
acedGetVar(“VIEWSIZE”, &rb);
view.setHeight(rb.resval.rreal);
double height = rb.resval.rreal;
// 以像素为单位的当前视口的大小(X 和 Y 值)
acedGetVar(“SCREENSIZE”, &rb);
view.setWidth(rb.resval.rpoint[X] / rb.resval.rpoint[Y] * height);
// 当前视口的视图扭转角
acedGetVar(“VIEWTWIST”, &rb);
view.setViewTwist(rb.resval.rreal);
// 将模型选项卡或最后一个布局选项卡置为当前
acedGetVar(“TILEMODE”, &rb);
int tileMode = rb.resval.rint;
// 设置当前视口的标识码
acedGetVar(“CVPORT”, &rb);
int cvport = rb.resval.rint;
// 是否是模型空间的视图
bool paperspace = ((tileMode == 0) && (cvport == 1)) ? true : false;
view.setIsPaperspaceView(paperspace);
if (!paperspace)
{
// 当前视口中前向剪裁平面到目标平面的偏移量
acedGetVar(“FRONTZ”, &rb);
view.setFrontClipDistance(rb.resval.rreal);
// 获得当前视口后向剪裁平面到目标平面的偏移值
acedGetVar(“BACKZ”, &rb);
view.setBackClipDistance(rb.resval.rreal);
}
else
{
view.setFrontClipDistance(0.0);
view.setBackClipDistance(0.0);
}
return view;
}
边栏推荐
- Simulation of holographic interferogram and phase reconstruction of Fourier transform based on MATLAB
- TS类型体操 之 字符串的妙用
- Generator Foundation
- Machine learning - decision tree
- The State Economic Information Center "APEC industry +" Western Silicon Valley will invest 2trillion yuan in Chengdu Chongqing economic circle, which will surpass the observation of Shanghai | stable
- Launch APS system to break the problem of decoupling material procurement plan from production practice
- Luogu p4127 [ahoi2009] similar distribution problem solution
- The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
- 数据治理:误区梳理篇
- ROS learning (IX): referencing custom message types in header files
猜你喜欢
Qualitative risk analysis of Oracle project management system
The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
A Closer Look at How Fine-tuning Changes BERT
Secure captcha (unsafe verification code) of DVWA range
Parameter self-tuning of relay feedback PID controller
Opencv learning notes 8 -- answer sheet recognition
opencv学习笔记九--背景建模+光流估计
解决方案:智慧工地智能巡检方案视频监控系统
继电反馈PID控制器参数自整定
Database basic commands
随机推荐
合规、高效,加快药企数字化转型,全新打造药企文档资源中心
Onie supports pice hard disk
edge浏览器 路径获得
Pangolin Library: control panel, control components, shortcut key settings
On why we should program for all
PHP Coding Standard
C intercept string
Esrally domestic installation and use pit avoidance Guide - the latest in the whole network
[dictionary tree] [trie] p3879 [tjoi2010] reading comprehension
A Closer Look at How Fine-tuning Changes BERT
[cf gym101196-i] waif until dark network maximum flow
Key value judgment in the cycle of TS type gymnastics, as keyword use
[redis] Introduction to NoSQL database and redis
珠海金山面试复盘
Qualitative risk analysis of Oracle project management system
Helm install Minio
23. Update data
HTTP cache, forced cache, negotiated cache
Codeforces Global Round 19(A~D)
shu mei pai