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

Evan_ReeseEvan_Reese Member Posts: 701 PRO
edited January 7 in FeatureScript
I'm making my first foray into Editing Logic Functions, and I don't seem to be wrapping my head around it. I've been able to make one boolean control another boolean. I also was able to make one length value control another one, but if I manually changed the controlled length, it wouldn't update when I changed the controlling value anymore. Why is that? Lastly, I'm trying to control a boolean with a pair length values and some greater-than logic, and can't seem to get it working. The link is here. Can someone help me understand why this isn't working? this is the code below
export function editTest(context is Context, id is Id, oldDefinition is map, definition is map, isCreating is boolean) returns map
{

    if (definition.meLength1 > definition.myLength2)
    {
        definition.yourBoolean = true;
        return definition;
    }
    else
    {
        definition.yourBoolean = false;
        return definition;
    }

}
for some reason the code for > formats a $gt above, but it's > in the feature studio.
Evan Reese / Principal and Industrial Designer with Fractal
Website: fractalmade.com
Instagram: @evan.reese.designs

Best Answer

  • Evan_ReeseEvan_Reese Member Posts: 701 PRO
    Accepted Answer
    aaaand, in re-reading the code above I noticed a typo that caused it to fail. Onshape, can we please delete posts so as to not embarrass ourselves?  :D
    Evan Reese / Principal and Industrial Designer with Fractal
    Website: fractalmade.com
    Instagram: @evan.reese.designs

Answers

  • Evan_ReeseEvan_Reese Member Posts: 701 PRO
    Accepted Answer
    aaaand, in re-reading the code above I noticed a typo that caused it to fail. Onshape, can we please delete posts so as to not embarrass ourselves?  :D
    Evan Reese / Principal and Industrial Designer with Fractal
    Website: fractalmade.com
    Instagram: @evan.reese.designs
  • mahirmahir Member, Developers Posts: 1,081 ✭✭✭✭✭
    definition.meLength1
    It sounds a bit cockney for @NeilCooke, but maybe you were channeling your inner Brit ;)
  • Evan_ReeseEvan_Reese Member Posts: 701 PRO
    haha. should have be definition.méLength1
    Evan Reese / Principal and Industrial Designer with Fractal
    Website: fractalmade.com
    Instagram: @evan.reese.designs
  • FdaFda Member Posts: 40 ✭✭
    edited January 8
Sign In or Register to comment.