当前位置:网站首页>DXF reading and writing: align the calculation of the position of the dimension text in the middle and above
DXF reading and writing: align the calculation of the position of the dimension text in the middle and above
2022-07-28 13:52:00 【shanql】
AutoCAD The law of text position
Observe the following figure , Come to the conclusion
First, calculate the midpoint of the text , Then offset the specified distance upward along the vertical direction of the dimension line . The key here is how to determine the direction of the dimension line , Through research , Dimension line direction is not equal to dimension second point minus dimension first point .
Determination of dimension line direction
Find the initial dimension direction at the starting and ending points = Mark the second point - Mark the first point
according to +X Determine the final dimension direction , There are two options , as follows :
Use dot product to judge
If the dimension direction is the same as x The axis is parallel in the positive direction , The marking direction is +x;
otherwise , If the dimension direction is the same as x The axis is vertical , The marking direction is +y;
otherwise , If the dimension direction is the same as x Axial dot product < 0, Then the marking direction is reversed
Otherwise, the dimension direction will not changeUse angleTo Find two vectors [0-pi] The angle between
if 0 or pi, And x Axis parallel , The marking direction is +x
Otherwise, if pi/2, And x The axis is vertical , The marking direction is +y;
Otherwise, if >pi/2, Then the marking direction is reversed
Otherwise, the dimension direction will not change
Upward offset direction
The direction of the dimension line is around Z Counterclockwise rotation of shaft 90 Degree is enough
Find the final text position
Text location = Mark midpoint + (drwDimStyle.dimgap + drwDimStyle.dimtxt / 2.0) * drwDimStyle.dimscale * Upward offset direction );
边栏推荐
- I'm bald! Who should I choose for unique index or general index?
- 数据库系统原理与应用教程(061)—— MySQL 练习题:操作题 21-31(五)
- 记一次使用pdfbox解析pdf,获取pdf的关键数据的工具使用
- Go language - Application of stack - expression evaluation
- IntersectionObserver交叉观察器
- 朋友发来几个面试题
- R语言可视化散点图、使用ggrepel包的geom_text_repel函数避免数据点之间的标签互相重叠(使用参数xlim和ylim将标签添加到可视化图像的特定区域、指定标签线段并添加箭头)
- How to play a data mining game entry Edition
- 了解BFC特性,轻松实现自适应布局
- 30天刷题计划(二)
猜你喜欢

面经整理,助力秋招,祝你称为offer收割机

111. SAP UI5 FileUploader 控件实现本地文件上传,接收服务器端的响应时遇到跨域访问错误

7. Dependency injection

接口调不通,如何去排查?没想到10年测试老鸟栽在这道面试题上

Beyond istio OSS -- current situation and future of istio Service Grid

SQL每日一练(牛客新题库)——第4天:高级操作符

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

30 day question brushing training (I)

SAP ui5 fileuploader control realizes local file upload, and trial version of cross domain access error encountered when receiving server-side response

严格模式——let和const——箭头函数——解构赋值——字符串模板symbol——Set和Map——生成器函数
随机推荐
比XShell更好用、更现代的终端工具!
Merge table rows - three levels of for loop traversal data
Socket类关于TCP字符流编程的理解学习
Better and more modern terminal tools than xshell!
R语言使用lm函数构建线性回归模型、使用subset函数指定对于数据集的子集构建回归模型(使用floor函数和length函数选择数据前部分构建回归模型)
Continuous (integration -- & gt; delivery -- & gt; deployment)
最强分布式锁工具:Redisson
安全保障基于软件全生命周期-NetworkPolicy应用
How to play a data mining game entry Edition
Some thoughts on.Net desktop development
数据库系统原理与应用教程(058)—— MySQL 练习题(二):单选题
C语言:优化后的归并排序
JWT 登录认证 + Token 自动续期方案,写得太好了!
使用 IPtables 进行 DDoS 保护
vite在项目中配置路径别名
对“Image Denoising Using an Improved Generative Adversarial Network with Wasserstein Distance“的理解
Operator3-设计一个operator
UVA1599理想路径题解
Go language - Application of stack - expression evaluation
浅谈WebSocket