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.
Automatically fix a feature error
Henk_de_Vlaam
Posts: 269 ✭✭✭
The part shown here simulates the situation in a Standard Plan part that I cannot show here. A problem arises that I would like to have automatically solved during regeneration - perhaps via a feature script (?). The Configuration variable Diameter must be set by 'Makers' which allows them to create their own geometry.
If they enter the value 10, Extrude 3 fails. This is because it then tangents to Extrude 1.
The makers have no idea how Onshape works and therefore do not know that they have to in- or decrease the value of #Diameter slightly to solve the problem. So it would be nice if this could be done automatically.
The question now is whether Extrude 3 can be expanded automatically until the error no longer occurs.
I've searched if #Diameter can be set with a ternary operator. Something like “Error (Extrude 3) > 0 ? #Diameter+0.05mm : #Diameter”. I didn't find that.
Does anyone see a way to solve this problem automatically?
0
Best Answer
-
We can't edit feature parameters via FeatureScript that's executing during regen -- that would make things circular. What you could do is write a custom feature that tries an extrude of the right size and if that fails, tries a bigger one.Ilya Baran \ VP, Architecture and FeatureScript \ Onshape Inc0
Answers
-
Yes, all of our numeric input fields can take ternary operators as inputs. Please see https://forum.onshape.com/discussion/16485/configurations-if-statements
Note, this does not sense if features have errors to change the logicTim Rice | User Experience | Support
Onshape, Inc.1 -
@TimRice,
Thanks for your answer.
It would be nice to have an error handler "If <Error> Then ... Else ...". Does an Improvement Request make sense or is that not possible in the Onshape programming code at all?
0 -
@ilya_baran can give you a better explanation but I wouldnt think that is really something we would implement.
An alternative is just creating a Closed Composite part since they appear as a single body but do not rely on a boolean.Tim Rice | User Experience | Support
Onshape, Inc.0 -
We can't edit feature parameters via FeatureScript that's executing during regen -- that would make things circular. What you could do is write a custom feature that tries an extrude of the right size and if that fails, tries a bigger one.Ilya Baran \ VP, Architecture and FeatureScript \ Onshape Inc0
-
@TimRice,
The support team also already suggested the composite part. But unfortunately I can not use that because at any case there is a variable number of parts that has to be select which, by far as I know, can not be done automatically. When you look at this branch [https://cad.onshape.com/documents/4a1de1a8d7ce8379ed82aed0/w/f03ec1ab6ed78f4a2eceb124/e/021fa56f84d9d9a4dcbf7830] I have brought in how I'm doing it now with a configuration checkbox what can be done by an unsuspecting customer when the feature regeneration fails.TimRice said:[...]
An alternative is just creating a Closed Composite part since they appear as a single body but do not rely on a boolean.
@ilya_baran,ilya_baran said:We can't edit feature parameters via FeatureScript that's executing during regen -- that would make things circular. What you could do is write a custom feature that tries an extrude of the right size and if that fails, tries a bigger one.
What a coincident. While typing the above text to Tim I had not read your topic, but I got the same idea as you. I hope one day I can come to you with the part (out of the Standard plan) because I'm not able to edit feature script.0 -
If you can make some measurerements and predict feature failure based on it, then you can use ternary operator to increase feature parameter, at specific conditions
0 -
@konstantin_shiriazdanov,
I also thought of that. Unfortunately this is not possible in the relevant profi part because it has an unpredictable number of tangent possibilities. So, I don't know where to measure. A specific custom feature is therefore preferred, but for the time being, the branch B1 way does it too.
Nevertheless, thanks for thinking along.0



