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