public static ResultBuffer SetCustomData()
{
Database db = HostApplicationServices.WorkingDatabase;
Editor ed = Bricscad.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
PromptPointResult pntOri = ed.GetPoint("\nPick 3 points of primary face/view:\nPick origin point(bottom left):");
if(pntOri.Status != PromptStatus.OK || pntOri.Status == PromptStatus.Cancel)
return null;
PromptPointResult pnt2 = ed.GetPoint("\nPick point in 'X' direction of face/view:");
if(pnt2.Status != PromptStatus.OK || pnt2.Status == PromptStatus.Cancel)
return null;
PromptPointResult pnt3 = ed.GetPoint("\nPick point in 'Y' direction of face/view:");
if(pnt3.Status != PromptStatus.OK || pnt3.Status == PromptStatus.Cancel)
return null;
Point3d or
= new Point3d
(); Point3d X
= new Point3d
(); Point3d Y
= new Point3d
(); or = Utils.UcsToWcs(pntOri.Value);
X = Utils.UcsToWcs(pnt2.Value);
Y = Utils.UcsToWcs(pnt3.Value);
Vector3d vecx
= new Vector3d
(); Vector3d vecy
= new Vector3d
(); Vector3d vecz
= new Vector3d
();
vecz = or.GetVectorTo(X).GetNormal(Tolerance.Global);
vecy = or.GetVectorTo(Y);
vecx = vecz.CrossProduct(vecy).GetNormal(Tolerance.Global);
vecy = vecx.CrossProduct(vecz).GetNormal(Tolerance.Global);
if(Utils.CheckForAppName())
{
ResultBuffer resbuf
= new ResultBuffer
(); {
Point3d pntL
= new Point3d
(or
.X,or
.Y,or
.Z); Point3d pntR
= new Point3d
(X
.X,X
.Y,X
.Z); Point3d pntX
= new Point3d
(vecx
.X,vecx
.Y,vecx
.Z); Point3d pntY
= new Point3d
(vecy
.X,vecy
.Y,vecy
.Z); Point3d pntZ
= new Point3d
(vecz
.X,vecz
.Y,vecz
.Z); resbuf
.Add(new TypedValue
(1001,Utils
.AppName)); resbuf
.Add(new TypedValue
(1011,pntL
)); resbuf
.Add(new TypedValue
(1011,pntR
)); resbuf
.Add(new TypedValue
(1013,pntX
)); resbuf
.Add(new TypedValue
(1013,pntY
)); resbuf
.Add(new TypedValue
(1013,pntZ
)); }
return resbuf;
}
else
{
Utils.PrintMessage("\nFailed to add xdata!..");
return null;
}
}