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.

Wave diffuser feature script

jacek_zagajajacek_zagaja Member Posts: 42
May I ask gentleman here do we have wave surface feature script in Onshape? Usefull for interiors.


  • MichaelPascoeMichaelPascoe Member Posts: 1,293 PRO
    edited February 16

    Hi @jacek_zagaja, specifically for this wave shape, you will probably need Parametric surface by @mahir. Below is a general list of features that are excellent for interior projects. Let me know if you are creating architectural drawings or cabinets, these would require another whole list of features.

    Neat features that could be used for interior projects:

  • Evan_ReeseEvan_Reese Member Posts: 1,779 PRO
    I'd probably use Rhino and Grasshopper for this personally. In fact I have in the past.

    Parametric Surface byt @mahircould work for only 1 ripple, but I don't know the tool well enough to know if it can handle multiple ripples and an interference pattern like mine above.

    I don't know of a custom feature for this, but one could certainly be made. I think the steps would be something like:
    1. make a grid of points
    2. take some user-selected points as ripple centers
    3. measure the distance from each grid point to each center, using a sine function to get the numbers to ripple like this.
    4. Add together each resulting value. If you have 3 ripple centers, then you're adding 3 numbers for every grid point to know how much to offset it up or down
    5. move each point up or down by the resulting value. I'd probably add a scale factor here too so I could adjust the ripple height.
    6. Make a surface using the points. There are a few ways: (1) Fit Spline through the border points then Fill Surface with the points as guides. (2) Fit Spline through each row or column of points and loft them. (3) use createBSplineSurface() so the points are actually the control cage of the result, which will make a smoother surface, but be harder to control the absolute ripple height.
    A lot of the same things I've done with Attractor Pattern apply here, so give that code a look if you're up for it.

    There are also some custom features from a few years back that could help with this that weren't on Michael's list:
    Slicer by @Brad_Goodman - takes a solid body and makes layers out of it like your reference image.
    Laser It by @maximilian_schommer - makes laser-cuttable waffle structures from solid bodies.
    Evan Reese / Principal and Industrial Designer with Ovyl
    Website: ovyl.io
  • S1monS1mon Member Posts: 1,713 PRO

    This is a really good list of some of my favorite FeatureScripts for doing cool stuff. 

    I don't know if there is a good way to tune this or if a different approach is needed, but in my limited testing of the Parametric Surface feature, I've found the surfaces are often not smooth enough for things I would like to do. If I try to increase the number of curves much beyond 21 it just sits and thinks forever or the feature fails in different ways. I made a copy of the custom feature and modified "Parametric Surface 2" from 21 x 21 points to 51 x 51. It takes almost a minute to rebuild the feature, according to Onshape's stats, but my clock time was many minutes and gave weird errors. It still shows surface curvature with a distinct grid pattern to it.

    It would be interesting if parametric surface had options for polar sampling in addition to grid based sampling.

    In this particular case, it's probably obvious, but it would be worth tuning the equation and parameters for Parametric Surface so that you get curves for just a 1/4 of the final pattern, and then mirror the bodies.
  • mahirmahir Member, Developers Posts: 1,275 ✭✭✭✭✭
    I played around a little bit and generated this from overlapping 3 ripple patterns. At 40 points per curve, it does take 17s for the feature to regenerate. I don't think that's too bad considering the number of guide curves necessary for the underlying loft operation. I made Parametric Surface quite a while ago, and it could definitely be refined using newer features like boundary surface. A cylindrical coordinate system would also be handy, which is why I implemented it in my Parametric Curve FS. Perhaps if I have some time (or someone else does) there will be a new version forthcoming.

    f(x,y) = .1*sin(sqrt(#x^2+#y^2)*radian*2*PI)
    + .05*cos(sqrt((#x-75)^2+(#y-75)^2)*radian*2*PI)
    + .05*cos(sqrt((#x+75)^2+(#y+75)^2)*radian*2*PI)

  • Evan_ReeseEvan_Reese Member Posts: 1,779 PRO
    wow! impressive
    Evan Reese / Principal and Industrial Designer with Ovyl
    Website: ovyl.io
  • MichaelPascoeMichaelPascoe Member Posts: 1,293 PRO

    Whew, nice! Also, the new profile pic is legit @mahir.

  • mahirmahir Member, Developers Posts: 1,275 ✭✭✭✭✭

    Whew, nice! Also, the new profile pic is legit @mahir.

    Shucks, thanks! You can blame covid for hair  :D
  • _anton_anton Member, Onshape Employees Posts: 146
  • dirk_van_der_vaartdirk_van_der_vaart Member Posts: 402 ✭✭✭
    No big talks, just do it, perfect
  • steve_shubinsteve_shubin Member Posts: 1,014 ✭✭✭✭

    Thanks Dirk
    I appreciate your comment

  • mahirmahir Member, Developers Posts: 1,275 ✭✭✭✭✭
    edited February 20
    Nice! Who needs fancy equations  :D
  • S1monS1mon Member Posts: 1,713 PRO

    Sketch 1 is impressive. I'm very fond of using a bunch of segments set to be equal to do things like that, and I've used funky helper "functions" like the curve which drives the progression of the spacing. The big downside is that if a mythical client says "I want a few more/less ripples", editing this is a bit more challenging than tweaking a couple parameters in an equation. It's certainly possible, but it can be painful.

    I still can't get over how you manage to do this on the phone interface. I play with Onshape on my iPhone and iPad every so often, but I'm pretty miserable unless I have my 4K monitor and Spacemouse.
  • steve_shubinsteve_shubin Member Posts: 1,014 ✭✭✭✭
    edited February 21

    Thanks Mahir for highlighting the main aspect of the design. NO MATH

    I had to resort to this non-math method because even though I went to school for recording engineering about 40 years ago, I don’t remember hardly a thing. So if we went over the formula for a sine, it sure doesn’t come to mind now.  LOL

    Let alone that this sine has cycles where the length incrementally decreases, and at a rate that is constantly changing.

    I have to leave that type of math up to the big brains like yourself Mahir. Because that stuff is way more than I’m capable of even dreaming about.

    EDITED — And Simon thanks for pointing out the equal length CHORDS (I’ll call them). Those chords riding on top of that curve (spline) do make for smooth and fluid incremental changes where the ramping varies along the entire length of the curve — again without having to employ any kind of fancy math

    Now as to doing it on an iPhone. You’re probably going to be surprised, but on a busy sketch like this one, with TRUCKLOADS of constraints, I found that my five-year-old iPhone is actually better at solving all the constraints than my five-year-old MacBook Pro running on Safari.

    Once I had finished setting up all the features in the tree on my iPhone, I thought I’d try using my MacBook Pro to fine-tune everything. But I found it didn’t work. Because things would go RED too easily on the MacBook Pro.

    For instance, when I changed the horizontal dimension at the very bottom on my MacBook Pro, it would just freeze, or everything would go red after an extended period of time, even though I was holding down shift.
     SEE THE POST BELOW ABOUT THE STRIKETHROUGH  On the other hand, when I changed the same dimension on my iPhone, it was instantaneous. Which makes me think that the iPhone division of Onshape, did a great job with that solver

    I also like the method of suppressing constraints on my iPhone better than on my MacBook on a busy sketch like this. Because I can just leave them off all the time while I’m working on the sketch, which again helps where there are many many constraints

    But for doing the VERY FINAL TWEAKING, so that I could get things to look fairly close to the picture, what I ended up doing was I had my MacBook Pro open so I could view the model in PERSPECTIVE from an angled FRONT VIEW, as I made changes to the sketch from TOP VIEW on my iPhone. And although there was a few second delay once I made changes, I found that this worked pretty good for doing that very last part of dialing things in

    Now as to any possible tediousness of trying to do it this way — in a sketch — as opposed to using some fancy math, well I had to employ some of the techniques that I used when I was a framer building houses.

    And that is that you lay down everything of one type, at one time, and then you move on to laying down everything of another type. So once I have my main spline, then you jump to laying out all the chords, then I do all the long vertical construction lines, so on and so forth And that type of technique can definitely speed things up.

    Now is it going to be as fast as doing it with math?  Well it may depend on the shape of the spline that I would be trying to mimic. Because I can change that shape so that the ramping is very different at various parts of the curve. So people like yourself Simon and Mahir will have to tell me what type of math it would take to do that. And how long that type of math would take to do with regards to making many changes when it comes to dialing in the final shape

  • steve_shubinsteve_shubin Member Posts: 1,014 ✭✭✭✭
    edited February 21

    Oops oops oops

    I found out why everything was going red on the desktop version of Onshape.


    Under My account / Preferences /Units / Length default unit — well I have this set to INCH

    Now when I’m in edit mode for Sketch 1, that long horizontal dimension down at the bottom is displaying in inches.

    But when I double click on it to edit it, it’s showing 9 feet. I obviously entered that particular dimension in feet.

    For some reason, I thought I would be able to change this to 11 feet by simply typing in 11 and then hitting return — thinking it would adopt the unit currently showing (ft.) and highlighted in blue. 

    Well that was as wrong as all get out. Because it was trying to enter 11 inches — as the INCH was my default under prefs.

    Trying to reduce that length down to 11 inches was going to send that sketch into overconstrained no matter what type of computer or mobile device I was using.  A dumb mistake on my part.

    So now that I finally realized what I was doing wrong, well the desktop version is working as good as my iPhone

    I don’t know if it’s an age thing or not — but sometimes I miss the most obvious of things

  • mahirmahir Member, Developers Posts: 1,275 ✭✭✭✭✭
    @steve_shubin in this case I don't think using equations would be particularly helpful unless you wanted to be able to easily tweak the number of waves. Using a sketch-controlled spline seems to have worked well for replicating the general shape. An equation also probably wouldn't regenerate faster since under the hood it's still just a spline going through control points. Plus this is for interior decor, so I doubt it's something that would need to be mathematically correct down to a gnat's ass. The only thing I might do differently is to take advantage of double symmetry. Although in this case I'm not sure if it would afford a rebuild time benefit since it's just a revolve. 
  • steve_shubinsteve_shubin Member Posts: 1,014 ✭✭✭✭

    Thank you Mahir
    Your post cleared up everything.
    I really appreciate your help !

  • mahirmahir Member, Developers Posts: 1,275 ✭✭✭✭✭
    S1mon said:
    It would be interesting if parametric surface had options for polar sampling in addition to grid based sampling.
    Hi S1mon. Your suggestion stuck with me. It could use some better error correction, but Parametric Surface now accepts equations in both Cartesian and cylindrical coordinates. The surface itself is still laid out in a rectangular grid because the underlying loft feature requires it, but at least those axisymmetric shapes are now easier to specify.

  • jacek_zagajajacek_zagaja Member Posts: 42
    edited March 29
    So many talented persons here, steve_shubin - congratulations! I'll try make it with a friend.

    BTW: do we have free nesting tool with part marking for cuting those?
  • jacek_zagajajacek_zagaja Member Posts: 42
    edited March 30
    I don't see Blank Slate’s 2D Nesting for Laser Cutting:


    I click each face and export to dxf but after second face the third wasn't exported - nothing happens.
  • MichaelPascoeMichaelPascoe Member Posts: 1,293 PRO

    Auto Layout will nest your parts. It is not true shape, but it will do standard nesting. I hear that Onshape will have built in nesting for CAM studio in the future, but not yet.

  • jacek_zagajajacek_zagaja Member Posts: 42
    edited March 30
    Works like a charm thank you. Only problem is now Onshape don't want export dxf when I select faces - nothing happens.
  • MichaelPascoeMichaelPascoe Member Posts: 1,293 PRO

    When you export the dxf, remember to change the options to "download" instead of "store in new tab":

  • jacek_zagajajacek_zagaja Member Posts: 42
    edited March 30
    Problem was on PC with Win10 while at home on Win11 laptop I could export (same browser). Will examine again tomorrow. NOD32?

    19mm PVC is quite expensive like 150$ per board so we need 9 boards. Alternative is 16mm chipboard (5pcs).
  • S1monS1mon Member Posts: 1,713 PRO
    MDF is about 1/3 of that (for a 4' x 8' sheet). It has no grain, and takes paint reasonably well.
  • bryan_lagrangebryan_lagrange Member, User Group Leader Posts: 700 ✭✭✭✭✭
    @jacek_zagaja I would love to see a picture of the final product when completed.
    Bryan Lagrange
    Twitter: @BryanLAGdesign

  • jacek_zagajajacek_zagaja Member Posts: 42
    I'm trying change element separation to 40mm and dimensions 360x245cm. Could you help?
  • steve_shubinsteve_shubin Member Posts: 1,014 ✭✭✭✭
    edited April 3


    I used transform to scale it down to 3600 mm long.

    In the ORIGINAL ASPECT RATIO part studio, I did not try to alter the aspect ratio because that would make the wave out of round. So, when I scaled, I used one factor to change both along the X and the Y. And in doing so, you end up with a height of just under 2161 mm

    I could change the height by increasing the number of full rings that you see. Though doing this will change the way it looks as compared to the picture

    EDIT — I did increase the height in one part studio to where there is now a 4th almost full ring. And the size is 360 x 245 in that part studio

    Now as far as the space between the parts, I end up with 34.379 mm. In other words about 34-1/3 mm.

    If I were to change the space between parts to 40 mm, that means I would end up with the thickness of each part being roughly around 10 mm as compared to the almost 15 mm they are right now.

    Is that what you’re hoping for with regards to the thickness ?

    In other words, are you looking for parts that are about 10 mm thick ?

    To me, in trying to keep all parts at right angle to the flat surface they may be affixed to, it seems that a 15 mm thickness would be easier to work with, as compared to the 10 mm thickness

    But if you want 10 mm, let me know — and I could modify it

    I added a IN ROOM part studio. To see what it looks like — turn on perspective view, and then zoom in enough to where you’ll be on the inside of the room. And of course, you’re going to want to view it at an angle and not straight on to get the most effect

  • jacek_zagajajacek_zagaja Member Posts: 42
    Plate thickness will be 22mm and separation distance from face to face ~40mm, size 3600x2500mm (width x height)
Sign In or Register to comment.