예제 #1
0
        /// <summary>
        /// Add an array of 3-D points to the document
        /// </summary>
        public object AddPoints(object pointsObj)
        {
            On3dPointArray points = new On3dPointArray();

            if (SampleCsRhinoScriptUtils.ConvertToOn3dPointArray(pointsObj, ref points))
            {
                MRhinoDoc doc = RhUtil.RhinoApp().ActiveDoc();
                if (null != doc)
                {
                    ArrayList objectIds = new ArrayList();
                    for (int i = 0; i < points.Count(); i++)
                    {
                        MRhinoObject rhinoObj = doc.AddPointObject(points[i]);
                        if (null != rhinoObj)
                        {
                            objectIds.Add(rhinoObj.ModelObjectId().ToString());
                        }
                    }
                    if (objectIds.Count > 0)
                    {
                        doc.Redraw();
                        return(objectIds.ToArray());
                    }
                }
            }
            return(null);
        }
예제 #2
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);
        }