ConvertToOn3dPoint() public static method

Convert an object to an On3dPoint
public static ConvertToOn3dPoint ( object pointObj, On3dPoint &point ) : bool
pointObj object
point On3dPoint
return bool
示例#1
0
        /// <summary>
        /// Add a 3-D point to the document
        /// </summary>
        public object AddPoint(object pointObj)
        {
            On3dPoint point = new On3dPoint();

            if (SampleCsRhinoScriptUtils.ConvertToOn3dPoint(pointObj, ref point))
            {
                MRhinoDoc doc = RhUtil.RhinoApp().ActiveDoc();
                if (null != doc)
                {
                    MRhinoObject rhinoObj = doc.AddPointObject(point);
                    if (null != rhinoObj)
                    {
                        doc.Redraw();
                        return(rhinoObj.ModelObjectId().ToString());
                    }
                }
            }
            return(null);
        }
        /// <summary>
        /// Convert an object to an On3dPointArray
        /// </summary>
        static public bool ConvertToOn3dPointArray(object pointsObj, ref On3dPointArray points)
        {
            bool  rc          = false;
            int   pointsCount = points.Count();
            Array pointsArr   = pointsObj as Array;

            if (null != pointsArr)
            {
                for (int i = 0; i < pointsArr.Length; i++)
                {
                    On3dPoint point = new On3dPoint();
                    if (SampleCsRhinoScriptUtils.ConvertToOn3dPoint(pointsArr.GetValue(i), ref point))
                    {
                        points.Append(point);
                    }
                }
                rc = (points.Count() - pointsCount > 0);
            }
            return(rc);
        }