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.

Supported undo functionality

wickedDesignswickedDesigns Member Posts: 6
Is there a supported way to perform and then undo an operation in Featurescript?  

My current usage case is that I have an error condition that would be easiest to test by performing an opSplitPart and then evaluating some information about the resulting bodies.  I know that I could opBoolean them back together, but it feels like it would be more efficient to just pop the split off the stack, so to speak (especially if there was a more complex series of operations needed for testing).  I see that there is an abortFeature function, but I am assuming its use isn't supported since it is marked internal.

Perhaps there's a way to declare a sort of private subfeature which performs the error testing and then purposefully fails, throwing its result and thus causing its operations to be undone via the internal feature logic.  Would that be a reasonable approach?  Is there another approach I'm missing?  

Comments

  • NeilCookeNeilCooke Moderator, Onshape Employees Posts: 5,682
    Even if your function throws an error, it would still have split the body to do your test. Probably best to make a copy of the body first then do your split on the copied body, then delete the resultant bodies afterwards. Try the new profiler to see which approach is the most efficient.
    Senior Director, Technical Services, EMEAI
  • lanalana Onshape Employees Posts: 706
    You can wrap you test into startFeature(), abortFeature() calls. A simple use example is in

    computePatternTangents function in curvePattern.fs of std 

Sign In or Register to comment.