首页 新闻 搜索 专区 学院

.net 二次开发 CAD WCS to UCS

0
悬赏园豆:15 [待解决问题]

世界坐标系WCS 如何转化 用户坐标系UCS

Code&nbspFuture的主页 Code&nbspFuture | 初学一级 | 园豆:5
提问于:2020-10-30 11:22
< >
分享
所有回答(1)
0

参考一下这个

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

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;
小小高 | 园豆:820 (小虾三级) | 2020-10-30 11:43

这个不错,不过我好像说反了。。。问题已修改

支持(0) 反对(0) Code&nbspFuture | 园豆:5 (初学一级) | 2020-11-02 14:41
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册