Parametric design with variables and expressions


What you'll learn

Learn how to use Variables and Expressions in Shapr3D with Claas Kuhnen to build more flexible and efficient parametric models. This tutorial demonstrates how to define variables, apply expressions to control dimensions, and modify designs through the History sidebar. Gain full control over your design process by automating updates and making real-time adjustments.

Key topics covered:

  • Creating Variables – Define and manage global parameters for dynamic modeling.
  • Using Expressions – Automate calculations to drive dimensions and relationships.
  • Sketching with Variables – Link sketch dimensions to variables for easy updates.
  • Modeling with Variables – Apply expressions to extrusions, shells, and fillets for precise control.
  • History-Based Editing – Modify variables directly in the History sidebar for non-destructive changes.
  • Real-World Applications – Optimize product designs by adjusting dimensions with a single input.

Master these tools to accelerate design iterations and create adaptive, easily adjustable models in Shapr3D.

Transcript

00:00

Hello everybody and welcome to the Shapr3D tutorial in which I will introduce you to the new variable and expression system.

00:10

You will learn about where we can create variables all over in the interface at various positions. And then later also where you will see them in the history, how we could rename them, change the value, and then logically how we could use variables and expressions to drive our sketch and modeling features.

00:35

For those who don't really know what variables and expressions are, think about them as global values you can define. And then every sketch and modeling command can essentially receive these values. An expression is then a very simple mathematical calculation. Let me show you what that means. I have here...

01:03

this sketch for the body. Let's go to the front view. I will click on this line. You will see that the dimension is 20 millimeters. If I click on it, now you will see the name width. That is actually the width variable. And 20 is this value. So when I change this to 25, you will see the whole body grow. If I make this 15, everything updates.

01:32

There's also a small offset, for example, with the button and the body, but change this. You see how this grows. And if I go to the button sketch, you will see that here, this states 11. If I click on this, you see that the expression, which is a very simple mathematical calculation or equation, states the value of width.

02:02

minus the value of offset. In addition, I also have two additional objects. For example, this vessel study or this electric housing model. And both are very good examples to show you additional use case scenarios, where and how you could use variables and expressions to accelerate your design exploration. And with all this said,

02:31

Let me show you now how this works. We're in Shapr3D, a new empty design. Millimeters is the unit system. All snapping elements are turned on. Let's go to a right view. I'll start with a sketch somewhere on the grid, draw a line. This line will be horizontally constrained. And then under the line, we draw a 180-degree arc, so half a circle.

03:00

The center point of the arc to the line, we would like to be on the midpoint of that line. So I would like now to drive the length of this line with a variable. When you click on the line, you get the dimensional readout, 20 millimeters. When you click on it, you see the 20, but then there's also a new icon. And this is where we can create a variable.

03:30

When you click on it, create our first variable. This is called length 1 equal to 20. This is the first variable. This is a length. And because it's the first one, it has a number 1. Because the line is 20 millimeters long, it has the value 20. Click Create. You will see then this got changed into length 1. If I click somewhere else, you see the value readout of this variable.

04:00

You cannot change the value of a variable in here anymore. You just now have to go to the history where you see the variable, right-click, we can rename this into width. And when we change the value to 10, you will see how everything nicely updates.

04:22

This arc, I would like to be perfectly centered under the Z-axis and glued onto the origin of the sketch. So how can we do this? I will change this back to 20. I will go to the sketch, create a line from the sketch arc centered down to this origin. There we are. And press S.

04:50

Select this line, construction, and horizontal constraint. And then this is actually the radius. And this is the diameter. A radius is half of the diameter. So we can write a very simple expression. When I select this radius line, click on the 10. And now I can select the variable we created with.

05:20

And then say, I need half of this value divided by two. So a very simple mathematical equation. Press Enter. And then when we change this to 25, you will see this perfectly updates as I desire. I will go to Settings, turn the Always Show Dimensions off for the moment. Then I exit the sketch, go into 3D view.

05:50

And let me show you now how you can add a variable and expression to a modeling command. I will extrude this one out a little bit, and this should always be three times more than the width. Here's the dimensional readout. And again, all I need to do is select the width. And this time we say multiply by three. That's it. Pretty cool.

06:20

If I select these two edges and round them, also here, I could then, when I click on it, change everything. But after you created a modeling feature, you could go into the history then or later and change this, for example. So here, this should be the same. So this is width, I'm writing this by hand this time because the spelling of variables is important.

06:50

divided by 2 because that is the radius. And enter. So one more test. 10, everything updates as I want.

07:05

On this top face, I would like to have a button. Button should have a center and an outer ring. Each one should be exactly the same proportion, so 50%. And I want everything to have an offset of 4 millimeters. So with this face selected, I can go to Sketch. Then I will project in one or two of these rounded.

