/// <summary> /// Creates grips /// </summary> public bool CreateGrips(PolylineCurve polylineCurve) { if (!SampleCsRectangleHelper.IsRectangle(polylineCurve)) { return(false); } if (GripCount > 0) { return(false); } Plane plane; if (!polylineCurve.TryGetPlane(out plane)) { return(false); } m_plane = plane; m_active_rectangle = new Point3d[5]; for (var i = 0; i < polylineCurve.PointCount; i++) { m_active_rectangle[i] = polylineCurve.Point(i); } m_original_rectangle = new Point3d[5]; Array.Copy(m_active_rectangle, m_original_rectangle, 5); var line = new Line(); for (var i = 0; i < 4; i++) { var gi = 2 * i; line.From = m_active_rectangle[i]; line.To = m_active_rectangle[i + 1]; m_sample_cs_rectangle_grips[gi].OriginalLocation = line.From; m_sample_cs_rectangle_grips[gi + 1].OriginalLocation = 0.5 * line.From + 0.5 * line.To; m_sample_cs_rectangle_grips[gi].Active = true; m_sample_cs_rectangle_grips[gi + 1].Active = true; } for (var i = 0; i < 8; i++) { AddGrip(m_sample_cs_rectangle_grips[i]); } return(true); }