当前位置:网站首页>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 * 向上偏移方向);
边栏推荐
- 力扣 剑指 Offer 51. 数组中的逆序对
- 倒计时 2 天!2022 中国算力大会:移动云邀您共见算力网络,创新发展
- SAP ui5 fileuploader control realizes local file upload, and trial version of cross domain access error encountered when receiving server-side response
- 111. SAP UI5 FileUploader 控件实现本地文件上传,接收服务器端的响应时遇到跨域访问错误
- 酷炫操作预热!代码实现小星球特效
- Facial expression recognition based on pytorch convolution - graduation project "suggestions collection"
- 微念“失去”李子柒的这一年
- 严格模式——let和const——箭头函数——解构赋值——字符串模板symbol——Set和Map——生成器函数
- Li Kou sword finger offer 51. reverse order pairs in the array
- Leetcode notes 566. Reshaping the matrix
猜你喜欢

Denial of service DDoS Attacks

The domestic API management tool eolink is very easy to use, creating an efficient research and development tool

Jar package
JWT 登录认证 + Token 自动续期方案,写得太好了!

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

30天刷题计划(三)

我秃了!唯一索引、普通索引我该选谁?

酷炫操作预热!代码实现小星球特效

FFT wave simulation

7.依赖注入
随机推荐
R语言ggplot2可视化:使用ggpubr包的ggviolin函数可视化小提琴图、设置draw_quantiles参数添加指定分位数横线(例如,50%分位数、中位数)
Strict mode -- let and const -- arrow function -- Deconstruction assignment -- string template symbol -- set and map -- generator function
SAP ui5 fileuploader control realizes local file upload, and trial version of cross domain access error encountered when receiving server-side response
Tutorial on the principle and application of database system (058) -- MySQL exercise (2): single choice question
Three men "running away" from high positions in the mobile phone factory
今日睡眠质量记录75分
性能超群!牛津&上海AI Lab&港大&商汤&清华强强联手,提出用于引用图像分割的语言感知视觉Transformer!代码已开源...
屈辱、抗争、逆转,三十年,中国该赢微软一次了
R语言可视化散点图、使用ggrepel包的geom_text_repel函数避免数据点之间的标签互相重叠(使用参数xlim和ylim将标签添加到可视化图像的特定区域、指定标签线段并添加箭头)
Better and more modern terminal tools than xshell!
数据库系统原理与应用教程(059)—— MySQL 练习题:操作题 1-10(三)
Analyzing the principle of DNS resolution in kubernetes cluster
Humiliation, resistance, reversal, 30 years, China should win Microsoft once
Can second uncle cure young people's spiritual internal friction?
word打字时后面的字会消失是什么原因?如何解决?
使用 Fail2ban 保护 Web 服务器免受 DDoS 攻击
数据库系统原理与应用教程(062)—— MySQL 练习题:操作题 32-38(六)
C language: optimized merge sort
C语言:随机生成数+归并排序
Leetcode notes 566. Reshaping the matrix