DiscussionsIssue archiveOther usage issues

Archived discussion

Offset a Wire or a Shape?

Other usage issuesMon, 11/26/2007 - 04:586 replies

Browse this forum
QuestionAuthor

Dear all,

I am trying to do an wire offset or a shape offset function here, but no idea how to get it done. Could anyone give me a tips on what to use to get this to work?

Thanks in advance

Discussion

6 archived replies

Posts are displayed in their archived order.

01Commenter-1

If you are simply looking to offset a wire or shape along a spine, check out the BRepOffsetAPI package. There are several classes to choose from, depending on the type of offset you need.

02Author

Hi Rob,

Thanks for the tips.

I tried the BRepOffsetAPI_MakeOffset function as following

TopoDS_Face myFace = TopoDS::Face(faceTmp->Value(1));
BRepOffsetAPI_MakeOffset myOffSet.Init(myFace,GeomAbs_Arc);

crashed here---> myOffSet.Perform(1.5,1.5);

I looked the the documents, I think it is correct.

by any chance, do you know what was missing?

Thanks in advance

03Commenter-1

Try leaving out the Init. You only call Init if you use the default constructor or you are reusing the same algorithm with different parameters.

TopoDS_Face myFace = TopoDS::Face(faceTmp->Value(1));
BRepOffsetAPI_MakeOffset myOffSet(myFace,GeomAbs_Arc);

crashed here---> myOffSet.Perform(1.5,1.5);

04Author

Hi Rob,

Even without init it, it is still crashed on Perform.
and after perform, how could I make it a topods shape to display in the 3d view?

Thanks in Advance

05Commenter-1

In general, your code looks OK. It is possible that there is something wrong with the face being fed to it (must be planar). It also appears that MakeOffset is a little sensitive. If you look at the documentation for the mkoffset command (which calls BRepOffsetAPI_MakeOffset) in the Test Harness User's Guide (section 7.2.6), there is a note:

"The mkoffset command must be used with prudence, angular contours produce offset contours and fillets. Interior parallel contours can produce more than one wire, normally these are refused. ..."

I tried the test harness with a square face and it works fine, but I could see some faces having problems.

For display purposes, you can get the resulting TopoDS_Shape objects with the Shape function (from the BRepBuilderAPI_MakeShape base class).

I also suggest you try catching exceptions. Maybe an exception is being thrown that can give you additional information on the problem.

Good luck,
Commenter-1

06Author

Hi Rob,

You are correct, Thanks for the advise and the tips.

Rice