steputils
steputils copied to clipboard
Get coordinates from entities
Hi @mozman
I'm using this parser and I would be glad if you can help me.
I have this code so far:
from steputils import p21
# Read the STEP file
file_path = r'step.STP'
stepfile = p21.readfile(file_path)
entities_to_get = []
for entity in stepfile.data:
for instance in entity.instances:
instance_params = stepfile.get(instance)
if hasattr(instance_params, 'entity') and hasattr(instance_params.entity, 'name'):
if instance_params.entity.name == 'TESSELLATED_SHELL':
for param in instance_params.entity.params:
for i in param:
if i.startswith('#'):
entities_to_get.append(i)
print(f'entities_to_get: {entities_to_get}')
Which print:
entities_to_get: ['#27', '#28', '#29']
Now, with these entities, how can I get the respective coordinates? Maybe with those entities, I have to use a library like pythonOCC?
Thanks in advance.