pyRevit: CPython (Python 3) equivalent of the IronPython (Python 2) "import clr"

Good day.

In IronPython, the clr module points to the following:

SCRIPT:

import clr
print(dir(clr)

OUTPUT:

[‘AddReference’, ‘AddReferenceByName’, ‘AddReferenceByPartialName’, ‘AddReferenceToFile’, ‘AddReferenceToFileAndPath’, ‘AddReferenceToTypeLibrary’, ‘ArgChecker’, ‘ClearProfilerData’, ‘CompileModules’, ‘CompileSubclassTypes’, ‘Convert’, ‘Deserialize’, ‘Dir’, ‘DirClr’, ‘EnableProfiler’, ‘GetBytes’, ‘GetClrType’, ‘GetCurrentRuntime’, ‘GetDynamicType’, ‘GetProfilerData’, ‘GetPythonType’, ‘GetString’, ‘GetSubclassedTypes’, ‘ImportExtensions’, ‘IsNetStandard’, ‘LoadAssemblyByName’, ‘LoadAssemblyByPartialName’, ‘LoadAssemblyFromFile’, ‘LoadAssemblyFromFileWithPath’, ‘LoadTypeLibrary’, ‘Reference’, ‘References’, ‘ReferencesList’, ‘ReturnChecker’, ‘RuntimeArgChecker’, ‘RuntimeReturnChecker’, ‘Self’, ‘Serialize’, ‘SetCommandDispatcher’, ‘StrongBox’, ‘Use’, ’ name ', ’ package ', ‘accepts’, ‘returns’]

When running this with CPython, it seems to point to a completely different module (I believe pythonnet).

SCRIPT:

#! python3
import clr
print(dir(clr)

OUTPUT:

– too long to post here, but not the same as the first output.

My question is what is the equivalent module or method to obtain the correct clr module?

Sample code that works in IronPython (Python 2) is:

SCRIPT:
from Autodesk.Revit import DB
import clr

start_point = DB.XYZ(float(50),float(0),float(0))
end_point = DB.XYZ(float(50),float(80),float(0))
start_point2 = DB.XYZ(float(0),float(50),float(0))
end_point2 = DB.XYZ(float(80),float(50),float(0))

line = DB.Line.CreateBound(start_point, end_point)
line2 = DB.Line.CreateBound(start_point2, end_point2)

resultArray = clr.ReferenceDB.IntersectionResultArray

result = line.Intersect(line2, resultArray)
print(result)
print(resultArray.IsEmpty)
print(resultArray.Item[0].XYZPoint)

OUT:
Overlap
False
(50.000000000, 50.000000000, 0.000000000)

The same code in CPython (Python 3) (#! python3 first line) returns an error, so if I change the script a bit ( resultArray = DB.IntersectionResultArray() ), I can find that they overlap, but the IsEmpty returns a TRUE and then cannot find the intersection:

SCRIPT:
#! python3

test2

from Autodesk.Revit import DB
import clr

start_point = DB.XYZ(float(50),float(0),float(0))
end_point = DB.XYZ(float(50),float(80),float(0))
start_point2 = DB.XYZ(float(0),float(50),float(0))
end_point2 = DB.XYZ(float(80),float(50),float(0))

line = DB.Line.CreateBound(start_point, end_point)
line2 = DB.Line.CreateBound(start_point2, end_point2)

resultArray = DB.IntersectionResultArray()

result = line.Intersect(line2, resultArray)
print(result)
print(resultArray.IsEmpty)
print(resultArray.Item[0].XYZPoint)

OUT:
(8, <Autodesk.Revit.DB.IntersectionResultArray object at 0x0000024A157A3730>)
True
CPython Traceback:
AttributeError : ‘IntersectionResultArray’ object has no attribute ‘Item’

The 8 in the output above is the Python 3 equivalent of Overlap.

Thank you in advance for any help.