The following import works in the old python scripting component, but breaks in the python3 component.
from Rhino.Geometry.Intersect.Intersection import BrepBrep, BrepPlane
This does not throw an error, but when referenced via the help function prints a ‘MethodBinding’ import Rhino print(help(Rhino.Geometry.Intersect.Intersection.BrepBrep))
That worked, but I guess I am wondering why namespace.class syntax worked in py 2, but not py3 - is this a change in what python 3 allows or a difference in the scripting component?
These (both class imports) worked in the old component:
#! python 2
from Rhino.Geometry.Intersect.Intersection import BrepBrep, BrepPlane
from Rhino.Geometry.Transform import Translation
@ChristopherConnock The import mechanism in Python 3 is much more complicated than python 2. It basically requires all the names immediately in front of the import keyword to be python modules. So:
import os.path works because both os and path are modules
import math.pi does not work since pi is a type inside math module and is not a module itself. Python 3 would throw an error like this
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'math.pi'; 'math' is not a package