本篇介绍两个比较需要关注的方面:
一、坐标系:
1 var workPlane = compDef.WorkPlanes[1]; //YZ平面
2 //var workPlane = compDef.WorkPlanes[2]; //XZ平面
3 //var workPlane = compDef.WorkPlanes[3]; //XY平面
4 PlanarSketch sketch2d = compDef.Sketches.Add(workPlane);
5 sketch2d.SketchLines.AddByTwoPoints(tranGeo.CreatePoint2d(0, 0), tranGeo.CreatePoint2d(1, 1));
YZ平面上直线(0,0)-(1,1)
XZ平面上直线(0,0)-(1,1)
XY平面上直线(0,0)-(1,1)
从上面结果可以知道,XZ平面上X坐标是反的!!!
二、长度单位:
1 var workPlane = compDef.WorkPlanes[3]; //XY平面
2 PlanarSketch sketch2d = compDef.Sketches.Add(workPlane);
3 sketch2d.SketchLines.AddByTwoPoints(tranGeo.CreatePoint2d(0, 0), tranGeo.CreatePoint2d(1, 1));
从上面结果可以知道,程序中的单位是cm!!!