WorkPlane orientation in C#

Top  Previous  Next

Here is some code which gets the a named WorkPlane in a part:

 

 

           string sEndPlateFullFileName = GetPartFullFileName(sEndPlateCode);

           PartComponentDefinition PartDef = null;

           PartDocument EndPlateDoc = CInvHelp.OpenPart(sEndPlateFullFileName, out PartDef);

 

           WorkPlane EndPlatePlane = PartDef.WorkPlanes["EndPlatePlane"];

 

           // Point WPOrigin = null ;

           UnitVector XAxis = null;

           UnitVector YAxis = null;

 

           EndPlatePlane.GetPosition(out _, out XAxis, out YAxis);

 

 

           string sXaxis = string.Format("XAxis {0:0.0}  {1:0.0}  {2:0.0}", XAxis.X, XAxis.Y, XAxis.Z);

           Debug.WriteLine(sXaxis);

 

           string sYaxis = string.Format("YAxis {0:0.0}  {1:0.0}  {2:0.0}", YAxis.X, YAxis.Y, YAxis.Z);

           Debug.WriteLine(sYaxis);

 

 

And here are two examples of what those two vectors mean:

 

WorkPlane_Axes-A

 

WorkPlane_Axes-B

 

 

Text, images and diagrams © 2021 Owen F. Ransen. All rights reserved. (But copy the source code as much as you want!)