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.

Why doesn't the spur gear feature script update properly when using a variable studio

mspiccionemspiccione Member Posts: 3 EDU
When you create a variable studio and add variables like gear pitch and teeth number, and then create gears in a part studio based on those variables, the gear outputs correctly. But if you go back and edit the variable amount in the Var studio and go back to the part studio, it generates wrong. The variable names are still present in the feature script box but the Gear diameter is acting like a driving dimension and causes issues with the change and tooth profile. Since gear design is always a function of 2 of the 3 factors (pitch, T#, or diameter) I think any of the gear design feature scripts need to have the option to choose which 2 of 3 are the driving dimension and which is driven. 

Answers

  • NeilCookeNeilCooke Moderator, Onshape Employees Posts: 5,851
    It does do 2 of the 3, but if you try to drive all 3 then that's probably why it's not working.
    Senior Director, Technical Services, EMEA
  • dbaardadbaarda Member Posts: 15 ✭✭

    There is a genuine problem here, and I think I've figured it out.

    The editGearLogic() editing logic function works by comparing the previous value in the definition to the new value and updates things if it changed. However, when the value in the definition is a variable, the previous value and the new value are both the current value of the variable and so are the same, even if the value of that variable has changed. This means variable changes never trigger the editGearLogic() updates, but these updates are important for ensuring the module, diametralPitch, circularPitch and pitchCircleDiameter are all set consistently with each other.

    I'm going to fix this…

  • dbaardadbaarda Member Posts: 15 ✭✭

    It's not just that the editGearLogic() editing logic function can't see the changes when it was a changed variable value, it's also that the whole function is not triggered for variable changes, only for changes done in the UI. Interestingly I can watch the module value change in the open Spur Gear UI dialog when I change the `#Module" variable I've set it to, but I can see the pitchCircleDiameter in the UI dialog not changing, even when I've changed the editGearLogic() function to always recalculate pitchCircleDiameter.

    I think a big part of the problem is there are interdependent settings in the definition that the UI dialog drives, and it's relying on the editGearLogic() function to change them so they are consistent. In particular, changing any one of the module, diametralPitch, circularPitch, or pitchCircleDiameter values will recalculate the others, and changing numTeeth will also change pitchCircleDiameter. But using variables in any of these means they can change without the others being updated.

    It's not so bad for module, diametralPitch, and circularPitch,because they are different ways of specifying the same thing and only one is displayed selected by the GearInputType setting, so you don't really see when they get out of sync. Unfortunately, the current featurescript version only uses the module value and relies on it being set correctly by editGearLogic(). This means if you configure your gear using a variable to set diametralPitch and you change that variable, the change is not applied because module is not updated. You can only use a variable to set module and have it mostly work.

    But the big visible problem is pitchCircleDiameter which doesn't get updated, which means although your module change from changing the variable is applied, the gear diameter is not changed, and things get pretty messy.

    I'm going to fix this.

  • dbaardadbaarda Member Posts: 15 ✭✭

    Fixes and a bunch of other improvements are available here;


    https://cad.onshape.com/documents/398504e1cabca3abfcaa15e3/v/1d36c50b57b151c16a98908c/e/362561dc150d4cef514ae2b9

Sign In or Register to comment.