예제 #1
0
        public int ExplodeHatch(MRhinoDoc doc, Guid hatchGuid, ref List <Guid> objectGuids)
        {
            int objectGuids_Count = objectGuids.Count;

            if (null != doc)
            {
                IRhinoHatch hatchObject = MRhinoHatch.ConstCast(doc.LookupObject(hatchGuid));
                if (null != hatchObject)
                {
                    MRhinoObject[] subObjects       = null;
                    int            subObjects_Count = hatchObject.GetSubObjects(out subObjects);
                    if (0 < subObjects_Count || null != subObjects)
                    {
                        for (int i = 0; i < subObjects_Count; i++)
                        {
                            bool rc = doc.AddObject(subObjects[i]);
                            if (rc)
                            {
                                objectGuids.Add(subObjects[i].Attributes().m_uuid);
                            }
                        }
                    }
                }
            }

            return(objectGuids.Count - objectGuids_Count);
        }
예제 #2
0
        ///<summary> This gets called when when the user runs this command.</summary>
        public override IRhinoCommand.result RunCommand(IRhinoCommandContext context)
        {
            MRhinoGetObject go = new MRhinoGetObject();

            go.SetCommandPrompt("Select hatch to explode");
            go.SetGeometryFilter(IRhinoGetObject.GEOMETRY_TYPE_FILTER.hatch_object);
            go.GetObjects(1, 1);
            if (go.CommandResult() != IRhinoCommand.result.success)
            {
                return(go.CommandResult());
            }

            IRhinoHatch hatchObject = MRhinoHatch.ConstCast(go.Object(0).Object());

            if (null == hatchObject)
            {
                return(IRhinoCommand.result.failure);
            }

            List <Guid> objectGuids       = new List <Guid>();
            int         objectGuids_Count = ExplodeHatch(context.m_doc, hatchObject.Attributes().m_uuid, ref objectGuids);

            return(IRhinoCommand.result.success);
        }