efdiloreto / PyTekla

Bringing CPython power to Tekla
MIT License
7 stars 3 forks source link

Assembly+part list by python #3

Closed better319 closed 8 months ago

better319 commented 9 months ago

my target is to get the detail data of the assembly ,just like the template:Assembly_part_list(HTML).html.rpt

in order to get the part's lenth、area,which in assembly

#from Tekla.Structures.Model import Model, Beam,Material
from pytekla import wrap
from pytekla import ModelWrapper

model = ModelWrapper()
# picked_objects = model.pick_objects(object_type="part", prompt="Select parts from the model")
# for obj in picked_objects:
#     print(obj.name,obj.AssemblyNumber.Prefix,obj.AssemblyNumber.StartNumber)

objects_with_types = model.get_objects_with_types(["Assembly"])
for obj in objects_with_types:
    print(obj.name,obj.GetChildren,obj.AssemblyNumber.Prefix)

# filtered_objects = model.get_objects_by_filter("name=BEAM")    #wrong  FilterExpression?FilterExpression?
# for obj in filtered_objects:
#     print(obj)

yellow stone <function _attrs_wrapper..wrapper at 0x000001F48E72D760> stone yellow stone <function _attrs_wrapper..wrapper at 0x000001F48E72D760> stone yellow stone <function _attrs_wrapper..wrapper at 0x000001F48E72D760> stone yellow stone <function _attrs_wrapper..wrapper at 0x000001F48E72D760> stone yellow stone <function _attrs_wrapper..wrapper at 0x000001F48E72D760> stone

1.how to get the detail of <function _attrs_wrapper..wrapper at 0x000001F48E72D760> 2.get_objects_by_filter(model_filter)
model_filter=str or Tekla.Structures.Filtering.FilterExpression?? detail example needed

THK!!

efdiloreto commented 9 months ago

I think you are trying to get report properties. You have two options, using this function and get all as a Pandas Dataframe or using this method from the object.

better319 commented 9 months ago

I think you are trying to get report properties. You have two options, using this function and get all as a Pandas Dataframe or using this method from the object.

i have try this but failed,would u like to give a tekla zip of the example,

efdiloreto commented 9 months ago

@better319 Could you post the code that failed? Unfortunately I don't have a Tekla active license anymore....

better319 commented 9 months ago

@better319 Could you post the code that failed? Unfortunately I don't have a Tekla active license anymore....

i test them ,but another problem happened,

i can't find the property for the object even in the tekla openapi.

https://developer.tekla.com/tekla-structures/api/28/13489

i forgot something i seems just got the property name about:"NUMBER".

can't find name ,profile,length,area,...

do u know how to get the property?

better319 commented 9 months ago

the property names are in the temple.

efdiloreto commented 9 months ago

This is how I do it. It's no easy, because there are not easy to find.

Create or edit a table in tekla, for an assembly for example. There you will find all the properties for the assembly, weight, length, etc.

better319 commented 8 months ago

This is how I do it. It's no easy, because there are not easy to find.

Create or edit a table in tekla, for an assembly for example. There you will find all the properties for the assembly, weight, length, etc.

THANKS