Set Angled UCS

Set Angled UCS

abdulhaseeb114
Contributor Contributor
704 Views
2 Replies
Message 1 of 3

Set Angled UCS

abdulhaseeb114
Contributor
Contributor

 

 

 

Hi,

 

I am getting 3 points from user and then I need to set the UCS in angled as shown in the picture

 

AngUcs.PNG

 

Please Help Me.....

 

0 Likes
Accepted solutions (1)
705 Views
2 Replies
Replies (2)
Message 2 of 3

kerry_w_brown
Advisor
Advisor

 

Have you tried something like this :

https://knowledge.autodesk.com/search-result/caas/CloudHelp/cloudhelp/2015/ENU/AutoCAD-NET/files/GUI...

 

Regards,

 


// Called Kerry or kdub in my other life.

Everything will work just as you expect it to, unless your expectations are incorrect. ~ kdub
Sometimes the question is more important than the answer. ~ kdub

NZST UTC+12 : class keyThumper<T> : Lazy<T>;      another  Swamper
0 Likes
Message 3 of 3

_gile
Consultant
Consultant
Accepted solution

Hi,

 

Maybe this is more readable:

 

private Matrix3d Ucs3Points(Point3d origin, Point3d pointX, Point3d pointY)
{
    Vector3d toXAxis = origin.GetVectorTo(pointX).GetNormal();
    Vector3d toZAxis = toXAxis.CrossProduct(origin.GetVectorTo(pointY)).GetNormal();
    Vector3d toYAxis = toZAxis.CrossProduct(toXAxis).GetNormal();
    return Matrix3d.AlignCoordinateSystem(
        Point3d.Origin, Vector3d.XAxis, Vector3d.YAxis, Vector3d.ZAxis,
        origin, toXAxis, toYAxis, toZAxis);
}

 

Use with current UCS defined points (e.g. got with ed.GetPoint()):

ed.CurrentUserCoordinateSystem *= Ucs3Points(org, ptX, ptY);

Use with WCS defined points:

ed.CurrentUserCoordinateSystem = Ucs3Points(org, ptX, ptY);


Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub