当前位置:网站首页>DXF读写:对齐尺寸标注文字居中、上方的位置计算
DXF读写:对齐尺寸标注文字居中、上方的位置计算
2022-07-28 12:46:00 【shanql】
AutoCAD文字位置的规律
观察以下图形,得出结论
首先计算出文字中点,然后延着标注线垂直方向向上偏移指定距离。此处的关键是标注线的方向如何确定,通过研究,标注线方向并不等于标注第二点减去标注第一点。
标注线方向的确定
起末点求出初始标注方向 = 标注第二点 - 标注第一点
根据+X确定最终的标注方向,有两种方案,如下:
使用点积判断
若标注方向与x轴正向平行,标注方向取+x;
否则,若标注方向与x轴垂直,标注方向取+y;
否则,若标注方向与x轴点积 < 0, 则标注方向取反
否则标注方向不变使用angleTo求出两向量[0-pi]的夹角
若为0或pi,则表示与x轴平行,标注方向取+x
否则若为pi/2, 则表示与x轴垂直,标注方向取+y;
否则若>pi/2, 则标注方向取反
否则标注方向不变
向上偏移方向
标注线方向绕Z轴逆时针旋转90度即可
求出最终文字位置
文字位置 = 标注中点 + (drwDimStyle.dimgap + drwDimStyle.dimtxt / 2.0) * drwDimStyle.dimscale * 向上偏移方向);
边栏推荐
- C语言:随机生成数+快速排序
- .NET的求复杂类型集合的差集、交集、并集
- What if the server cannot be connected (the original server cannot find the target resource)
- FFT wave simulation
- 【ECMAScript6】Promise
- Paddleclas classification practice record
- 今日睡眠质量记录75分
- JWT login authentication + token automatic renewal scheme, well written!
- 不用Swagger,那我用啥?
- POJ3268最短路径题解
猜你喜欢

Some thoughts on.Net desktop development

Jar package

沾上趣店,都得道歉?
JWT 登录认证 + Token 自动续期方案,写得太好了!

No swagger, what do I use?
![[security] read rfc6749 and understand the authorization code mode under oauth2.0](/img/dc/e6d8626195b2e09a6c06050a9b552e.jpg)
[security] read rfc6749 and understand the authorization code mode under oauth2.0

Can second uncle cure young people's spiritual internal friction?

今日睡眠质量记录75分

微念“失去”李子柒的这一年

Today's sleep quality record 75 points
随机推荐
Org.apache.ibatis.exceptions.toomanyresultsexception
30天刷题计划(二)
Excellent performance! Oxford, Shanghai, AI Lab, Hong Kong University, Shangtang, and Tsinghua have joined forces to propose a language aware visual transformer for reference image segmentation! Open
R语言使用dpois函数生成泊松分布密度数据、使用plot函数可视化泊松分布密度数据(Poisson distribution)
Jar package
DDoS protection with iptables
How to check if the interface cannot be adjusted? I didn't expect that the old bird of the 10-year test was planted on this interview question
Denial of service DDoS Attacks
合并表格行---三层for循环遍历数据
My friend sent me some interview questions
R语言ggplot2可视化:使用ggpubr包的ggviolin函数可视化小提琴图、设置draw_quantiles参数添加指定分位数横线(例如,50%分位数、中位数)
Merge table rows - three levels of for loop traversal data
Tutorial on the principle and application of database system (062) -- MySQL exercise questions: operation questions 32-38 (6)
Leetcode notes 118. Yang Hui triangle
数据库系统原理与应用教程(061)—— MySQL 练习题:操作题 21-31(五)
Blue Bridge Training (additional interview questions) day 7
从手机厂高位“出走”的三个男人
DOJNOIP201708奶酪题解
Intra prediction and transform kernel selection based on Neural Network
SAP UI5 FileUploader 控件实现本地文件上传,接收服务器端的响应时遇到跨域访问错误的试读版