Using the CreatePoint function from the Point Collection using two curves can produce unexpected results.
NXOpen.Point | NXOpen.PointCollection.CreatePoint | ( | NXOpen.IBaseCurve | curve1 |
NXOpen.IBaseCurve | curve2 | |||
NXOpen.Point | helpPt1 | |||
NXOpen.Point | helpPt2 | |||
NXOpen.SmartObject.UpdateOption | updateOption | |||
) |
Point3d pt3d_1 = new Point3d(0.0, 0.0, 0.0); Point3d pt3d_2 = new Point3d(3.0, 3.0, 3.0); Point3d pt3d_3 = new Point3d(2.0, 0.0, 0.0); Point3d pt3d_4 = new Point3d(2.0, 3.0, 3.0); Point point_1 = workPart.Points.CreatePoint(pt3d_1); Point point_2 = workPart.Points.CreatePoint(pt3d_2); Point point_3 = workPart.Points.CreatePoint(pt3d_3); Point point_4 = workPart.Points.CreatePoint(pt3d_4); Line line_12 = workPart.Curves.CreateLine(point_1, point_2); Line line_34 = workPart.Curves.CreateLine(point_3, point_4);
Point answerPt = workPart.Points.CreatePoint(line_12, line_34, nullPt, nullPt, SmartObject.UpdateOption.WithinModeling);Produces the expected point at coordinates [ 2.0, 2.0, 2.0 ] because the line segments intersect in 3D space
Point3d pt3d_5 = new Point3d(0.0, 0.0, 0.0); Point3d pt3d_6 = new Point3d(1.0, 1.0, 1.0); Point3d pt3d_7 = new Point3d(2.0, 0.0, 0.0); Point3d pt3d_8 = new Point3d(2.0, 1.0, 1.0); Point point_5 = workPart.Points.CreatePoint(pt3d_5); Point point_6 = workPart.Points.CreatePoint(pt3d_6); Point point_7 = workPart.Points.CreatePoint(pt3d_7); Point point_8 = workPart.Points.CreatePoint(pt3d_8); Line line_56 = workPart.Curves.CreateLine(point_5, point_6); Line line_78 = workPart.Curves.CreateLine(point_7, point_8);
Point answerPt = workPart.Points.CreatePoint(line_56, line_78, nullPt, nullPt, SmartObject.UpdateOption.WithinModeling);Throws an exception. Even though the projected lines of these segments intersect, the actual segments do not intersect.
Point3d pt3d_5 = new Point3d(0.0, 0.0, 0.0); Point3d pt3d_6 = new Point3d(1.0, 1.0, 1.0); Point3d pt3d_7 = new Point3d(2.0, 0.0, 0.0); Point3d pt3d_8 = new Point3d(2.0, 1.0, 1.0); Point point_5 = workPart.Points.CreatePoint(pt3d_5); Point point_6 = workPart.Points.CreatePoint(pt3d_6); Point point_7 = workPart.Points.CreatePoint(pt3d_7); Point point_8 = workPart.Points.CreatePoint(pt3d_8); InfiniteLine line_9 = workPart.Curves.CreateInfiniteLine(pt3d_5, pt3d_6); InfiniteLine line_10 = workPart.Curves.CreateInfiniteLine(pt3d_7, pt3d_8);
Point answerPt = workPart.Points.CreatePoint(line_9, line_10, nullPt, nullPt, SmartObject.UpdateOption.WithinModeling);Produces the expected point at coordinates [ 2.0, 2.0, 2.0 ], though the segments do not intersect, using an infinite lines using the segment values produces the desired value.