pythonocc-core icon indicating copy to clipboard operation
pythonocc-core copied to clipboard

Extracting STEP file geometrical entities names with hierarchical view

Open BoshraKrout opened this issue 5 years ago • 5 comments

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:

components_names

select_component4

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

hierarchicalView

Can any one help please?

BoshraKrout avatar Apr 01 '20 14:04 BoshraKrout

see an example at https://github.com/dblanding/kodacad @dblanding

tpaviot avatar Apr 04 '20 05:04 tpaviot

thanx a lot :D

BoshraKrout avatar Apr 10 '20 12:04 BoshraKrout

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

rsm-gh avatar Apr 25 '20 13:04 rsm-gh

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!

BoshraKrout avatar Sep 10 '20 17:09 BoshraKrout

@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.

Subhashplcm avatar Mar 01 '24 07:03 Subhashplcm