public override List <OCgp_Pnt> GetMagicPoints() { if (_array1OfVertex.Length() == 2) { List <OCgp_Pnt> list = new List <OCgp_Pnt>(); list.Add(new OCgp_Pnt(_array1OfVertex.Value(1).X(), _array1OfVertex.Value(1).Y(), 0)); list.Add(new OCgp_Pnt(_array1OfVertex.Value(2).X(), _array1OfVertex.Value(2).Y(), 0)); return(list); } return(null); }
/// <summary> /// Used to access the rectangle vertexes. The array passed as parameter is filled with the vertexes. /// </summary> /// <param name="vertexArray"></param> public void GetVertexes(OCGraphic2d_Array1OfVertex vertexArray) { if (_array1OfVertex.Length() == vertexArray.Length()) { //TODO: the loop condition is not <= !? for (int i = 1; i < _array1OfVertex.Length(); i++) { vertexArray.SetValue(i, new OCGraphic2d_Vertex(_array1OfVertex.Value(i).X(), _array1OfVertex.Value(i).Y())); } } }
int UpdateLinePosition(Node L, OCgp_Ax2 ax2, OCGraphic2d_Array1OfVertex vertexArray) { L.Update <StringInterpreter>().Value = DisplayedShapeNames.Line; var lineDriver = L.Update <FunctionInterpreter>(); lineDriver.Name = "Line"; lineDriver.BeginUpdate(); // Create the data structure : Set the dimensions, position and name attributes OCgp_Pnt point1 = GeomUtils.VertexToPnt(vertexArray.Value(1), ax2); lineDriver.Dependency.Child(1).Geometry = point1; OCgp_Pnt point2 = GeomUtils.VertexToPnt(vertexArray.Value(2), ax2); lineDriver.Dependency.Child(2).Geometry = point2; if (lineDriver.Execute() != 0) { // TODO: Handle the error } return(0); }