Closed better319 closed 10 months ago
in addition,for others, pip install -r requirements.txt
it's better to intall other deplay.
don't use jupyternotebook
Thanks! About the example, yes sure I can do it.
`import sys from pytekla import wrap
model = wrap("Model.Model")
if not model.get_connection_status(): print("Cannot connect with Tekla model") sys.exit()
material = wrap("Model.Material") material.material_string = "Q235B"
BentPlate_profile = wrap("Model.Profile") BentPlate_profile.profile_string = "PL10"
BentPlate_position = wrap("Model.Position") BentPlate_position.rotation_offset = 90 BentPlate_position.depth = wrap("Model.Position.DepthEnum").BEHIND
BentPlate = wrap("Model.BentPlate") BentPlate.start_point = wrap("Geometry3d.Point", 0.0, 0.0, 0.0) BentPlate.add_point = wrap("Geometry3d.Point", 10.0, 0.0, 0.0) ############error?? BentPlate.end_point = wrap("Geometry3d.Point", 0, 30.0, 0.0) BentPlate.name = "PYTEKLA BentPlate" BentPlate._class = "42" # Cannot use "class" in lowercase BentPlate.profile = BentPlate_profile BentPlate.material = material BentPlate.position = BentPlate_position BentPlate.insert()
model.commit_changes("BentPlate creation") `
but it's not work..
@better319 Give me couple a days to create a full example. In the meantime, I'm seeing some errors when you try to set the geometry in the BentPlate.
To set the geometry of the BentPlate you need to use the Geometry Property.
To do that you need to create a ConnectiveGeometry first. This class allows to pass to the constructor a Contour.
So, the code should look like this:
# Defining the contour
contour = wrap("Model.Contour")
# Supposing you have a list of points [(x1, y1, z1).....]
for p in points:
geometry_point = wrap("Geometry3d.Point", *p)
contour_point = wrap("Model.ContourPoint")
contour_point.set_point(geometry_point)
contour.add_contour_point(contour_point)
geometry = wrap("Model.ConnectiveGeometry", contour)
bent_plate = wrap("Model.BentPlate")
bent_plate.geometry = geometry
import sys
from pytekla import wrap
model = wrap("Model.Model")
if not model.get_connection_status():
print("Cannot connect with Tekla model")
sys.exit()
material = wrap("Model.Material")
material.material_string = "Q235B"
BentPlate_profile = wrap("Model.Profile")
BentPlate_profile.profile_string = "PL10"
BentPlate_position = wrap("Model.Position")
BentPlate_position.rotation_offset = 90
BentPlate_position.depth = wrap("Model.Position.DepthEnum").BEHIND
# Defining the contour
contour = wrap("Model.Contour")
# Supposing you have a list of points [(x1, y1, z1).....]
points=[(1,0,0),(4,0,0),(0,5,0),(4,7,0)]
for p in points:
geometry_point = wrap("Geometry3d.Point", *p)
contour_point = wrap("Model.ContourPoint")
contour_point.set_point(geometry_point)
contour.add_contour_point(contour_point)
geometry = wrap("Model.ConnectiveGeometry", contour)
BentPlate = wrap("Model.BentPlate")
BentPlate.geometry = geometry
#BentPlate.start_point = wrap("Geometry3d.Point", 0.0, 0.0, 0.0)
#BentPlate.add_point = wrap("Geometry3d.Point", 10.0, 0.0, 0.0) ############error??
#BentPlate.end_point = wrap("Geometry3d.Point", 0, 30.0, 0.0)
BentPlate.name = "PYTEKLA BentPlate"
BentPlate._class = "42" # Cannot use "class" in lowercase
BentPlate.profile = BentPlate_profile
BentPlate.material = material
BentPlate.position = BentPlate_position
BentPlate.insert()
model.commit_changes("BentPlate creation")
Traceback (most recent call last):
File "C:\Users\Administrator\Desktop\PyTekla-main\create Plate.py", line 41, in
Tekla.Structures.Model.BentPlate.BentPlateParametersCheck() Tekla.Structures.Model.BentPlate.CreateInstance()
@better319 I think you are missing a step, depending on how you want to create the bent plate. This might be useful for you:
HERE IS THE ERROR
BentPlate = wrap("Model.BentPlate") ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ BentPlate = wrap("Model.ContourPlate")
THANKS
excellent job, i am not good at c#,your work hlep me. i need an example to create plate by position sothat i can conbine cad with tekla to create different sharp.