I want to use BRepTools_ReShape to remove an edge from an object but I don't know how can I use.
Thank you very much for your help
Bearloga Fri, 05/21/2010 - 10:20
It is not allowed to remove a subshape from a shape. Usually a copy of the shape is created with missed subshape. So, you can use reshape in order to make a copy of your shape without an edge. For that, just initialize reshape tool with your shape, and then tell it that you want to remove the edge, and then you can get the result.
Thank you very much Bearloga for your help but I don't understand how can get a copy of a shape without this shape.
Please, can you give me the lines of code to do thid.
Regards
I have a shape that contains wires (which is a set of edges) and I want to delete an edge of the shape selected.the shape selected is imported from file iges.
In fact I open a local context to select an edge to be deleted.
I have not found a method so I wanted to make a copy of my shape without the edge selected then I clean my Interactive context then I display the new shape without the edge selected
I think you approach is right. But you need not to clean the context (especially in the case you have many objects in the context). Just remove the old shape and display the new one.
But you do not give me how I can copy this shape without this edge even though I described all the steps I am trying to do.
I wanted to know the code lines for use in doing that using BRepTools_ReShape or if there is another method.
I await your reply.
Thanks
You did not modify topods shape inside the context in your code. The following should be right:
aReshape.Remove(myAISContext->SelectedShape());
Handle_AIS_InteractiveObject picked;
picked= myAISContext->SelectedInteractive();
Handle(AIS_Shape) aShape=Handle(AIS_Shape)::DownCast(picked);
TopoDS_Shape aNewShape=aReshape.Apply(aShape->Shape());
aShape->Set(aNewShape);
myAISContext->Redisplay(aShape);
I tried this method. It works if I tried to delete a face, but it didn't work if I tried to delete an edge.
Here is what I did. I created a box, then I selected a face, I can delete it. But if I selected an edge, when I tried to delete it, it actually deleted both faces that share that edge.
you have to reshape the whole TopoDS_Shape. Deleting a face does not affect the consistency of the data. If you remove an edge you will also have to update both faces sharing it (in a box) - this is probably why the faces gets 'deleted' (or rather invalid and thus not being visualized any more).
I want to use BRepTools_ReShape to change the orientation of triangles of an TopoDs_Shape i mean when i import an IGES File the traingles are in clockwise-order i want to change it to counter-clockwise-order. Please tell me i can do this.
Fri, 05/21/2010 - 10:20
It is not allowed to remove a subshape from a shape. Usually a copy of the shape is created with missed subshape. So, you can use reshape in order to make a copy of your shape without an edge. For that, just initialize reshape tool with your shape, and then tell it that you want to remove the edge, and then you can get the result.
Fri, 05/21/2010 - 11:49
Thank you very much Bearloga for your help but I don't understand how can get a copy of a shape without this shape.
Please, can you give me the lines of code to do thid.
Regards
Fri, 05/21/2010 - 12:16
You wrote:
> I want to use BRepTools_ReShape to remove an edge from an object
And now you say you do not have a shape. Where is the truth?
Fri, 05/21/2010 - 12:32
I have a shape that contains wires (which is a set of edges) and I want to delete an edge of the shape selected.the shape selected is imported from file iges.
In fact I open a local context to select an edge to be deleted.
I have not found a method so I wanted to make a copy of my shape without the edge selected then I clean my Interactive context then I display the new shape without the edge selected
Fri, 05/21/2010 - 13:06
I think you approach is right. But you need not to clean the context (especially in the case you have many objects in the context). Just remove the old shape and display the new one.
Fri, 05/21/2010 - 13:31
But you do not give me how I can copy this shape without this edge even though I described all the steps I am trying to do.
I wanted to know the code lines for use in doing that using BRepTools_ReShape or if there is another method.
I await your reply.
Thanks
Fri, 05/21/2010 - 14:39
OK. Here is the code. I did not compile it though.
TopoDS_Shape RemoveEdge(TopoDS_Edge edge, TopoDS_Shape shape)
{
BRepTools_ReShape reshape;
reshape.Remove(edge);
return reshape.Apply(shape);
}
Fri, 05/21/2010 - 18:16
-Hi ,
if (myAISContext->NbSelected()!=0)
{
BRepTools_ReShape aReshape;
for (myAISContext->InitSelected(); myAISContext->MoreSelected();AISContext->NextSelected())
{
aReshape.Remove(myAISContext->SelectedShape());
Handle_AIS_InteractiveObject picked;
picked= myAISContext->SelectedInteractive();
Handle(AIS_Shape) aShape=Handle(AIS_Shape)::DownCast(picked);
TopoDS_Shape TopoDsShape=aShape->Shape();
aReshape.Apply(aShape->Shape());
myAISContext->Redisplay(aShape);
}
}
But it doesn't work.
The edge isn't delete.
Have you eny idea what is the problem?
Fri, 05/21/2010 - 18:23
You did not modify topods shape inside the context in your code. The following should be right:
aReshape.Remove(myAISContext->SelectedShape());
Handle_AIS_InteractiveObject picked;
picked= myAISContext->SelectedInteractive();
Handle(AIS_Shape) aShape=Handle(AIS_Shape)::DownCast(picked);
TopoDS_Shape aNewShape=aReshape.Apply(aShape->Shape());
aShape->Set(aNewShape);
myAISContext->Redisplay(aShape);
Fri, 05/21/2010 - 19:50
Thank you very very much Bearloga.
Now, It works very well.
Tue, 02/22/2011 - 17:54
Hello, ATTIA:
I tried this method. It works if I tried to delete a face, but it didn't work if I tried to delete an edge.
Here is what I did. I created a box, then I selected a face, I can delete it. But if I selected an edge, when I tried to delete it, it actually deleted both faces that share that edge.
Any idea?
Thanks a lot,
James
Tue, 02/22/2011 - 20:34
Hi,
you have to reshape the whole TopoDS_Shape. Deleting a face does not affect the consistency of the data. If you remove an edge you will also have to update both faces sharing it (in a box) - this is probably why the faces gets 'deleted' (or rather invalid and thus not being visualized any more).
Pawel
Mon, 01/13/2014 - 15:48
Hi Baerloga,
I want to use BRepTools_ReShape to change the orientation of triangles of an TopoDs_Shape i mean when i import an IGES File the traingles are in clockwise-order i want to change it to counter-clockwise-order. Please tell me i can do this.
Thanks & Regards
Anup S