public override bool CustomGeometryFilter(IRhinoObject obj, IOnGeometry geo, OnCOMPONENT_INDEX ci)
 {
     if (obj != null)
     {
         if (obj.IsSolid())
         {
             return(true);
         }
     }
     return(false);
 }
        ///<summary> This gets called when when the user runs this command.</summary>
        public override IRhinoCommand.result RunCommand(IRhinoCommandContext context)
        {
            string path  = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
            int    count = 0;

            context.m_doc.UnselectAll();

            MRhinoObjectIterator it = new MRhinoObjectIterator(
                IRhinoObjectIterator.object_state.normal_objects,
                IRhinoObjectIterator.object_category.active_objects
                );

            IRhinoObject obj = null;

            for (obj = it.First(); null != obj; obj = it.Next())
            {
                if (obj.IsSolid())
                {
                    IOn.object_type type = obj.ObjectType();
                    if (type == IOn.object_type.surface_object || type == IOn.object_type.brep_object)
                    {
                        obj.Select(true);

                        string fname  = string.Format("{0}\\rhino_sat_export_{1}.sat", path, count++);
                        string script = string.Format("_-Export \"{0}\" Inventor _Enter", fname);
                        RhUtil.RhinoApp().RunScript(script, 1);

                        obj.Select(false);
                    }
                }
            }

            context.m_doc.Redraw();


            return(IRhinoCommand.result.success);
        }
예제 #3
0
        /// <summary>
        /// Calculates the volume of an object
        /// </summary>
        public static double GetVolume(IRhinoObject obj)
        {
            if (null != obj && obj.IsSolid())
            {
                IOnSurface srf = OnSurface.ConstCast(obj.Geometry());
                if (null != srf)
                {
                    return(GetSurfaceVolume(srf));
                }

                IOnBrep brep = OnBrep.ConstCast(obj.Geometry());
                if (null != brep)
                {
                    return(GetBrepVolume(brep));
                }

                IOnMesh mesh = OnMesh.ConstCast(obj.Geometry());
                if (null != mesh)
                {
                    return(GetMeshVolume(mesh));
                }
            }
            return(0.0);
        }
        /// <summary>
        /// Calculates the volume of an object
        /// </summary>
        public static double GetVolume(IRhinoObject obj)
        {
            if (null != obj && obj.IsSolid())
              {
            IOnSurface srf = OnSurface.ConstCast(obj.Geometry());
            if (null != srf)
              return GetSurfaceVolume(srf);

            IOnBrep brep = OnBrep.ConstCast(obj.Geometry());
            if (null != brep)
              return GetBrepVolume(brep);

            IOnMesh mesh = OnMesh.ConstCast(obj.Geometry());
            if (null != mesh)
              return GetMeshVolume(mesh);
              }
              return 0.0;
        }
 public override bool CustomGeometryFilter(IRhinoObject obj, IOnGeometry geo, OnCOMPONENT_INDEX ci)
 {
     if (obj != null)
       {
     if (obj.IsSolid() )
       return true;
       }
       return false;
 }