예제 #1
0
 protected override Result RunCommand(RhinoDoc doc, RunMode mode)
 {
     // TODO: start here modifying the behaviour of your command.
     //Select objects
     try
     {
         GetObject go = new GetObject();
         go.EnablePreSelect(true, true);
         go.EnablePostSelect(true);
         go.SetCommandPrompt("Super Intersection | Advanced Boolean Intersection:");
         go.GetMultiple(1, 0);
         if (go.ObjectCount > 0)
         {
             RhinoApp.RunScript("_BooleanIntersection", true);
             RhinoApp.RunScript("_SelLast", true);
             RhinoApp.RunScript("_MergeAllFaces", true);
             RhinoApp.RunScript("_ShrinkTrimmedSrf", true);
         }
         return(Result.Success);
     }
     catch
     {
         return(Result.Failure);
     }
 }
예제 #2
0
        //==============================
        private Curve[] GetCurves()
        {
            GetObject go = new GetObject();

            go.GeometryFilter = Rhino.DocObjects.ObjectType.Curve;
            go.SetCommandPrompt("Hyper Split | Split All Curves With One Another:");
            go.EnablePreSelect(true, true);
            go.EnablePostSelect(true);
            go.GetMultiple(1, 0);

            Curve[] CurveSel = new Curve[go.ObjectCount];
            TempRef = go.Objects();
            for (int i = 0; i < go.ObjectCount; i++)
            {
                CurveSel[i] = go.Object(i).Curve();
            }

            return(CurveSel);
        }
예제 #3
0
        protected override Result RunCommand(RhinoDoc doc, RunMode mode)
        {
            // TODO: start here modifying the behaviour of your command.
            //Select objects
            try
            {
                GetObject go = new GetObject();
                go.EnablePreSelect(true, true);
                go.EnablePostSelect(true);
                go.SetCommandPrompt("Select Objects to Export:");
                go.GetMultiple(1, 0);
                if (go.ObjectCount > 0)
                {
                    List <String> GeometryRecord = new List <String>();
                    for (int i = 0; i < go.ObjectCount; i++)
                    {
                        ObjRef oref    = new ObjRef(go.Object(i).ObjectId);
                        String objname = oref.Object().Geometry.ObjectType.ToString();
                        GeometryRecord.Add(objname);
                    }

                    List <String> GeoStatement = new List <String>();
                    var           GROccur      = GeometryRecord.GroupBy(i => i);
                    {
                        foreach (var i in GROccur)
                        {
                            String GeoStat = i.Key + " x " + i.Count().ToString();
                            GeoStatement.Add(GeoStat);
                        }
                    }
                    FormSuperExport FSE = new FormSuperExport();
                    FSE.SelectedItemNames = GeoStatement;
                    FSE.ItemCount         = GeometryRecord.Count;
                    if (FSE.ShowDialog() == DialogResult.OK)
                    {
                        for (int i = 0; i < FSE.ItemCount; i++)
                        {
                            RhinoDoc.ActiveDoc.Objects.UnselectAll();
                            RhinoDoc.ActiveDoc.Objects.Select(go.Object(i).ObjectId);
                            String Scri = String.Format("-_Export \"{0}\"", FSE.FullPath[i]);
                            RhinoApp.RunScript("-_Export \"" + FSE.FullPath[i] + "\" Enter Enter ", true);
                        }
                        RhinoDoc.ActiveDoc.Objects.UnselectAll();
                        doc.Views.Redraw();
                        RhinoApp.WriteLine("Super Export Completed", EnglishName);
                        return(Result.Success);
                    }
                    else
                    {
                        return(Result.Failure);
                    }
                }
                else
                {
                    RhinoApp.WriteLine("Nothing Selected, Operation Cancelled");
                    return(Result.Failure);
                }
            }
            catch
            {
                return(Result.Failure);
            }
        }