07:34

edges because they are based on G1 fillet. That's an arc. I have then the center point. I can create here a circle. There we are. And when I go to here, now there, I would like to say, so this value is actually the width minus an offset value, but I don't have actually an offset value variable.

08:04

So I will exit the sketch, go to Add, go to Add Variable, call this Offset, and I give this a value of 4 millimeters.

08:19

Then I will go back to the sketch and now I will say, this is width minus the offset value and return. Pretty cool. So again, when I change this to 10, you see, we will maintain always having four millimeters of an offset. I hope at this point, you start noticing and realizing is really

08:48

It's very easy how you can create variables and expressions and then use them to drive your design.

08:57

You can create everything at the beginning, or you can later create variables afterwards and then redesign or update how everything is driven.

09:10

To bring this slowly to an end, let's go ahead and we would like to shell everything. So I go to select this body, then I go to shell, shell this a little bit.

09:29

here, for example, now I will say it's length one again, because we have no other lengths variable. There we are. This is the shell command, 1.25 millimeters, rename and shell. So naming really is very, very important for this type of work. Okay. Cut this through. There we are. And there now I would like to put in the...

09:58

kind of like a button, a center and a ring. So to do this, I'll go to the front view, create a sketch, because this sketch is then perpendicular running through it. I will draw myself one line and another line, press escape, escape. These two lines, they have to be horizontal vertically, and they also should be...

10:28

equal. So with this, this point is always at the center of that circle. So just constraints working with equal or so, they're still at times very useful to use. Then I will go to a side view, draw a line up, go over and down onto the midpoint from the vertical sketch midpoint, draw a line up and then down to close it.

10:58

vertical elements and decide them to be horizontal, vertically constrained.

11:05

I can revolve them. And there, beautiful. One more test. If I go to 10, everything should shrink. They do. The height wise, it does not yet, because that wasn't really defined yet.

11:34

So I can go back to the sketch. I select the first one. This should be, I will make this one create. And then this length one, rename into button height.

11:55

And then the value will be 1 millimeter. When I go back to the sketch and then this one here, I will say, you also button height. So it's always the same. I can also play with button height divided by 2. So it is 50% smaller, for example.

12:24

And these expressions I can always work with and adjust. I could also say multiply by 0.75. So it's kind of like three quarters of the original button height. Beautiful. If I go back and change this, there you see that all updated. If I change the button height now to...

12:53

0.5 millimeters or 2 millimeters, you see how everything is updating. This is just really the beauty of this design.

13:06

It doesn't also really matter when you create the buttons, sorry, it doesn't really matter when you create the variables in your design, because they are global. They will create it more or less if you want to think at the beginning, and then all commands can reference to them. So this is not like when do you make a sketch? When do you create a modeling command, for example. So I will go to a side view, turn section view on.

13:34

Select everything, and I would like to call the split command and I will split the lower part. So there we are. I would like to create another construction plane. This I would like to offset to be always at the center of this button now.

14:04

So I know that this is actually the width multiplied by three, but then this value I have to divide by two. And done. And then this shell, I can split by this construction plane. Beautiful.

14:35

Maybe a little bit of tidy up. We can round all these edges.

14:46

One thing that's the main reason why I also did this is now we have to be careful. If I make these buttons very tiny, then these fillets can actually get to be more problematic. So in this case, I should actually break this up into two different...

15:08

Features. So here's one for the edge and one for the button. And then here I could say, so button height.

15:22

0.8. So we could always say this is button height divided by 2. Beautiful. One more test. If we make everything smaller, there you see that all actually updated beautifully. Really nice.

15:51

I hope with this demonstration of this remote control, you were able to see how easy it is to create the variables in the add menu, when we are in the sketch menu, when we're 3D modeling, and then also how to adjust, rename the variables here, and even associate them to modeling commands inside the history.

16:19

To bring this tutorial to an end, I would like to show you now two other examples to demonstrate to you where and how variables and expressions can come in very handy in your design work. In this example here, you see I have two vessels. If I go to a side view, you might quite quickly notice there are a lot of similarities, the handle, the lid grip, and the spout always look the same. But then the rest is actually...

16:48

Different. And this is where expressions and variables can come in very, very handy when you have to adjust multiple objects at once. You see all of my variables are also very short. For example, wall thickness, handle width, handle height, handle angle, hang handle depth, the spout angle.

17:15

And the reason why I wrote them this very short is once you start writing an expression, you don't have a very long expression, you can keep it very short as a tip. So when I go ahead and go to this handle angle and change this to 110, you will see that both handles are updated. And that is because the angle dimension in both sketches...

17:45

Actually use the variable handle angle.

17:51

