
Thu, 12/14/2023 - 20:48
Forums:
I'd like to project a part to 2D using hidden line removal with HLRAlgo_Projector
, but the projection is off and I can't figure out why. I've disabled the perspective transformation and the coordinate system is perfectly top down and it still looks like it's being projected with a perspective. Here's a code snippet (using pyOCCT
), and I've attached a screenshot of the generated lines.
Please let me know what needs to be changed to render an orthographic projection of the part.
# Define the transformation for the isometric projection
direction = gp_Dir(0.0, 1, 0)
point = gp_Pnt(0, 0, 0)
coordinate_system_3d = gp_Ax3(point, direction)
# Create a transformation from the coordinate system
transformation = gp_Trsf()
transformation.SetTransformation(coordinate_system_3d)
# Create the projector with orthogonal projection
projector = HLRAlgo_Projector(transformation, False, 0.0)
hlr = HLRBRep_Algo()
hlr.Add(shape.wrapped)
hlr.Projector(projector)
hlr.Update()
hlr.Hide()
hlr_shapes = HLRBRep_HLRToShape(hlr)
Attachments:
Thu, 12/14/2023 - 21:28
Hello, please try to use gp_Ax2 instead of (gp_Trsf False 0.0). Just single gp_Ax2
Unfortunatelly, I have no more ideas.
Best regards, Dmitrii.
Thu, 12/14/2023 - 23:18
Worked! Here's the part I changed:
Thanks for your help.
Fri, 12/15/2023 - 03:45
Hello, You can check the examples in the document: HLR Examples https://dev.opencascade.org/doc/overview/html/occt_user_guides__modeling_algos.html#occt_modalg_10_1
For exact HLR algorithm, you need HLRBRep_HLRToShape to extract the result.
Thu, 12/14/2023 - 23:32
Follow up question: Is there any way to get the original faces associated with each extracted edge?
Fri, 12/15/2023 - 02:52
Looking into source code i dont see the options for that.
Fri, 12/15/2023 - 03:51
You can get the original edge for the extracted edge.
Mon, 12/18/2023 - 19:44
Cool! Could you please let me know how to do that?
Tue, 12/19/2023 - 06:05
Sorry, I misunderstand.
You can get the hidden/visible part of shape edges by give the shape to VCompound, HCompound, .etc.