CAD File to 2D Projection -> How to get just the outlining edges?

Hey guys,

I am pretty new with OCC and those are my first steps. So I hope you can help me out with this, even if its a noob question.

I want to load a CAD file and then project it into 2D.

I did this by using the following code:

Handle(HLRBRep_Algo) myAlgo = new HLRBRep_Algo();
HLRAlgo_Projector aProjector = HLRAlgo_Projector(gp_Ax2(gp_Pnt(0., y1, shapeCenterHeight), gp_Dir(0., 1., 0)));
myAlgo->Add(shape);
myAlgo->Projector(aProjector);
myAlgo->Update();
myAlgo->Hide();

HLRBRep_HLRToShape aHLRToShape(myAlgo);

TopoDS_Compound aCompound;
BRep_Builder aBuilder;
aBuilder.MakeCompound(aCompound);
aBuilder.Add(aCompound, aHLRToShape.VCompound());
aBuilder.Add(aCompound, aHLRToShape.OutLineVCompound();

aCompound now looks like the image "1.jpg" I attached.

Now I would like to get just the outer wires/edges, so that it looks like "2.jpg" (photoshopped).

How can I achieve this with OCC?

Thanks in advanced and best regards,

Sebastian

Attachments: 
qa qa's picture

Hello Sebastian,

There is no such a way to do it out of the box in OCCT. HLR algorithm is intended  to create model drawing for a specified direction. Internal lines should be present in drawing. They allow reconstructing original model from drawings.

qa qa

Sebastian A's picture

Okay, thank you.

Then is there at least a way to just iterate on those outer lines / to just get the vertices of the outer lines?

qa qa's picture

No, it is not possible to trace over outer lines. The algorithm returns a set of edges without any additional information. Of course, you can create such algorithm manually.

Sebastian A's picture

Okay, so what if I would create faces between those edges and then I would remove all edges which do have more than one face attached (since those are not the outer edges)?

Would this solve my problem?

And if yes, what would be the correct way to create the faces between the edges?

qa qa's picture

Well, AFAIK it is not simple process since edges may overlap. From my point of view, the best way is to discretize edges and reconstruct outer contour from a point cloud. In academic literature, this field is called "concave hull".
 

Sebastian A's picture

Okay, Ill have a look into that. Thank you!

Manuel Apeltauer's picture

Hi Sebastian,

i just read your thread and i am facing the same problem. Do you have any success to get only the outer wire of your shape?

BR Manuel