Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.
First time visiting? Here are some places to start:- Looking for a certain topic? Check out the categories filter or use Search (upper right).
- Need support? Ask a question to our Community Support category.
- Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
- 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.
Manipulator Change and Editing Logic working together
EvanReese
Member, Mentor Posts: 2,117 ✭✭✭✭✭
I'm working on a feature with manipulators to change some values, and I also want editing logic to change some values when others are changed. I've got them both working independently, but I'm not sure the best way to make them work together. Put another way, my editing logic works when I type a new value, but not when I change the same value by dragging a manipulator. Is there a way to get it working without somewhat re-creating the editing logic code inside the manipulator change function? Whats an efficient way to do this?
Evan Reese
Tagged:
0
Best Answer
-
konstantin_shiriazdanov Member Posts: 1,221 ✭✭✭✭✭You can always extract the code responsible for this specific behavior into a new function and there wouldn't be duplication. There is a big chance that editing logic is not triggered by manipulator change by design.
3
Answers
@ilya_baran
Perhaps Konstantin just answered this, but I have a similar question to Evan's.
Is it possible to store the values from the manipulator change function so that they can be used in the features main function? The manipulator function samples lots of values, not just the final position or the manipulator. I need an array of all of the sampled values, not the final value alone.
If this is possible, what would the solution look like?
Here is a standard manipulator triad so you don't have to start from scratch.
https://cad.onshape.com/documents/18041ec8478a11184256a73c/w/b171058d78486d5e5d4211e3/e/711d2838a330fee3545a6e7b
Thanks!
Learn more about the Gospel of Christ ( Here )
CADSharp - We make custom features and integrated Onshape apps! Learn How to FeatureScript Here 🔴
The way to do that would be to have a hidden isAnything parameter that would store, for instance, an array that the manipulator change function would update. It's not pretty and makes me wonder -- what would you want this for?
Here is a sneak peak. Looks like it will work!
@Evan_Reese Believe it or not, I actually didn't use Freeform spline for the base code =P. However, it looks so similar, and I was no doubt inspired by the FFS, I'm totally going to reference it anyways.
I threw in a sample resolution so that it will only collect points at the distances you specify
Learn more about the Gospel of Christ ( Here )
CADSharp - We make custom features and integrated Onshape apps! Learn How to FeatureScript Here 🔴
Wow, that would be an incredible tool for plumbing and wiring if it works as a path for some of those feature scripts. I'll give it a try as soon as you release it.
For something like that, it would be sweet to have a variation of FFS with pluming profiles built it. And perhaps the option to have straight pipe segments with specified corner radius.
Learn more about the Gospel of Christ ( Here )
CADSharp - We make custom features and integrated Onshape apps! Learn How to FeatureScript Here 🔴
That’s super interesting! I suppose if you wanted to get cute with it, you could also probably add periodic points using a point manipulator, which would make it possible to do things like easily moving the triad manipulator to previously added sections in order to edit parts of the line, and delete/add new sections where appropriate.
This idea is very cool and makes a lot of sense (one of those ideas I'm disappointed I didn't come up with myself). I'm guessing you would also implement some exception handling to check and make sure the hidden parameter hasn't lost it's reference and in the handling just recompute that result?
chadstoltzfus@premiercb.com