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.

New Feature: Match Closest Array Element

imants_smidchensimants_smidchens Member Posts: 61 EDU
Ever been modeling a configurable part when you realize that different materials, profiles, etc result in different options for length, thickness, diameter, or something else?

Ok in hindsight that's a pretty specific issue to have, but here's a feature that solves those issues regardless:
https://cad.onshape.com/documents/d275f0aa6c54b39d90c74962/w/e885bb4824259a9718e49d84/e/36e1d31aa7ce39ef92db4201
Tagged:

Comments

  • MichaelPascoeMichaelPascoe Member Posts: 1,464 PRO
    edited February 21

    Nice, I've been trying to think of some useful ways to use these array variables. This would be tough to do without this. Ty for sharing!


    Learn more about the Gospel of Christ  ( Here )

    🅲🅰🅳🆂🅷🅰🆁🅿  -  We make custom features and integrated Onshape apps!   CADSharp.com
  • chadstoltzfuschadstoltzfus Member, Developers Posts: 115 PRO
    Custom features + configurations = a whole new way of modeling
  • S1monS1mon Member Posts: 1,965 PRO
    @imants_smidchens
    Based on this comment, if you're ever going through a very large array, you might want to modify 

        for (var i = 0; i < size(arr); i += 1)
    to be

        var size = size(arr);
        for (var i = 0; i < size; i += 1)
    I also wonder if any of your comparisons would benefit from using tolerant flavors?

  • imants_smidchensimants_smidchens Member Posts: 61 EDU

    S1mon said:
    @imants_smidchens
    Based on this comment, if you're ever going through a very large array, you might want to modify 

        for (var i = 0; i < size(arr); i += 1)
    to be

        var size = size(arr);
        for (var i = 0; i < size; i += 1)
    I also wonder if any of your comparisons would benefit from using tolerant flavors?

    Oo - that's clever. Thanks for linking to that discussion! The performance-optimizing-gremlin part of my brain is quite appreciative. Definitely looking into tolerant flavors for a potential improved v2. This got me thinking, heck, might even try doing some regex logic to match similar/identical strings...
Sign In or Register to comment.