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.

NEED SOME EXPLANATION

papawopapawo Member, Developers Posts: 206 PRO
Tagged:

Best Answer

Answers

  • Jake_RosenfeldJake_Rosenfeld Moderator, Onshape Employees, Developers Posts: 1,285
    @Nancy
    See this part of the documentation:
    https://cad.onshape.com/FsDoc/library.html#defineFeature-function-map

    Those defaults are used when the feature is called from FeatureScript.  When your feature is called from the UI, the UI will set the value of input parameters before those defaults are applied.  What type of parameter are you trying to set a default for?
    Jake Rosenfeld - Modeling Team
  • papawopapawo Member, Developers Posts: 206 PRO
    edited January 2018
    Im trying to understand the code. no parameter in particular.

  • Jake_RosenfeldJake_Rosenfeld Moderator, Onshape Employees, Developers Posts: 1,285
    @Nancy

    If you want to set UI defaults, you can use a BoundSpec for ValueWithUnits types:
    https://cad.onshape.com/FsDoc/library.html#module-valueBounds.fs

    or you can do the following for strings, booleans, and enums:
    https://forum.onshape.com/discussion/8257/in-precondition-how-do-i-set-a-default-value-for-a-boolean#latest

    The set of defaults that you point out exists so that if someone were to call your feature like this:
    extrudedMember(context, id + "em1", {});
    Their blank map would be filled with the set of defaults that you've provided.  If they provide some arguments, only the ones they haven't specified will be filled in from the defaults map.  Generally, unless you expect that other people will be calling your feature from inside FeatureScript (instead of using it from their toolbar), there is no need to define defaults in the place you are wondering about.
    Jake Rosenfeld - Modeling Team
  • papawopapawo Member, Developers Posts: 206 PRO
  • Jake_RosenfeldJake_Rosenfeld Moderator, Onshape Employees, Developers Posts: 1,285
    @Nancy

    It may be easier to explain if you post screenshots of what 'isBiDirectionalSolidExtrudeDef' and 'EXTRUDE_DEFAULTS_3' actually are.  If any of the parameters you are trying to change using EXTRUDE_DEFAULTS_3 appear in isBidirectionalSolidExtrudeDef(...) the default will not apply because the parameter is being set by the UI, not the defaults map.
    Jake Rosenfeld - Modeling Team
  • papawopapawo Member, Developers Posts: 206 PRO
    edited January 2018
    can i share the doc with you? 
    so any parameters that is in isBidirectionalSolidExtrudeDef will overwrite what is in EXTRUDE_DEFAULTS_3?
  • papawopapawo Member, Developers Posts: 206 PRO
    thanks! its clearer now.
Sign In or Register to comment.