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
Member, Developers Posts: 243 ✭✭✭
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?
Henk de Vlaam (NL)
0
Best Answer
-
ilya_baran Onshape Employees, Developers, HDM Posts: 1,217We 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
Note, this does not sense if features have errors to change the logic
Onshape, Inc.
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?
An alternative is just creating a Closed Composite part since they appear as a single body but do not rely on a boolean.
Onshape, Inc.
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.
@ilya_baran,
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.
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.