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.

[FS] Determine if feature is the final enabled feature in the part studio

George_AndersonGeorge_Anderson Member Posts: 6 PRO
Is there a way inside a feature to determine if that feature is the last one in the list?

I'm developing a system where the user performs many small "atomic" operations (there might be 10-100 of these) that are extremely cheap, but then to visualize the result of the full sequence requires one big "solve" that is relatively expensive (say 1-2 seconds). I want to immediately see the result of this solve after adding atomic operations.

In my current method, I have separate "atomic" and "solve" features. To add a modification, I have to:
1) Rollback before the solve feature
2) Add the new atomic
3) Roll forward to repeat the solve.

What I'd love is for each atomic feature to *know* that it is the last one, and if so, invoke the solve function immediately, so no rollback bar is necessary.

My guess is that this is impossible, since the FeatureScript mentality is that you can't know anything downstream. However, it also seems 100% repeatable.

An alternative (that I assume also doesn't exist?) would be if we could specify a default feature insert spot somewhere other than the end. Then when I add a feature, it automatically puts it before my solve feature.

Is any of this possible?
Tagged:

Comments

  • mahirmahir Member, Developers Posts: 1,076 ✭✭✭✭✭
    From what I understand, features are basically self enclosed black boxes. There is very little information about the overall context that a feature is allowed to extract. A feature can interact with existing variables/properties and be aware of whatever is selected by an input query. But I don't believe there is any way to iterate over all your features, or even count how many there are. You might have better luck with the API.

    Of course if I'm wrong I'm sure someone will chime in :)
  • NeilCookeNeilCooke Moderator, Onshape Employees Posts: 3,537
    @mahir you are correct. 
    Director, Technical Services, EMEAI
  • MBartlett21MBartlett21 Member, OS Professional, Developers Posts: 1,945 EDU
    @NeilCooke

    Is there a way that we could specify that a feature should flow towards the end, and so automatically insert features before it.

    Maybe something like annotation { "Insert Features Before" : true }?
    MB - I make FeatureScripts: View FeatureScripts
  • NeilCookeNeilCooke Moderator, Onshape Employees Posts: 3,537
    @MBartlett21 - no that is not possible. Like @mahir says, a feature is self-contained and is unable to interact with any other features in the context.
    Director, Technical Services, EMEAI
  • MBartlett21MBartlett21 Member, OS Professional, Developers Posts: 1,945 EDU
    @NeilCooke

    I was meaning an annotation that is only treated specially by the user interface, nothing to do with the actual content of the FeatureScript.
    MB - I make FeatureScripts: View FeatureScripts
  • Jacob_CorderJacob_Corder Member Posts: 34 PRO
    @MBartlett21
    This is similar to Solidworks MacroFeatures with the alwaysAtEnd option enabled. It was a quite useful flag, however the only issues would be that queries are valid only at the time of selection.  A use case of a feature that is always at the end would be something that uses context variables to execute and has no queries in the form. Or a feature that executes some sort of design for manufacturing analysis, or something that sets a property even.

    Of course a feature at the end would ALWAYS regenerate so it could be a very time consuming feature while not rolled back or unsuppressed.

     
  • caden_armstrongcaden_armstrong Member, User Group Leader Posts: 9 PRO
    A table is always generated after all other features.
    Depending on what you need your "solve" function to do, it might work if you stick it into a table.
    But it would only be helpful if your solve is looking for a number or some kind of primitive output.

    And like @Jacob_Corder said, a feature at the end (like a table) will always regenerate and can be time consuming.

  • sebastian_glanznersebastian_glanzner Member Posts: 192 PRO
    Can you derive the part studio in another part studio tab and use there the end command? 
  • George_AndersonGeorge_Anderson Member Posts: 6 PRO
    @NeilCooke

    I was meaning an annotation that is only treated specially by the user interface, nothing to do with the actual content of the FeatureScript.
    Exactly, this would be ideal.
    @MBartlett21
     A use case of a feature that is always at the end would be something that uses context variables to execute and has no queries in the form. Or a feature that executes some sort of design for manufacturing analysis, or something that sets a property even.
    Yes, a purely context-driven feature with no parameters can work. However, that starts to sound like an awkward thing for OnShape to add for such a specific use case.
    A table is always generated after all other features.
    Depending on what you need your "solve" function to do, it might work if you stick it into a table.
    But it would only be helpful if your solve is looking for a number or some kind of primitive output.
    My output is visual unfortunately, so this won't help, but thanks for the tip -- this may come in handy for other things!
    Can you derive the part studio in another part studio tab and use there the end command? 
    That's a great idea, but it has two problems:
    1) Interactivity -- it would mean that I still have to switch between tabs to edit and visualize. I'm not sure that's any better than using the rollback bar. (I guess I could have two windows open on different monitors.)
    2) Visual clues -- I would like to see the final result as I'm editing the feature. (The "solve" is cheap enough to do live on the final feature -- I just need to not do it after every previous feature in the stack.)



  • MBartlett21MBartlett21 Member, OS Professional, Developers Posts: 1,945 EDU
    Unfortunately, using a FS Table can't set properties, like colour and material...
    MB - I make FeatureScripts: View FeatureScripts
Sign In or Register to comment.