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.

featurescript - adding features to spur gear script [SOLVED]

matthijs_keupermatthijs_keuper Member Posts: 2
edited July 2016 in FeatureScript
Just discovered featurescript. awesome!

I'd like to add some features to the spur gear scrupt, such as a helical gear

My thought was just to add a boolean button to the feature UI section and go from there:

        annotation { "Name" : "Helical gear" }
        definition.helicalGear is boolean;

        if (definition.helicalGear)
        {
          annotation { "Name" : "Pitch (mm)" }
          isLength(definition.pitchHelical, LENGTH_BOUNDS);//

          annotation { "Name" : "Change direction" }
          definition.HelicalMirror is boolean;

          annotation { "Name" : "V-type" }
          definition.Helicaldouble is boolean;
        }


I put this at the end of the other existing features  (after "offset").

However, I get

Precondition failed (definition.helicalGear is boolean)

I just started with this, so I'm probably missing something benign.   Any ideas?




Comments

  • ilya_baranilya_baran Onshape Employees, Developers, HDM Posts: 1,173
    It looks like the feature in the part studio did not update to include your new parameters (this will be fixed soon) -- If you just open the failing gear feature to edit and then commit, it should fix itself.
    Ilya Baran \ VP, Architecture and FeatureScript \ Onshape Inc
  • matthijs_keupermatthijs_keuper Member Posts: 2
    That did the trick!  Thanks!
  • matt_jensenmatt_jensen Member Posts: 1
    Would anyone be interested in adding an option/checkbox to the feature that sets everything compatible with LEGO Technic/Mindstorms gears?  This would be extremely useful for students (and hobbyists) who want custom, compatible gears. The option would need to set specific values for teeth, etc., as well as replace the axle hole with a Mindstorms-compatible "+"-shaped hole.   I'd like to do this myself, time permittingbut I am new to Onshape, and hope to start learning the concepts and API for FeatureScript soon.
  • clive_brettclive_brett Member Posts: 8
    I've just come across this  fantastic featurescript for gears and would like to see other options - for now a spoked version as in clock gears.
    I have dropped my library , copied from elsewhere, in favour of this - reprinting the gears as we speak so that they are all from the same generator.
    Only briefly looked at featurescript so much leaning to do before I am capable of doing it myself. ... when I have a spare moment or two!!
Sign In or Register to comment.