当前位置: 首页>>代码示例>>C#>>正文


C# Editor.UCS2WCS方法代码示例

本文整理汇总了C#中Editor.UCS2WCS方法的典型用法代码示例。如果您正苦于以下问题:C# Editor.UCS2WCS方法的具体用法?C# Editor.UCS2WCS怎么用?C# Editor.UCS2WCS使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Editor的用法示例。


在下文中一共展示了Editor.UCS2WCS方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Trans

 /// <summary>
 /// Transforms a point from a coordinate system to another one in the specified editor.
 /// </summary>
 /// <param name="pt">The instance to which the method applies.</param>
 /// <param name="ed">An instance of the Editor to which the method applies.</param>
 /// <param name="from">The origin coordinate system.</param>
 /// <param name="to">The target coordinate system.</param>
 /// <returns>The corresponding 3d point.</returns>
 /// <exception cref="Autodesk.AutoCAD.Runtime.Exception">
 /// eInvalidInput is thrown if CoordSystem.PSDCS is used with other than CoordSystem.DCS.</exception>
 public static Point3d Trans(this Point3d pt, Editor ed, CoordSystem from, CoordSystem to)
 {
     Matrix3d mat = new Matrix3d();
     switch (from)
     {
         case CoordSystem.WCS:
             switch (to)
             {
                 case CoordSystem.UCS:
                     mat = ed.WCS2UCS();
                     break;
                 case CoordSystem.DCS:
                     mat = ed.WCS2DCS();
                     break;
                 case CoordSystem.PSDCS:
                     throw new AcRx.Exception(
                         AcRx.ErrorStatus.InvalidInput,
                         "To be used only with DCS");
                 default:
                     mat = Matrix3d.Identity;
                     break;
             }
             break;
         case CoordSystem.UCS:
             switch (to)
             {
                 case CoordSystem.WCS:
                     mat = ed.UCS2WCS();
                     break;
                 case CoordSystem.DCS:
                     mat = ed.UCS2WCS() * ed.WCS2DCS();
                     break;
                 case CoordSystem.PSDCS:
                     throw new AcRx.Exception(
                         AcRx.ErrorStatus.InvalidInput,
                         "To be used only with DCS");
                 default:
                     mat = Matrix3d.Identity;
                     break;
             }
             break;
         case CoordSystem.DCS:
             switch (to)
             {
                 case CoordSystem.WCS:
                     mat = ed.DCS2WCS();
                     break;
                 case CoordSystem.UCS:
                     mat = ed.DCS2WCS() * ed.WCS2UCS();
                     break;
                 case CoordSystem.PSDCS:
                     mat = ed.DCS2PSDCS();
                     break;
                 default:
                     mat = Matrix3d.Identity;
                     break;
             }
             break;
         case CoordSystem.PSDCS:
             switch (to)
             {
                 case CoordSystem.WCS:
                     throw new AcRx.Exception(
                         AcRx.ErrorStatus.InvalidInput,
                         "To be used only with DCS");
                 case CoordSystem.UCS:
                     throw new AcRx.Exception(
                         AcRx.ErrorStatus.InvalidInput,
                         "To be used only with DCS");
                 case CoordSystem.DCS:
                     mat = ed.PSDCS2DCS();
                     break;
                 default:
                     mat = Matrix3d.Identity;
                     break;
             }
             break;
     }
     return pt.TransformBy(mat);
 }
开发者ID:vildar82,项目名称:AcadLib,代码行数:90,代码来源:Point3dExtensions.cs


注:本文中的Editor.UCS2WCS方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。