# Powerful variable system needed please

**URL:** <https://discourse.shapr3d.com/t/powerful-variable-system-needed-please/40415>\
**Category:** Modeling Questions\
**Created:** [March 1, 2026, 6:13am UTC](https://discourse.shapr3d.com/t/powerful-variable-system-needed-please/40415 "2026-03-01T06:13:02Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![GodGnidoc](https://avatars.discourse-cdn.com/v4/letter/g/3bc359/32.png) [@GodGnidoc](https://discourse.shapr3d.com/u/GodGnidoc)\
**Post date:** [March 1, 2026, 6:13am UTC](https://discourse.shapr3d.com/t/powerful-variable-system-needed-please/40415/1 "2026-03-01T06:13:02Z")

</div>

Hi, dear Shapr3D team:

I’ve just been playing around with Shapr3D for a few hours, and this powerful modeling platform deeply attracts me.

Here are some ideas from me after trying out what Shapr3D provides. Hope you like them.

The problems that these features will solve:

- When complex expressions are needed, allow unit changing or make functions accept more units.

- Optionally make a constraint or a feature be the provider of the value of a certain variable.

- Provide some variables based on some tool effects.

**More flexible units in expressions:**

I’m facing some failures when trying to achieve some calculations in expressions. I guess they all involve some unit issues.

Example one: function `floor` refuses a length variable as the parameter.

Say there is a length variable `LengthLimit = 3.76 mm`. The parser complains when I try to create a variable with expression `Length = floor(LengthLimit) mm`.

If there is already some way to make that possible, please help me.

Example two: calculate the length of the third side of a right triangle.

Say we have the length of the first two sides: `A = ...` & `B = ...`. It is not possible to get the third side like this: `C = sqrt(A*A + B*B)`.

There is a workaround expression: `C = A / sin( arctan( A / B ) )` though…

All problems above are triggered by unit checking:

- Length cannot be used as Number.

- Area cannot be used as Length.

Maybe this is by design, but I’m not aware of the reason why that is. Please tell me some design rules about this if you’d like to.

**Variable provider:**

Shapr3D allows me to create a variable from the value of a constraint. That is awesome! And soon an idea came to my mind: what if we can drag around a feature in sketch or model to modify a variable directly?

Provide an icon around the constraint or feature that references a variable. Click on the icon to switch this constraint or feature into the provider of this variable or back into the consumer of this variable.

There may be more than one provider for a variable. Display an element list below the variable definition in the history bar to show providers and consumers of this variable.

Actions like add, remove, or switch the role of an element could be done with this list.

The variable could be locked or unlocked. When it is locked, the only way to change its value is the input box on the definition card. When it is unlocked, dragging any of its provider constraints or features could change its value. Those provider constraints or features should lose the count of the freedom limit when the variable is unlocked.

**Tool-based variables:**

This feature, if we have it, will reduce the complexity of working with patterns.

Imagine that we have a long face, and we want to make a sequence of holes on it. The diameter of these holes changes by a small factor from the first one to the last one.

The work will be hard if we have to set the diameter of each hole one by one.

We can introduce a kind of variable, created by pattern tools, that applies differently to each item of this pattern.

For instance, let’s introduce a variable named `__repeat_index` which is a number indicating the number of the element in the linear sequence. This variable is different in each element of the linear sequence, varying from 1 to n.

Variables like this use reserved names so that they won’t confuse users.

Consider that multiple patterns are applied; we could add the tool history name or layer number to the variable name to make it unique.

`__repeat_index_0`

`__repeat_index_important_history`

Items outside of any pattern could reference this kind of variables too, and those variables hold a zero-value of the correct unit.

Recommend some variables:

`__repeat_index`

`__linear_total_dist`

`__rotation_angle`

Thank you for reading.

---

<div class="post-metadata">

**Author:** ![Xdrakosha](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.shapr3d.com/xdrakosha/32/24881_2.png) [@Xdrakosha](https://discourse.shapr3d.com/u/Xdrakosha)\
**Post date:** [March 1, 2026, 8:45am UTC](https://discourse.shapr3d.com/t/powerful-variable-system-needed-please/40415/2 "2026-03-01T08:45:05Z")

</div>

> [@GodGnidoc](#):
>
> If there is already some way to make that possible, please help me.

I ended up using the number type for every variable. It can be converted to any other type without any problems.

 ![image](https://us1.discourse-cdn.com/flex002/uploads/shapr3d/original/3X/5/8/5834fe8aad8907101f3473182b85a999479e3734.png)  
 ![image](https://us1.discourse-cdn.com/flex002/uploads/shapr3d/original/3X/a/8/a807bfb2cefe82070fb158fe95e39e5d426ae3f0.png)

 ![image](https://us1.discourse-cdn.com/flex002/uploads/shapr3d/original/3X/0/f/0ff4f85924ddbedc6bffacee410911da763da102.png)  
 ![image](https://us1.discourse-cdn.com/flex002/uploads/shapr3d/original/3X/7/a/7a669f923d236c7f99805d682e133c7e91c2dc16.png)

---

<div class="post-metadata">

**Author:** ![GodGnidoc](https://avatars.discourse-cdn.com/v4/letter/g/3bc359/32.png) [@GodGnidoc](https://discourse.shapr3d.com/u/GodGnidoc)\
**Post date:** [March 2, 2026, 8:25am UTC](https://discourse.shapr3d.com/t/powerful-variable-system-needed-please/40415/3 "2026-03-02T08:25:00Z")

</div>

Well I just found another way to solve problems like that:

Dividing a value with unit by another value with unit cause the result reduce the unit level.

For instance, say we have a length variable:

`A = 10 mm;`

Functions like `floor` donot accept that as a parameter, because `A` is now a length, and `floor` requires a number. But we can do this:

`floor( A / 1 mm)`

That is an avaliable expression, because the calculation removes the unit of A, but the value is remained.

Hope this is helpful to you.

---

<div class="post-metadata">

**Author:** ![drivebydesign](https://avatars.discourse-cdn.com/v4/letter/d/76d3ee/32.png) [@drivebydesign](https://discourse.shapr3d.com/u/drivebydesign)\
**Post date:** [March 2, 2026, 7:20pm UTC](https://discourse.shapr3d.com/t/powerful-variable-system-needed-please/40415/4 "2026-03-02T19:20:44Z")

</div>

What does function floor do?

---

<div class="post-metadata">

**Author:** ![Xdrakosha](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.shapr3d.com/xdrakosha/32/24881_2.png) [@Xdrakosha](https://discourse.shapr3d.com/u/Xdrakosha)\
**Post date:** [March 3, 2026, 2:29pm UTC](https://discourse.shapr3d.com/t/powerful-variable-system-needed-please/40415/5 "2026-03-03T14:29:03Z")

</div>

> [@drivebydesign](#):
>
> floor

 ![image](https://us1.discourse-cdn.com/flex002/uploads/shapr3d/original/3X/c/b/cb8c2b92f88685d4ccc1e92780a1e5cd3a20c8d4.png)

---

<div class="post-metadata">

**Author:** ![drivebydesign](https://avatars.discourse-cdn.com/v4/letter/d/76d3ee/32.png) [@drivebydesign](https://discourse.shapr3d.com/u/drivebydesign)\
**Post date:** [April 13, 2026, 7:23pm UTC](https://discourse.shapr3d.com/t/powerful-variable-system-needed-please/40415/6 "2026-04-13T19:23:52Z")

</div>

Small question - is there a way to tell function round(n) to either round up or down to the nearest integer? Thank you!
