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.

Editing Logic Function Bug

Toshimichi_OdaToshimichi_Oda OS Professional Posts: 53 PRO
After changing assignVariable previous in feature list, Editing Logic Function is not called when dialog edited.

https://cad.onshape.com/documents/47645dc8ca647639866c9042/w/44fae298ffffec741601f9b7/e/7c7abc9f9733785ccdd1e5f1?renderMode=0&uiState=61761d7aaba51a613cfe7658

(1) Edit assignVariable to make from #a=50 to #a=100.

Then feature 'showRatio' print in FS-Notice.
  !!!!! Wrong ratio is displayed. !!!!!
This is correct behavior because showRatioEditLogic is called only when feature dialog opened.

(2) Edit 'showRatio' and input in 'width' a new value 150 (old is #a).
Then definition.width is updated but showRatioEditLogic is not called.
If showRatioEditLogic were called, it would print in FS-Notice 'ratio is updated.' and
definition.ratio changed.


I propose Edit Logic Function will be called when regenerated without dialog open.
If so, (1) is not to print '!! Wrong ratio ...'.


Comments

  • Alex_KempenAlex_Kempen Member Posts: 248 EDU
    Editing logic only runs when a user manually makes a change to a feature parameter. It is not triggered by external part studio changes or changes to configurations or input variables. This is by design since otherwise, editing logic functions would need to be run every time a feature is regenerated, which would add significant baggage to part studios and introduce scenarios where changing a value can suddenly overwrite or modify the selections of a seemingly unrelated feature.

    To warn the user when exterior inputs are incorrect, including in cases where external changes are made, check the values in the feature body, and throw an error (or report a feature warning) if they are incorrect. For an example of this, see my belt calculator FeatureScript; it automatically checks the distance between a user's pulley location selections and reports a feature warning (turns red in the feature tree with an appropriate error message) if the distance doesn't match their chosen belt and pulley combination.
    CS Student at UT Dallas
    Alex.Kempen@utdallas.edu
    Check out my FeatureScripts here:



  • Toshimichi_OdaToshimichi_Oda OS Professional Posts: 53 PRO
    @Alex_Kempen,
    Thank you, your link of sample is very good.

    I will consider to use function 'reportFeatureInfo' or 'reportFeatureWarning'.

    To ways to output text message to a user of FS feature are four(as far as I know);

    (1) print(), println() in FS-Notice
    (2) reportFeatureInfo(), reportFeatureWarning() in popup dialog while editing
    (3) annotation { "Feature Name Template": "#varName" .. } of feature funciton
    (4) feature name "#varName" if a user set it
    (5) table of defineTable() which is evaluate after all regenerated.
      Table can display about information which FS feature have saved in context using
    setVariable().

    I think format "#var Name" used in (3), (4) and (5)(TemplateString) is powerless, because
    (a) it cannot control precision as like roundToPrecision()
    (b) it may output "?" if value is undefined, except (5)
        (Possibly a user may want to input string "?")
    (c) it cannot use condition branch (if-then-else or A ? B : C), except (5)

    One feature sometimes can has different role.
    For example, feature 'variable library' which you @Alex_Kempen written(sorry I have not use it in practice), sometimes has a role to make library, and someteimes a role to refer.
    A user can not see the difference of role in its name in feature list before to edit feature or unless a user change its feature name in manual input. (I think many persons input in manual input.)
    It is important to be able to see what a serial features do in feature list at glance.
    And it is better to be able to see number of imported variables in its name.

    So I want that (3) or (4) (or (5) if possible) will become powerful.
    (as long as a baggage of part studio is not too heavy)

    By the way, what I posted as a bug has my mistakes.
    This is happened only in this Part Studio( already created and new feature), so this Part Studio have been destroyed.
    But sometimes I happen like this case, I take a little time to investigate about this, if I know more I will post additionally.


Sign In or Register to comment.