
Wed, 02/20/2019 - 22:44
I am very new to Open Cascade I am trying to import a STEP file and extract data about points on the surface and boundary curves etc.
I am loading the files into the pythonOCC with from OCC.STEPControl import STEPControl_Reader I am then trying to use from OCC.ShapeExtend import ShapeExtend_CompositeSurface to analyze and extract data from what is imported.
How do I pass the STEP information from the import to the function ShapeExtend_CompositeSurface everything I try throws an error and I can't find examples online.
from OCC.STEPControl import STEPControl_Reader
from OCC.IFSelect import IFSelect_RetDone, IFSelect_ItemsByEntity
from OCC.Display.SimpleGui import init_display
from OCC.ShapeExtend import ShapeExtend_CompositeSurface
extend = ShapeExtend_CompositeSurface()
step_reader = STEPControl_Reader()
status = step_reader.ReadFile('L2.stp')
if status == IFSelect_RetDone: # check status
failsonly = False
step_reader.PrintCheckLoad(failsonly, IFSelect_ItemsByEntity)
step_reader.PrintCheckTransfer(failsonly, IFSelect_ItemsByEntity)
ok = step_reader.TransferRoot(1)
_nbs = step_reader.NbShapes()
aResShape = step_reader.Shape(1)
print("start")
print(aResShape)
print("end")
else:
print("Error: can't read file.")
sys.exit(0)
display, start_display, add_menu, add_function_to_menu = init_display()
display.DisplayShape(aResShape, update=True)
start_display()
Thu, 02/21/2019 - 07:43
Hello,
Why do you try to use ShapeExtend_CompositeSurface? This class has little to do with your task, as far as I understand.
If you want to extract geometrical information from an imported shape (TopoDS_Shape), you need tools to parse the shape graph (see TopoDS_Iterator and TopExp_Explorer) and tools to extract geometric object from sub-shapes (see BRep_Tool).
Actually, I’d recommend you to take our e-learning course – it would improve your understanding of the main concepts and APIs a lot.
Best regards,
Forum supervisor
Tue, 03/22/2022 - 17:09
In fact, I am interesting in e-learning course,how can I take it, the link has been invalidated.
Tue, 03/22/2022 - 23:29
Please, refer the following link: https://dev.opencascade.org/resources/trainings