It now finds Karamba.Geometry, but it still give the error on LineToBeam:
ModelCreation_Python3.py (1.6 KB)
#! python3
r “C:\Program Files\Rhino 8\Plug-ins\Karamba\karamba.dll”
r “C:\Program Files\Rhino 8\Plug-ins\Karamba\karambaCommon.dll”
import Karamba
import KarambaCommon
from System.Collections.Generic import List, Dictionary, IReadOnlyList
print(Karamba.path,dir(Karamba))
print(KarambaCommon.path,dir(KarambaCommon))
print(hasattr(Karamba,“Geometry”))
def RunScript():
logger = Karamba.Utilities.MessageLogger()
k3d = KarambaCommon.Toolkit()
p0 = Karamba.Geometry.Point3(0, 0, 0)
p1 = Karamba.Geometry.Point3(0, 0, 5)
L0 = Karamba.Geometry.Line3(p0, p1)
nodes = List[Karamba.Geometry.Point3]()
elems = k3d.Part.LineToBeam(List[Karamba.Geometry.Line3]([L0]), List[str](["B1"]), List[Karamba.CrossSections.CroSec](), logger, nodes)
cond = List[bool]([True, True, True, True, True, True])
support = k3d.Support.Support(0, cond)
supports = List[Karamba.Supports.Support]([support])
pload = k3d.Load.PointLoad(1, Karamba.Geometry.Vector3(0, 0, -10), Karamba.Geometry.Vector3())
ploads = List[Karamba.Loads.Load]([pload])
mass = None
cog = Karamba.Geometry.Point3()
flag = None
info = ""
model = k3d.Model.AssembleModel(elems, supports, ploads, info, mass, cog, info, flag)
# calculate Th.I response
max_disp = List[float]()
out_g = List[float]()
out_comp = List[float]()
message = ""
model = k3d.Algorithms.AnalyzeThI(model, max_disp, out_g, out_comp, message)
ucf = Karamba.Utilities.UnitsConversionFactories.Conv()
cm = ucf.cm()
print("max disp: " + cm.toUnit(max_disp[0]) + cm.unitB)
RunScript()
Traceback (most recent call last):
File “file:///D:/Projects/0312-StructuralGrowth02/3d/Scripts/ModelCreation_Python3.py”, line 50, in
File “file:///D:/Projects/0312-StructuralGrowth02/3d/Scripts/ModelCreation_Python3.py”, line 24, in RunScript
TypeError: System.Collections.Generic.List1[Karamba.Geometry.Point3] value cannot be converted to System.Boolean in method System.Collections.Generic.List
1[Karamba.Elements.BuilderBeam] LineToBeam(System.Collections.Generic.List1[Karamba.Geometry.Line3], System.Collections.Generic.List
1[System.String], System.Collections.Generic.List1[Karamba.CrossSections.CroSec], Karamba.Utilities.MessageLogger, System.Collections.Generic.List
1[Karamba.Geometry.Point3] ByRef, Boolean, Double, System.Collections.Generic.List1[Karamba.Geometry.Vector3], System.Collections.Generic.List
1[System.Drawing.Color], System.Collections.Generic.List`1[Karamba.Geometry.Point3], Boolean, Boolean)
[‘Algorithms’, ‘CrossSections’, ‘Elements’, ‘GHopper’, ‘Geometry’, ‘Joints’, ‘Licenses’, ‘Loads’, ‘Materials’, ‘Models’, ‘Supports’, ‘Utilities’, ‘class’, ‘delattr’, ‘dir’, ‘doc’, ‘eq’, ‘file’, ‘format’, ‘ge’, ‘getattribute’, ‘gt’, ‘hash’, ‘init’, ‘init_subclass’, ‘le’, ‘loader’, ‘lt’, ‘module’, ‘name’, ‘ne’, ‘new’, ‘package’, ‘path’, ‘reduce’, ‘reduce_ex’, ‘repr’, ‘setattr’, ‘sizeof’, ‘spec’, ‘str’, ‘subclasshook’]
[‘Toolkit’, ‘class’, ‘delattr’, ‘dir’, ‘doc’, ‘eq’, ‘file’, ‘format’, ‘ge’, ‘getattribute’, ‘gt’, ‘hash’, ‘init’, ‘init_subclass’, ‘le’, ‘loader’, ‘lt’, ‘module’, ‘name’, ‘ne’, ‘new’, ‘package’, ‘path’, ‘reduce’, ‘reduce_ex’, ‘repr’, ‘setattr’, ‘sizeof’, ‘spec’, ‘str’, ‘subclasshook’]
True
May I ask if you happen to have any basic example script in Python 3 that works? Thank you very much!