pythonocc-core
pythonocc-core copied to clipboard
Extracting STEP file geometrical entities names with hierarchical view
i have to build a STEP viewer for my project in witch i can see the hierarchical structure of the step file geomertical entities. For now i can only see the names of the entities with this code:
from OCC.Display.WebGl import x3dom_renderer
from OCC.Core.STEPControl import STEPControl_Reader
from OCC.Extend.DataExchange import read_step_file_with_names_colors
from OCC.Core.Quantity import Quantity_Color, Quantity_TOC_RGB
from OCC.Display.SimpleGui import init_display
step_reader = STEPControl_Reader()
status=step_reader.ReadFile('step/ASY-0039890.stp')
step_reader.TransferRoot(1)
shapes_labels_colors = read_step_file_with_names_colors('step/ASY-0039890.stp')
my_renderer = x3dom_renderer.X3DomRenderer()
for shpt_lbl_color in shapes_labels_colors:
my_renderer.DisplayShape(shpt_lbl_color)
my_renderer.render()
the execution of this code:


Now i want to see the names of the entities in this way:

Can any one help please?
see an example at https://github.com/dblanding/kodacad @dblanding
thanx a lot :D
Hello,
I'm really curious about this because I need it too and I still getting empty names. It is necessary to use some specific version of pythonocc? I made a test compiling the master branch and I can't make it work.
Thank you, rsm
hi @rsm-gh , sorry for being late but in case you still need the answer , check your step file maybe its not readable or doesn't have an assembly structure! i'm using pythonocc-core-7.4.0 and it works!
@tpaviot Hello Thomas, I am currently working on a academic project where i have to visualize the .step file. I have very little experience in programming, may i know how to visualize the .step file using pythonocc.