在CAD添加实体到模型空间中都是用世界坐标的点添加的。
UCS坐标是用户GetPoint()这种交互集获取得到用户坐标。
关于UCS转WCS如下:

AutoCAD .NET: Transform Picked Point from Current UCS to WCS
We are addressing a very simple task regarding AutoCAD .NET programming in this article. How to transform a picked point from the current (active) UCS to the WCS?It sounds too obvious to metion.  That was also what we thought about it, and it explains why the topic was not covered explicitly before. However, judging from some code on web, it apparently is not the case. So, let’s take a few seconds here to have a bit review about it.//...Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
Matrix3d ucs = ed.CurrentUserCoordinateSystem;PromptPointResult ppr = ed.GetPoint("\nSpecify base point: ");
if (ppr.Status != PromptStatus.OK)return;Point3d baseUcs = ppr.Value;
CoordinateSystem3d cs = ucs.CoordinateSystem3d;// Transform from UCS to WCS
Matrix3d mat =Matrix3d.AlignCoordinateSystem(Point3d.Origin,Vector3d.XAxis,Vector3d.YAxis,Vector3d.ZAxis,cs.Origin,cs.Xaxis,cs.Yaxis,cs.Zaxis);Point3d baseWcs = baseUcs.TransformBy(mat);
Point3d curPt = baseWcs;//...Checking the code there more times, got more confused about why the simple task had to be done that way, which is redundant, inefficient, and error prone. In fact, as demonstrated hundreds of times before in our posts, a single line of code can transform the picked point, ppr.Value, from the current UCS to the WCS so easily and reliably.//...Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;PromptPointResult ppr = ed.GetPoint("\nSpecify base point: ");
if (ppr.Status != PromptStatus.OK)return;Point3d curPt = ppr.Value.TransformBy(ed.CurrentUserCoordinateSystem);//...

WCS转UCS只需

Point3d UCSPoint = ppr.Value.TransformBy(ed.CurrentUserCoordinateSystem.Inverse());

参考链接:https://spiderinnet1.typepad.com/blog/2013/05/autocad-net-transform-picked-point-from-current-ucs-to-wcs.html

CAD开发 UCS转WCS(用户坐标转为世界坐标)相关推荐

  1. UE5如何将屏幕坐标转为世界坐标和世界方向

    哈喽,大家好,一起分享一下关于UE5如何将屏幕坐标转为世界坐标的方法. 屏幕坐标转为世界坐标 在PlayerControoler下找到这个函数: DeprojectScreenPositionToWo ...

  2. 【CAD开发】gltf文件格式的转换工具汇总(js、python、c++)

    文章目录 1.gltf格式简介 2.C# 代码 2.1 3dsMax/maya导出插件(Babylon.js) 2.python代码 2.1 gltflib (v2.0) 3.JavaScript代码 ...

  3. 一文让你明白CAD开发基本结构框架(CAD二次开发入门)

    想对CAD进行二次开发的你一定有这样的困惑.那就是如何入手呢?怎么用代码画图呢?又或是CAD画一个简单的图形要遵循什么步骤呢? 我认为学习任何一个东西,从整体把握都是十分重要的,哪怕刚开始慢一点,花一 ...

  4. ChatGPT工作提效之生成开发需求和报价单并转为Excel格式

    ChatGPT工作提效之生成开发需求和报价单并转为Excel格式 一.提出需求 如何撰写百度地图标注开发的需求文档 二.针对性地连续提问 推荐下一下百度地图标注文档的详细需求列表 如何撰写百度地图标注 ...

  5. C# CAD开发 世界坐标WCS和用户坐标UCS

    本人录制c#CAD二次开发视频 基础入门全套,感兴趣可以淘宝搜索店铺 PT的cad小店 https://i.xue.taobao.com/detail.htm?spm=a2174.7765247.0. ...

  6. 张正友标定Opencv实现、标定流程以及图像坐标转为世界坐标

    版权声明:本文为博主原创文章,未经博主允许不得转载. https://blog.csdn.net/xiaomifanhxx/article/details/79560693 使用相机以前,首先要进行相 ...

  7. 戏说CAD开发 最简单角度看CAD软件

    从最简单也是最平常的角度来看CAD平台的开发就会觉得其实所有的软件都差不多. 我们敲打键盘输入数字和字母,托动鼠标调整游标箭头位置. 同时,软件接受鼠标和键盘的消息,并动态的将结果显示到屏幕上.这样你 ...

  8. 网页CAD开发快速入门

    演示说明 提示:目前提供两种在网页中浏览编辑CAD图纸方案,详细说明见:MxDraw帮助 网页中打开CAD最简步骤: 第一步: 安装插件运行环境,下载安装(可能需要退杀毒软件):https://dem ...

  9. 【CAD开发】glTF和b3dm文件格式读取(C++,Python)

    文章目录 1.简介 1.1 层级结构 1.2 术语定义 2.glTF文件预览 2.1 VSCode(v2.0) 2.2 glTF Viewer(v2.0, js) 2.3 babylon.js(v2. ...

最新文章

  1. mysql引号问题_MySQL中引号的问题
  2. 图解第一个Matlab仿真实例
  3. 【示例】Lucene查询索引库编程步骤
  4. 【Apache POI】Java写入Excel文件
  5. php获取文件上传进度,PHP使用APC获取上传文件进度
  6. WARNING: Ignoring invalid distribution -ip
  7. 如何用组策略来找到丢失的文件
  8. 在线便携小电视源码 云电视源码
  9. Excel(16)-好学实用的Index!
  10. php yii2模块,Yii2 之 frontend 子模块实践之四:路由美化
  11. python输出字典_Python如何将字典键和值拆分为单独的列表?(代码示例)
  12. 完美解决Win8声卡爆音破音、卡顿
  13. Linux-Discuz安装LAMP
  14. Python数据探索性分析和预处理
  15. 景嘉微变更会计师事务所引发投资者担忧
  16. 苹果cms伪静态常见几种问题解决教程
  17. 十大人文科技类图书(转)
  18. 怎么隐藏服务器真实IP地址?
  19. Sublime插件安装与提高Verilog编写效率插件推荐
  20. 无法安全地用该源进行更新,所以默认禁用该源 E: 无法定位软件包

热门文章

  1. mysql 聚合函数求乘积_mysql-聚合函数
  2. java控制台打印输出菱形,菱形高度自定义
  3. python insert into数据库
  4. 培养良好的团队合作能力
  5. 快来为你的表格加上水印吧
  6. Proxifier逆向分析(Mac)
  7. 2022强网杯线上赛 qmachine
  8. 在手机上面安装fiddler证书
  9. 如何查看iOS手机证书安装位置
  10. adb install -r 覆盖安装Android应用