[DllImport("acad.exe", CallingConvention = CallingConvention.Cdecl)]
private static extern int acedTrans(
double[] point,
IntPtr fromResbuf,
IntPtr toResbuf,
int displacement,
double[] result
);
public enum CoordSystem
{
WCS = 0,
UCS,
DCS,
PSDCS
}
// Coordinates System / Coordinates System
public static Point3d Trans(this Point3d pt, CoordSystem from, CoordSystem to)
{
double[] result
= new double[] { 0,
0,
0 }; acedTrans(pt.ToArray(),
new ResultBuffer
(new TypedValue
(5003,
from)).UnmanagedObject,
new ResultBuffer
(new TypedValue
(5003, to
)).UnmanagedObject,
0,
result);
return new Point3d
(result
); }
// Coordinates System / Coordinates System (displacement)
public static Point3d Trans(this Point3d pt, CoordSystem from, CoordSystem to, int disp)
{
double[] result
= new double[] { 0,
0,
0 }; acedTrans(pt.ToArray(),
new ResultBuffer
(new TypedValue
(5003,
from)).UnmanagedObject,
new ResultBuffer
(new TypedValue
(5003, to
)).UnmanagedObject,
disp,
result);
return new Point3d
(result
); }
// Entity / Entity
public static Point3d Trans(this Point3d pt, ObjectId from, ObjectId to)
{
double[] result
= new double[] { 0,
0,
0 }; acedTrans(pt.ToArray(),
new ResultBuffer
(new TypedValue
(5006,
from)).UnmanagedObject,
new ResultBuffer
(new TypedValue
(5006, to
)).UnmanagedObject,
0,
result);
return new Point3d
(result
); }
// Entity / Entity (displacement)
public static Point3d Trans(this Point3d pt, ObjectId from, ObjectId to, int disp)
{
double[] result
= new double[] { 0,
0,
0 }; acedTrans(pt.ToArray(),
new ResultBuffer
(new TypedValue
(5006,
from)).UnmanagedObject,
new ResultBuffer
(new TypedValue
(5006, to
)).UnmanagedObject,
disp,
result);
return new Point3d
(result
); }
// Vector / Vector
public static Point3d Trans(this Point3d pt, Vector3d from, Vector3d to)
{
double[] result
= new double[] { 0,
0,
0 }; acedTrans(pt.ToArray(),
new ResultBuffer
(new TypedValue
(5009,
new Point3d
(from.X,
from.Y,
from.Z))).UnmanagedObject,
new ResultBuffer
(new TypedValue
(5009,
new Point3d
(to
.X, to
.Y, to
.Z))).UnmanagedObject,
0,
result);
return new Point3d
(result
); }
// Vector / Vector (displacement)
public static Point3d Trans(this Point3d pt, Vector3d from, Vector3d to, int disp)
{
double[] result
= new double[] { 0,
0,
0 }; acedTrans(pt.ToArray(),
new ResultBuffer
(new TypedValue
(5009,
new Point3d
(from.X,
from.Y,
from.Z))).UnmanagedObject,
new ResultBuffer
(new TypedValue
(5009,
new Point3d
(to
.X, to
.Y, to
.Z))).UnmanagedObject,
disp,
result);
return new Point3d
(result
); }
// Entity / Coordinates System
public static Point3d Trans(this Point3d pt, ObjectId from, CoordSystem to)
{
double[] result
= new double[] { 0,
0,
0 }; acedTrans(pt.ToArray(),
new ResultBuffer
(new TypedValue
(5006,
from)).UnmanagedObject,
new ResultBuffer
(new TypedValue
(5003, to
)).UnmanagedObject,
0,
result);
return new Point3d
(result
); }
// Entity / Coordinates System (displacement)
public static Point3d Trans(this Point3d pt, ObjectId from, CoordSystem to, int disp)
{
double[] result
= new double[] { 0,
0,
0 }; acedTrans(pt.ToArray(),
new ResultBuffer
(new TypedValue
(5006,
from)).UnmanagedObject,
new ResultBuffer
(new TypedValue
(5003, to
)).UnmanagedObject,
disp,
result);
return new Point3d
(result
); }
// Coordinates System / Entity
public static Point3d Trans(this Point3d pt, CoordSystem from, ObjectId to)
{
double[] result
= new double[] { 0,
0,
0 }; acedTrans(pt.ToArray(),
new ResultBuffer
(new TypedValue
(5003,
from)).UnmanagedObject,
new ResultBuffer
(new TypedValue
(5006, to
)).UnmanagedObject,
0,
result);
return new Point3d
(result
); }
// Coordinates System / Entity (displacement)
public static Point3d Trans(this Point3d pt, CoordSystem from, ObjectId to, int disp)
{
double[] result
= new double[] { 0,
0,
0 }; acedTrans(pt.ToArray(),
new ResultBuffer
(new TypedValue
(5003,
from)).UnmanagedObject,
new ResultBuffer
(new TypedValue
(5006, to
)).UnmanagedObject,
disp,
result);
return new Point3d
(result
); }
// Coordinates System / Vector)
public static Point3d Trans(this Point3d pt, CoordSystem from, Vector3d to)
{
double[] result
= new double[] { 0,
0,
0 }; acedTrans(pt.ToArray(),
new ResultBuffer
(new TypedValue
(5003,
from)).UnmanagedObject,
new ResultBuffer
(new TypedValue
(5009,
new Point3d
(to
.X, to
.Y, to
.Z))).UnmanagedObject,
0,
result);
return new Point3d
(result
); }
// Coordinates System / Vector (displacement)
public static Point3d Trans(this Point3d pt, CoordSystem from, Vector3d to, int disp)
{
double[] result
= new double[] { 0,
0,
0 }; acedTrans(pt.ToArray(),
new ResultBuffer
(new TypedValue
(5003,
from)).UnmanagedObject,
new ResultBuffer
(new TypedValue
(5009,
new Point3d
(to
.X, to
.Y, to
.Z))).UnmanagedObject,
disp,
result);
return new Point3d
(result
); }
// Vector / Coordinates System
public static Point3d Trans(this Point3d pt, Vector3d from, CoordSystem to)
{
double[] result
= new double[] { 0,
0,
0 }; acedTrans(pt.ToArray(),
new ResultBuffer
(new TypedValue
(5009,
new Point3d
(from.X,
from.Y,
from.Z))).UnmanagedObject,
new ResultBuffer
(new TypedValue
(5003, to
)).UnmanagedObject,
0,
result);
return new Point3d
(result
); }
// Vector / Coordinates System (displacement)
public static Point3d Trans(this Point3d pt, Vector3d from, CoordSystem to, int disp)
{
double[] result
= new double[] { 0,
0,
0 }; acedTrans(pt.ToArray(),
new ResultBuffer
(new TypedValue
(5009,
new Point3d
(from.X,
from.Y,
from.Z))).UnmanagedObject,
new ResultBuffer
(new TypedValue
(5003, to
)).UnmanagedObject,
disp,
result);
return new Point3d
(result
); }
// Entity / Vector
public static Point3d Trans(this Point3d pt, ObjectId from, Vector3d to)
{
double[] result
= new double[] { 0,
0,
0 }; acedTrans(pt.ToArray(),
new ResultBuffer
(new TypedValue
(5006,
from)).UnmanagedObject,
new ResultBuffer
(new TypedValue
(5009,
new Point3d
(to
.X, to
.Y, to
.Z))).UnmanagedObject,
0,
result);
return new Point3d
(result
); }
// Entity / Vector (displacement)
public static Point3d Trans(this Point3d pt, ObjectId from, Vector3d to, int disp)
{
double[] result
= new double[] { 0,
0,
0 }; acedTrans(pt.ToArray(),
new ResultBuffer
(new TypedValue
(5006,
from)).UnmanagedObject,
new ResultBuffer
(new TypedValue
(5009,
new Point3d
(to
.X, to
.Y, to
.Z))).UnmanagedObject,
disp,
result);
return new Point3d
(result
); }
// Vector / Entity
public static Point3d Trans(this Point3d pt, Vector3d from, ObjectId to)
{
double[] result
= new double[] { 0,
0,
0 }; acedTrans(pt.ToArray(),
new ResultBuffer
(new TypedValue
(5009,
new Point3d
(from.X,
from.Y,
from.Z))).UnmanagedObject,
new ResultBuffer
(new TypedValue
(5006, to
)).UnmanagedObject,
0,
result);
return new Point3d
(result
); }
// Vector / Entity (displacement)
public static Point3d Trans(this Point3d pt, Vector3d from, ObjectId to, int disp)
{
double[] result
= new double[] { 0,
0,
0 }; acedTrans(pt.ToArray(),
new ResultBuffer
(new TypedValue
(5009,
new Point3d
(from.X,
from.Y,
from.Z))).UnmanagedObject,
new ResultBuffer
(new TypedValue
(5006, to
)).UnmanagedObject,
disp,
result);
return new Point3d
(result
); }