So that means you don't have to go into the sketches and then adjust the angle dimension for each sketch. You can associate both or imagine you have four. You can associate four handle angle dimensions to one variable. That is a clear time saver. Another very good benefit of all this is also when you have a very long...

18:19

Design history, it's very easy to adjust everything. I go to a 3D view. I have here the bigger one, the smaller one. Here's my material thickness. I can change this to 0.2. And this actually adjusts everything. The main vessel, the lid and the handle for each, because this value is used in this shell command.

18:48

I have there another shell command. So I would not have to go into my history, find wherever I have a shell command and then adjust it when, for example, meeting with a client or when prototyping, we could simply look at all the design variations we have and play with these values to change and drive the design. Literally.

19:16

With just a mouse click, as you can see. Now this is a really huge time saver. As the last example, I would like to use this electronic housing design to show you how useful variables and expressions will be for designers and manufacturing engineers in a collaborative environment. Let's pretend we are in prototyping phase.

19:45

And I would like to create a little bit of a gap between these surfaces. So I can simply select on one shell. I would like to manipulate all these faces. There we are. And then I add a little bit of an offset, 0.1 millimeters.

20:13

To make this also very easy to discover, I will create this as a variable. At the end here, I have this feature. In my case, I will move this above the move command. If I suppress the move command, you will see this was nothing else than rotating and moving the top part away. And this face offset 06, I can rename.

20:42

as fitting adjustment.

20:49

And this name I will copy it, because if I now scroll up, there is my variable, I can rename it. There we are. Perfect. So now this adjustment, for example, is very easy to find, literally for everybody. Also because the variable has the same name as the modeling feature, it will make it very easy for everybody to find.

21:18

So think about it now, when you have multiple people working on such a design, how easy is it for everybody to understand the history, how everything was created? You want the readability of everything and discoverability to be a lot easier. And the same could be applied also to the sketches. So I have here the sketch for all the openings.

21:46

I have here, these are the tiny holes for the screws to go through. If I only work in one design, I could create a dimension and then make everything equal. So I will turn this one on. So you see what here actually is already dimensioned. So there we have actually this dimension. I can go to here and then call this...

22:15

Um, there we are. And.

22:28

Good spelling always can help. Screw opening. And then I can select all those, essentially, if I want, just as a tip and make them equal to that one.

22:52

So if this screw opening now gets changed, let's say I make it really tiny, you will see they all are adjusted. And when I show also my design, you see also here in the design, everything was changed.

23:15

Beautiful. And this specifically is something that can happen quite often between the industrial designer and the manufacturing engineers when things have to be changed. Very good. Now with this, we reached the end of this demonstration and I hope you've got a very good understanding of literally how easy it is to work with variables and expressions and also how powerful they are to drive design changes in simple to complex designs.

 

Try it yourself

modeling-projects-variables-expressions.png
Remote control
Download
download-housing.png
Housing
Download
download-vessel.png
Vessel
Download

 

About the instructor

Instructor-Claas-Kuhnen.png

Claas Kuhnen is a German 3D designer known for his strong interdisciplinary background in product, space, and animation design. He holds an undergraduate degree in Color Design for Interior and Product Design from the University of Applied Science and Art in Hildesheim, Germany. He further pursued his education and obtained a Masters in Fine Arts in 3D Studio Art with a focus on Jewelry Design and 3D Animation from Bowling Green State University.

As a designer, Claas Kuhnen is particularly interested in design-informed solutions and exploring the relationship between consumerism, products, and their impact on society. He engages in a wide range of projects, including furniture design, interior and exhibit design, consumer product design, and medical product design.

In his research and studio practice, Claas Kuhnen delves into the application of a modern multi-application and interdisciplinary workflow. His areas of investigation encompass parametric, generative, and subdivision surface modeling, as well as AR (Augmented Reality), VR (Virtual Reality), photogrammetry, and AI-powered tools. He collaborates with various national and international universities and companies on research and design projects, contributing his expertise and exploring innovative approaches.

Claas Kuhnen's design projects span diverse domains. For instance, he has designed exhibit artifacts for The Henry Ford Museum, developed medical devices for the Department of Pharmacy Practice, and undertaken interior design projects that serve the community. His work showcases a keen understanding of the intersections between design, technology, and societal impact.

In addition to his design practice, Claas Kuhnen is actively involved in teaching and sharing his knowledge with students. His classroom experience is strongly influenced by his diverse research background, providing students with a modern, interdisciplinary, and competitive education.

Furthermore, Claas Kuhnen's work and techniques have been featured in exhibitions such as Autodesk University, SIGGRAPH, SOFA, and SNAG. He actively engages in educational collaboration efforts with both national and international universities and serves as a Matter Expert for leading design software companies, contributing to the advancement of design tools and methodologies.

Return to top
Was this article helpful?
2 out of 2 found this helpful

Topics

See more