Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.

First time visiting? Here are some places to start:
  1. Looking for a certain topic? Check out the categories filter or use Search (upper right).
  2. Need support? Ask a question to our Community Support category.
  3. Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
  4. Be respectful, on topic and if you see a problem, Flag it.

If you would like to contact our Community Manager personally, feel free to send a private message or an email.

constructPath() sometimes doesn't return a continuous path, possible bug?

jeff_brown304jeff_brown304 Member Posts: 23 ✭✭
I have been using constructPath() to construct a continuous path along a set of connected edges supplied by the user. My code then iterates over each edge in the path and queries the geometry using evApproximateBSplineCurve(). If the path's flipped flag is set to true for an edge, then I process that edge in reverse.

For the most part, this has been working well.  However, I have found a case where constructPath() returns a Path that is not continuous.  When I make a path containing a straight edge and the arc of fillet tangent to that edge, the arc is oriented backwards in the path and its start point does not coincide with the end point of the preceding straight edge (even when taking the flipped flags into account).

I'm not sure what to do about this issue.  I could perhaps work around the problem by testing which end of the arc is closest to the previous segment and flipping it accordingly.  However, before I do that, I wanted to check whether this is expected behavior and whether I've misinterpreted something important along the way.

I've made a simple test case to reproduce the problem I have observed.  See here: https://cad.onshape.com/documents/13098a696e749533a2f26c06/w/54a890016acd015349686206/e/cedce1fd52f345baf00372e6

Comments

  • ilya_baranilya_baran Onshape Employees, Developers, HDM Posts: 1,210
    I think the issue is with the evApproximateBSplineCurve function -- it doesn't always return the curve in the same direction as the edge.  evEdgeTangentLine should return the right order of endpoints at 0 and 1.  This is a bug -- thanks for reporting.
    Ilya Baran \ VP, Architecture and FeatureScript \ Onshape Inc
  • jeff_brown304jeff_brown304 Member Posts: 23 ✭✭
    Got it.

    Incidentally, it would save me a lot of math if there was a function similar to evCurveDefinition() that returned more information.  Specifically if the curve is a line, I'd like to know its length without having to call evLength() to get it.  Also, if the curve is an arc segment (not a full circle), I'd like to know its start, end, and mid point (or something equivalent).  Right now I'm recovering this geometry from the BSpline representation in order to generate a polyline with line and arc segments.

    Thanks!
  • ilya_baranilya_baran Onshape Employees, Developers, HDM Posts: 1,210
    Everyone needs slightly different things, so we're not going to overburden the standard functions.  For what you're describing though, evEdgeTangentLines is a simple way to get the endpoints and midpoint and it'll be a lot faster than a BSpline approximation.
    Ilya Baran \ VP, Architecture and FeatureScript \ Onshape Inc
  • jeff_brown304jeff_brown304 Member Posts: 23 ✭✭
    Well… not quite.  evEdgeTangentLines() is fine if I know I’m looking at a circular arc segment but the curve could very well be something else entirely that I will need to interpolate in a different way.

    So for now I’m working with the spline representation because that’s the best I can get.
Sign In or Register to comment.