Hi, I need to take a segment of a Torus. The approach I am trying is to use the Rhino.Geometry.Brep.Trim method. However, the functions to convert a Torus into a Brep seem not to work. Both Rhino.Geometry.Brep.CreateFromTorus and Rhino.Geometry.Torus.ToBrep result in an error message “Message: ‘type’ object has no attribute ‘CreateFromTorus’”. According to Rhino documentation, both functions should be supported.
What is wrong here? Thanks.
This seems to work here:
#! python 3
import rhinoscriptsyntax as rs
import scriptcontext as sc
import Rhino
plane=Rhino.Geometry.Plane.WorldXY
torus=Rhino.Geometry.Torus(plane,50,10)
brep=torus.ToBrep()
sc.doc.Objects.AddBrep(brep)
sc.doc.Views.Redraw()
As does this:
#! python 3
import rhinoscriptsyntax as rs
import scriptcontext as sc
import Rhino
plane=Rhino.Geometry.Plane.WorldXY
torus=Rhino.Geometry.Torus(plane,50,10)
brep=Rhino.Geometry.Brep.CreateFromTorus(torus)
sc.doc.Objects.AddBrep(brep)
sc.doc.Views.Redraw()
I haven’t tried trimming, but the brep is created, no problem.
I copied your exact same code but get the error message again
What could be wrong on my side?
Hmm, odd, it works here in either the V8 new ScriptEditor (Python 3) or the old EditPythonScript (Iron Python 2). Can you run SystemInfo in Rhino and post the results here?
I tried both using EditPythonScript and ScriptEditor and get the same error message.
Here you have the SystemInfo log:
Rhino 8 SR0 2023-10-31 (Rhino 8, 8.0.23304.09001, Git hash:master @ 20e15cf9bd66e6676f849f22e485cb3e82a8beac)
License type: Commercial, build 2023-10-31
License details: Cloud Zoo
Windows 10 (10.0.19045 SR0.0) or greater (Physical RAM: 16Gb)
.NET 7.0.0
Computer platform: LAPTOP - Plugged in [100% battery remaining]
Standard graphics configuration.
Primary display and OpenGL: Intel(R) Iris(R) Xe Graphics (Intel) Memory: 128MB, Driver date: 2-21-2024 (M-D-Y). OpenGL Ver: 4.6.0 - Build 31.0.101.5333
> Integrated graphics device with 4 adapter port(s)
- Windows Main Display is laptop’s integrated screen or built-in port
- Secondary monitor attached to adapter port #1
Primary OpenGL: Intel(R) Iris(R) Xe Graphics (Intel) Memory: 128MB, Driver date: 2-21-2024 (M-D-Y). OpenGL Ver: 4.6.0 - Build 31.0.101.5333
> Integrated (slow!) graphics device with 4 adapter port(s)
- Windows Main Display is laptop’s integrated screen or built-in port
- Secondary monitor attached to adapter port #1
OpenGL Settings
Safe mode: Off
Use accelerated hardware modes: On
Redraw scene when viewports are exposed: On
Graphics level being used: OpenGL 4.6 (primary GPU’s maximum)
Anti-alias mode: 4x
Mip Map Filtering: Linear
Anisotropic Filtering Mode: High
Vendor Name: Intel
Render version: 4.6
Shading Language: 4.60 - Build 31.0.101.5333
Driver Date: 2-21-2024
Driver Version: 31.0.101.5333
Maximum Texture size: 16384 x 16384
Z-Buffer depth: 24 bits
Maximum Viewport size: 16384 x 16384
Total Video Memory: 128 MB
Rhino plugins that do not ship with Rhino
Rhino plugins that ship with Rhino
C:\Program Files\Rhino 8\Plug-ins\SolidTools.rhp “SolidTools”
C:\Program Files\Rhino 8\Plug-ins\Commands.rhp “Commands” 8.0.23304.9001
C:\Program Files\Rhino 8\Plug-ins\rdk.rhp “Renderer Development Kit”
C:\Program Files\Rhino 8\Plug-ins\RhinoRenderCycles.rhp “Rhino Render” 8.0.23304.9001
C:\Program Files\Rhino 8\Plug-ins\rdk_etoui.rhp “RDK_EtoUI” 8.0.23304.9001
C:\Program Files\Rhino 8\Plug-ins\NamedSnapshots.rhp “Snapshots”
C:\Program Files\Rhino 8\Plug-ins\MeshCommands.rhp “MeshCommands” 8.0.23304.9001
C:\Program Files\Rhino 8\Plug-ins\IronPython\RhinoDLR_Python.rhp “IronPython” 8.0.23304.9001
C:\Program Files\Rhino 8\Plug-ins\RhinoCycles.rhp “RhinoCycles” 8.0.23304.9001
C:\Program Files\Rhino 8\Plug-ins\RhinoCode\RhinoCodePlugin.rhp “RhinoCodePlugin” 8.0.23304.9001
C:\Program Files\Rhino 8\Plug-ins\Toolbars\Toolbars.rhp “Toolbars” 8.0.23304.9001
C:\Program Files\Rhino 8\Plug-ins\3dxrhino.rhp “3Dconnexion 3D Mouse”
C:\Program Files\Rhino 8\Plug-ins\Displacement.rhp “Displacement”
C:\Program Files\Rhino 8\Plug-ins\SectionTools.rhp “SectionTools”
Thanks!
First thing is to update your Rhino, we’re on SR 9…
Note also that your video card is totally inadequate for Rhino… writing scripts might work, but running them and creating objects that will be seen onscreen may not…
Updating Rhino solved the problem… Thanks!