Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.
First time visiting? Here are some places to start:- Looking for a certain topic? Check out the categories filter or use Search (upper right).
- Need support? Ask a question to our Community Support category.
- Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
- 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.
qFarthestAlong not behaving as expected
wickedDesigns
Member Posts: 6 ✭
I am working on a FeatureScript which begins by finding the furthest parallel planar face which is part of the same body as a selected planar face. To do this, I am finding the vector opposite the normal vector of the selected face and using this as the direction for qFarthestAlong; however, debugging this query seems to be showing me the closest plane, not the farthest. Am I not understanding the expected behavior of qFarthestAlong, or am I doing something else wrong?
Additionally, though less important, does this seem like a reasonable method with which to find the plane I am looking for? Reading answers to other questions, it sounds like I would be better off not explicitly evaluating queries in my FeatureScript. Is there a way to find the planar face I am looking for using only queries?
Additionally, though less important, does this seem like a reasonable method with which to find the plane I am looking for? Reading answers to other questions, it sounds like I would be better off not explicitly evaluating queries in my FeatureScript. Is there a way to find the planar face I am looking for using only queries?
Tagged:
0
Best Answer
-
kevin_o_toole_1 Onshape Employees, Developers, HDM Posts: 565Hey all,
Thanks for finding and reporting this. Yes, this is definitely a bug on our end, and looks precisely as you described it: qFarthestAlong is always doing the opposite of what is documented. Passing in the negative vector should always give the correct behavior, and that's the correct fix right now.
Given that the behavior is simply wrong, we will be fixing this bug in a future release. @mahir's point about perhaps not fixing it is well-placed, but we certainly anticipated the need for making small breaking changes like this, and our versioning/upgrading process reflects that need.
Here's the sequence of events w/r/t changes like this:- @wickedDesigns and others write code in a custom feature that's dependent on the old behavior.
- Onshape releases a new version with the fix, and documents are upgraded.
At this point native features (e.g. extrude) will point to the new latest version of std (and we'll have already done the work on our end to ensure native features behave the same with new versions of the library).
But critically, custom features still point to the old version of std, and the old behaviors are preserved. If you never touch your feature again, it will continue to behave the same way forever, for both existing and new instances of the feature. - Eventually, you may want your custom feature to point to the new version of the standard library (because you want new features, bug fixes, etc). So, you explicitly increase version number on your geometry.fs import to the latest version.
At that point, you'll start getting the new behavior, and it will "break" (because you were relying on the old broken behavior). You'll then need to remove your extraneous negative signs to get the correct behavior back. - Finally, you make a new document version of your custom feature, with both the std upgrade and the associated fixes. Users of your custom feature (who imported the previous version) now also have the choice whether to click the blue icon to update. If they do, they'll now be pointing to a feature which uses the latest std. If they never do, Onshape will preserve their old geometry forever.
Hopefully this structure makes sense. Naturally, this is a pretty embarrassing bug to have, but versioning of CAD and code is something we think quite a lot about at Onshape, and we think this system is the right way to handle it.
8 - @wickedDesigns and others write code in a custom feature that's dependent on the old behavior.
Answers
As for finding a better way to do this, I'm sure there are other alternatives, but I don't see anything wrong with doing it this way. In my example evPlane takes all of 1ms to run. No reason to optimize that.
Thanks for finding and reporting this. Yes, this is definitely a bug on our end, and looks precisely as you described it: qFarthestAlong is always doing the opposite of what is documented. Passing in the negative vector should always give the correct behavior, and that's the correct fix right now.
Given that the behavior is simply wrong, we will be fixing this bug in a future release. @mahir's point about perhaps not fixing it is well-placed, but we certainly anticipated the need for making small breaking changes like this, and our versioning/upgrading process reflects that need.
Here's the sequence of events w/r/t changes like this:
- @wickedDesigns and others write code in a custom feature that's dependent on the old behavior.
- Onshape releases a new version with the fix, and documents are upgraded.
- Eventually, you may want your custom feature to point to the new version of the standard library (because you want new features, bug fixes, etc). So, you explicitly increase version number on your geometry.fs import to the latest version.
- Finally, you make a new document version of your custom feature, with both the std upgrade and the associated fixes. Users of your custom feature (who imported the previous version) now also have the choice whether to click the blue icon to update. If they do, they'll now be pointing to a feature which uses the latest std. If they never do, Onshape will preserve their old geometry forever.
The last time we had a breaking change like this, we simplified the way custom valueBounds are defined. This was a breaking change for anyone using the old style of bounds, and all these users needed (or will need) to make minor code changes when upgrading in order for their features to continue working.At this point native features (e.g. extrude) will point to the new latest version of std (and we'll have already done the work on our end to ensure native features behave the same with new versions of the library).
But critically, custom features still point to the old version of std, and the old behaviors are preserved. If you never touch your feature again, it will continue to behave the same way forever, for both existing and new instances of the feature.
At that point, you'll start getting the new behavior, and it will "break" (because you were relying on the old broken behavior). You'll then need to remove your extraneous negative signs to get the correct behavior back.
Hopefully this structure makes sense. Naturally, this is a pretty embarrassing bug to have, but versioning of CAD and code is something we think quite a lot about at Onshape, and we think this system is the right way to handle it.