当前位置:网站首页>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;
}
边栏推荐
- [nonlinear control theory]9_ A series of lectures on nonlinear control theory
- Go learning notes (3) basic types and statements (2)
- Inspiration from the recruitment of bioinformatics analysts in the Department of laboratory medicine, Zhujiang Hospital, Southern Medical University
- Key value judgment in the cycle of TS type gymnastics, as keyword use
- Significance and measures of encryption protection for intelligent terminal equipment
- [非线性控制理论]9_非线性控制理论串讲
- CF1036C Classy Numbers 题解
- File upload of DVWA range
- "Designer universe" Guangdong responds to the opinions of the national development and Reform Commission. Primary school students incarnate as small community designers | national economic and Informa
- flask返回文件下载
猜你喜欢
. Net 6 learning notes: what is NET Core
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
Google可能在春节后回归中国市场。
861. Score after flipping the matrix
[nonlinear control theory]9_ A series of lectures on nonlinear control theory
Document 2 Feb 12 16:54
Basics of reptile - Scratch reptile
esRally国内安装使用避坑指南-全网最新
Mise en œuvre du langage leecode - C - 15. Somme des trois chiffres - - - - - idées à améliorer
opencv学习笔记八--答题卡识别
随机推荐
ROS learning (IX): referencing custom message types in header files
Nc204382 medium sequence
649. Dota2 Senate
22. Empty the table
[untitled]
MES, APS and ERP are essential to realize fine production
Inspiration from the recruitment of bioinformatics analysts in the Department of laboratory medicine, Zhujiang Hospital, Southern Medical University
Linked list interview questions (Graphic explanation)
MySQL view tablespace and create table statements
MEX有关的学习
TS 体操 &(交叉运算) 和 接口的继承的区别
Simulation of holographic interferogram and phase reconstruction of Fourier transform based on MATLAB
Parameter self-tuning of relay feedback PID controller
08- [istio] istio gateway, virtual service and the relationship between them
Oracle time display adjustment
Simulation of Michelson interferometer based on MATLAB
Document 2 Feb 12 16:54
【Redis】NoSQL数据库和redis简介
TS类型体操 之 字符串的妙用
Yu Xia looks at win system kernel -- message mechanism