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.

crazy Attractor Pattern feature coming soon, had to share

EvanReeseEvanReese Member, Mentor Posts: 2,136 ✭✭✭✭✭
I had some breakthroughs on the feature the past few days so I had to share some images. I'm working on a new Attractor Pattern feature (impractical, I know), and having a great time playing with it! It's inspired by some of the work I've done with Rhino and Grasshopper in the past, and I wanted to see if I could do similar things with FeatureScript. Turns out I can. I'll make it public when I think it's ready. Sorry in advance to Onshape's servers for the amount of number-crunching  :#. It's almost definitely going to be the heaviest feature in your tree.


Evan Reese
«1

Comments

  • mahirmahir Member, Developers Posts: 1,307 ✭✭✭✭✭
    Interesting. What exactly does it do? Based on the name and pictures, it looks like pattern seeds have successive iterations of their transform/direction vector tweaked to steer towards an arbitrary point? And the degree of steering is dependent on proximity, kind of like a black hole?
  • EvanReeseEvanReese Member, Mentor Posts: 2,136 ✭✭✭✭✭
    edited August 2020
    The basic function is to measure the distance from an "attractor" to a grid point, and then use that distance value (with some multiplier) to drive whatever you want, like color, scale, rotation, etc. It's not an original idea, but perhaps hasn't been done before in Onshape.
    Evan Reese
  • TimRiceTimRice Member, Moderator, Onshape Employees Posts: 315
    @mark_leichliter
    That looks really cool!! What is the purpose of the attractor-driven patterning? 
    Tim Rice | User Experience | Support 
    Onshape, Inc.
  • EvanReeseEvanReese Member, Mentor Posts: 2,136 ✭✭✭✭✭
    TimRice said:
    @mark_leichliter
    That looks really cool!! What is the purpose of the attractor-driven patterning? 
    Mostly what you said, looking cool 😎 
    Evan Reese
  • mark_leichlitermark_leichliter Member Posts: 12 ✭✭
    Thanks, guys! The cutout pattern is purely for aesthetic effect - plus, apparently, to drive the cost to manufacture these things through the roof.
  • EvanReeseEvanReese Member, Mentor Posts: 2,136 ✭✭✭✭✭
    This is excellent, Evan! I'm evaluating Onshape for my needs a second time, and am finding it almost perfect - except for my need for this kind of attractor-driven patterning. I'd love to move away from the Rhino+Grasshopper combo for these kinds of projects:

    Is this something your FeatureScript could do?
    I think I could get something similar perhaps. It's not going to be as powerful as grasshopper because there are certain parameters I'm not sure how to drive. If you're pretty code-savvy (or could learn to be) then you could probably write a much more powerful feature for your needs, or even write a new feature per-project to get different effects. Here's a rushed attempt at something like your pattern though. There's still not a great way for this feature to add the border at the edge like you show, and I've still not added the boolean operations to it to cut things yet. I also don't (yet) have a way for the pattern to fade out completely like your pattern. Depending on how core this kind of thing is (or isn't) to your work, you might find you can get away with it. Onshape looks like a clear winner to me for the rest of the design you're showing, which could make it a trade worth making.
    Evan Reese
  • mark_leichlitermark_leichliter Member Posts: 12 ✭✭
    That's awesome, Evan! My coding skills are pretty rudimentary, but just seeing what you've done is very encouraging. I've not been able to get a GH definition that does the borders properly, either - rely on the Curve Boolean tool and a lot of patience to add that in. The important part of the pattern is how it flows across all the faces - is that possible using your FeatureScript?
  • joe_dunnejoe_dunne Onshape Employees, Developers, csevp Posts: 198
    Question: What is it for?
    Answer: It looks cool.

    I love it. This does look really interesting. Adding visual style features like this is more useful that you may think. Its surprising where things like this get used. 
    Joe Dunne / Onshape, Inc.
  • EvanReeseEvanReese Member, Mentor Posts: 2,136 ✭✭✭✭✭
    joe_dunne said:
    Question: What is it for?
    Answer: It looks cool.

    I love it. This does look really interesting. Adding visual style features like this is more useful that you may think. Its surprising where things like this get used. 
    I actually incidentally came up with an Industrial Design concept today that will have to use this feature. I guess I just subconsciously assume everyone on here designs industrial machines or something and for that it's more of a curiosity, haha.
    Evan Reese
  • EvanReeseEvanReese Member, Mentor Posts: 2,136 ✭✭✭✭✭
    That's awesome, Evan! My coding skills are pretty rudimentary, but just seeing what you've done is very encouraging. I've not been able to get a GH definition that does the borders properly, either - rely on the Curve Boolean tool and a lot of patience to add that in. The important part of the pattern is how it flows across all the faces - is that possible using your FeatureScript?
    Grasshopper is really my only other exposure to anything algorithmic. I don't know any other coding languages, but have been able to make progress with FS by banging my head against the wall in the evening a few nights a week, and with the generous help of the talented folks on this forum.

    I think you could get it working across your panels with a new feature instance per-panel. As long as your input parameters are the same and you use the same attractor, it ought to work. I'm not sure that the hexagons would line up at the corners exactly. I think if it doesn't work right now, it could be made to work with some code updates. You could also transform the panels to all line up on a flat plane, make your pattern in one feature, then transform them back. That would almost certainly work.
    Evan Reese
  • TimRiceTimRice Member, Moderator, Onshape Employees Posts: 315
    @Evan_Reese
    I am curious if @mark_leichliter could use a 3D spline or a Helix feature as the input for the attractor and then have the custom feature map to each face of the part as it goes around.
    Tim Rice | User Experience | Support 
    Onshape, Inc.
  • alnisalnis Member, Developers Posts: 452 EDU
    Here's my wimpy attempt at making something similar with just the default features :D. I'll think about it a bit more and I'll return to it later. For the border, I created a new sketch with an offset of the panel profile and extruded with the add option.
    https://cad.onshape.com/documents/17627523c128e89232260008/v/69de3eb9cf75934c15e8700a/e/eb36b930236723a924bc1d96

    Get in touch: contact@alnis.dev | My personal site: https://alnis.dev
    @alnis is my personal account. @alnis_ptc is my official PTC account.
  • EvanReeseEvanReese Member, Mentor Posts: 2,136 ✭✭✭✭✭
    TimRice said:
    @Evan_Reese
    I am curious if @mark_leichliter could use a 3D spline or a Helix feature as the input for the attractor and then have the custom feature map to each face of the part as it goes around.
    Yes, any entity can be an attractor. The only issue that I could see is making the grids line up because they are based on the surface UVs (like the surface pattern feature). In this particular case the grids would be similar because they would probably be made by patterning to begin with. If you want make each pattern cell actually match at the part seams it might take further trickery.
    Evan Reese
  • mark_leichlitermark_leichliter Member Posts: 12 ✭✭
    This all fantastic - thanks, all!
    Alnis - good stuff. I'll have to pick your example apart when I have a minute (or a few hours, more like!) BTW, it was your video on using Onshape for making laser cut parts that piquéd my interest in it again. Thanks for that!
  • alnisalnis Member, Developers Posts: 452 EDU
    Happy to help! I'm just starting to learn feature patterns with variables, so I might be using some poor practices. Take the model with a grain of salt :) Glad that you enjoyed the video! I'm hoping to make more soon.
    Get in touch: contact@alnis.dev | My personal site: https://alnis.dev
    @alnis is my personal account. @alnis_ptc is my official PTC account.
  • EvanReeseEvanReese Member, Mentor Posts: 2,136 ✭✭✭✭✭
    Happy to help! I'm just starting to learn feature patterns with variables, so I might be using some poor practices. Take the model with a grain of salt :) Glad that you enjoyed the video! I'm hoping to make more soon.
    Alnis, what a madman! So cool to see a nested loop made with native features.

    It's worth noting that even if you could get an attractor setup within the feature tree, the rebuild time would eat your lunch since you have to use "apply per instance" feature patterns which will have a lot of extra computation you don't need. Your two patterns make 252 instances at about 29 seconds. 

    With the custom feature, I was able to make 4696 instances in about 29 seconds since it doesn't have the baggage of all of the extra stuff in each feature call. I'm just calculating transforms, and combining them, which are pretty lightweight math. And that's with me really not knowing how to optimize a feature (I'll be posting questions on that later). 
    Evan Reese
  • fnxffnxf Member, User Group Leader Posts: 138 PRO
    Looking forward to this- patterns can be boring, so to have something to spruce them up is always welcome.
  • alnisalnis Member, Developers Posts: 452 EDU
    @Evan_Reese yep, my approach definitely makes a slow part studio! I'm really looking forwards to using your attractor featurescript. It looks so cool! That's an impressive instance count for a relatively fast regeneration time. There's so much potential for super cool models made with this!
    Get in touch: contact@alnis.dev | My personal site: https://alnis.dev
    @alnis is my personal account. @alnis_ptc is my official PTC account.
  • EvanReeseEvanReese Member, Mentor Posts: 2,136 ✭✭✭✭✭
    It's fun to use! I've got just a few small things to figure out before I'm ready for beta.
    Evan Reese
  • romeograhamromeograham Member, csevp Posts: 676 PRO
    @Evan_Reese
    Can't wait - looks super interesting!
  • john_mcclaryjohn_mcclary Member, Developers Posts: 3,936 PRO
    wow
  • TimRiceTimRice Member, Moderator, Onshape Employees Posts: 315
    @Evan_Reese
    That is SUPER neat! Looking forward to using the feature and taking a look at your FS!
    Tim Rice | User Experience | Support 
    Onshape, Inc.
  • mark_leichlitermark_leichliter Member Posts: 12 ✭✭
    Thanks again for your work on this, Evan!
  • EvanReeseEvanReese Member, Mentor Posts: 2,136 ✭✭✭✭✭
    Thanks again for your work on this, Evan!
    It's been fun! btw, I spent a bit more time to see whether I could get something more like your goal, and landed here. Is that close enough for your needs?

    Evan Reese
  • mark_leichlitermark_leichliter Member Posts: 12 ✭✭
    Yes - this is brilliant!
  • emagdalenaC2iemagdalenaC2i Member, Developers, Channel partner Posts: 863 ✭✭✭✭✭
    Great. Maybe I can play with the Mandelbrot fractal in Onshape ;-)

    Un saludo,

    Eduardo Magdalena                         C2i Change 2 improve                         ☑ ¿Por qué no organizamos una reunión online?  
                                                                         Partner de PTC - Onshape                                     Averigua a quién conocemos en común
  • EvanReeseEvanReese Member, Mentor Posts: 2,136 ✭✭✭✭✭
    You could certainly write a feature that does, then you'd definitely dethrone me for heaviest feature rebuild time (that I'm aware of)
    Evan Reese
  • emagdalenaC2iemagdalenaC2i Member, Developers, Channel partner Posts: 863 ✭✭✭✭✭
    The Mandelbrot pattern is easy, but the performance would be a nigthmare  :D

    These are some articles about performance in arrays I wrote some time ago
    http://c2i.es/blog/close-2-circle-1/post/optimizacion-de-rendimiento-en-onshape-parte-i-294
    Un saludo,

    Eduardo Magdalena                         C2i Change 2 improve                         ☑ ¿Por qué no organizamos una reunión online?  
                                                                         Partner de PTC - Onshape                                     Averigua a quién conocemos en común
Sign In or Register to comment.