I am aware of the challenges as I already have dived into the scripts to fix some minor quirks and bugs but it is very possible (feel free to reach out to me)

]]>171

167

DOWNLOAD:

170

]]>http://community.archimatix.com/wp-content/uploads/wpforo/attachments/3/163-ShapeDeformer.gif

In order to get the above result, you have to make sure that you open the Input Shape on the ShapeDeformer node and increase the * subdivision* parameter.

Seems to occur when I increase "*Scale*" parameter in an Extrude Nodes. However I NEED to do this to make these small 2D shapes ultimately extrude into LARGE 3D objects.

161,160

]]>I have a question, in another assets (basicaly to create material from mesh) I had problems because archimatix generates UV islands in a strange way. But I barely realize that UV2 is being generated perfectly, is it a bug or is there any special reason for this behavior?

And it is difficult for me to modify the islands to create materials correctly

159,158

Thanks in advance

]]>

FormatException: Input string was not in a correct format.

at System.Number.ParseDouble (System.String value, System.Globalization.NumberStyles options, System.Globalization.NumberFormatInfo numfmt) in <ac823e2bb42b41bda67924a45a0173c3>:0

at System.Double.Parse (System.String s, System.Globalization.NumberStyles style, System.Globalization.NumberFormatInfo info) in <ac823e2bb42b41bda67924a45a0173c3>:0

at System.Double.Parse (System.String s) in <ac823e2bb42b41bda67924a45a0173c3>:0

at AX.SoftCircuits.Eval.ExecuteTokens (System.Collections.Generic.List`1 tokens) in <490f51cbd6fa4366865a18b3a1c30eb3>:0

at AX.SoftCircuits.Eval.Execute (System.String expression) in <490f51cbd6fa4366865a18b3a1c30eb3>:0

at AX.SoftCircuits.Eval.EvaluateParameter (AX.SoftCircuits.TextParser parser, System.Int32 paramStart) in <490f51cbd6fa4366865a18b3a1c30eb3>:0

at AX.SoftCircuits.Eval.ParseParameters (AX.SoftCircuits.TextParser parser) in <490f51cbd6fa4366865a18b3a1c30eb3>:0

at AX.SoftCircuits.Eval.EvaluateFunction (AX.SoftCircuits.TextParser parser, System.String name, System.Int32 pos) in <490f51cbd6fa4366865a18b3a1c30eb3>:0

at AX.SoftCircuits.Eval.TokenizeExpression (System.String expression) in <490f51cbd6fa4366865a18b3a1c30eb3>:0

at AX.SoftCircuits.Eval.Execute (System.String expression) in <490f51cbd6fa4366865a18b3a1c30eb3>:0

at AX.AXParametricObject.parseMath (System.String expr) in <490f51cbd6fa4366865a18b3a1c30eb3>:0

at AX.AXParametricObject.executeCodeBloc (System.Collections.Generic.List`1 lines, AXGeometryTools.AXTurtle shape) in <490f51cbd6fa4366865a18b3a1c30eb3>:0

at AX.Generators.Shape.generate (System.Boolean makeGameObjects, AX.AXParametricObject initiator_po, System.Boolean isReplica) in <490f51cbd6fa4366865a18b3a1c30eb3>:0

at AX.AXParametricObject.generateOutputNow (System.Boolean makeGameObjects, AX.AXParametricObject initiator_po, System.Boolean renderToOutputParameter, System.Boolean forceGenerate) in <490f51cbd6fa4366865a18b3a1c30eb3>:0

at AX.Generators.Grouper.generate (System.Boolean makeGameObjects, AX.AXParametricObject initiator_po, System.Boolean isReplica) in <490f51cbd6fa4366865a18b3a1c30eb3>:0

at AX.AXParametricObject.generateOutputNow (System.Boolean makeGameObjects, AX.AXParametricObject initiator_po, System.Boolean renderToOutputParameter, System.Boolean forceGenerate) in <490f51cbd6fa4366865a18b3a1c30eb3>:0

at AX.AXModel.regenerateAXMeshes (System.Boolean doCacheTheThumbnails) in <490f51cbd6fa4366865a18b3a1c30eb3>:0

at AX.AXModel.Start () in <490f51cbd6fa4366865a18b3a1c30eb3>:0

(Filename: <ac823e2bb42b41bda67924a45a0173c3> Line: 0)

Unfortunately, this happens on one player's PC (as far as I know so far) and I cannot reproduce it. Any help or suggestions on how to track and fix this will be greatly appreciated.

]]>

I'm using Archimatix Pro on macOS and been using Archimatix for months but I cannot figure out how I can disconnect the connected shape node network (purple wire) till now. When I want to disconnect my workaround is to cut the node I want to detach and remake the node from scratch which is cumbersome. I'd appreciate if there's a way to disconnect the network in easy manner.

Thank you

154

]]>**Archimatix: Expressions and Math Functions**

**Expressions** define the procedural functions of parametric and runtime models. They modify parameter variables as they communicate across the Archimatix graph.

Expressions are short scripts, written as a math equation or a function, that assign a value to a parameter when a triggering parameter is updated.

This video has 3 sections, based on 3 locations where Archimatix Expressions are used.

In the first part, we’ll look at **Relation Expressions** between connected parameters. I’ll show how to offset shapes using ratios, and how to modify parameters with simple functions.

In the second part, I’ll write **Parameter Expressions** for complex math functions that use multiple variables, and I’ll modify a node in the graph by adding parameters to show the results.

In the third part, I’ll edit **Logic Expressions** directly into a Turtle script, with options to enable and disable the functions. Then I’ll save it as a new specialized node.

Expressions are also essential to **Runtime Handles**, but that topic is for another tutorial.

ARCHIMATIX EXPRESSIONS:

1. **Relation Expressions**: node-to-nodes, within the connection cable

2. **Parameter Expressions**: parameter-to-parameter, on a single node

3. **Logic Expressions**: scripted within the node’s Logic

*4. Runtime Handles Expressions: (not in this video)*

**1. Relation Expressions:**

Our first look at Expressions is within parameter relations. These expressions are automatically created by clicking on a parameter’s “sender”, and then clicking on a “receiver” on another node. Senders and receivers are bi-directional – they appear on both sides of the node.

Some parameters cannot be connected, because their variable types are incompatible.

To relate 2 Parameters on the *same* node, use a Parameter Expression, discussed in Part 2.

The Relation cable does not control the parameters, it’s actually the 2 Expressions inside. Click on the connection cable to edit them.

The order in which the related parameters were selected, determines which Expression comes first.

The default Expressions are reciprical – the parameters have a simple 1-to-1 relation.

By deleting one of the Expressions, the relation becomes one-way. Both expressions can be deleted, leaving an empty connection that does not relate parameters.

The simplest Expression is to assign a numerical value. When the trigger parameter is updated, the expression sets the related parameter. The related parameter can still be updated directly, and its value is not limited by the Expression. The Expression is only applied when the trigger is updated.

I’ll add the trigger parameter as a variable, written as: *node.parameter*. Only the triggering parameter can be used as a variable inside the expression. Referencing any other parameters will break it.

Expressions can contain **math operations**, modifying the variable by adding or subtracting a value.

**Multiplying by negative 1** creates the inverse value. When related to a Transform parameter, this expression will shift the node in the opposite direction.

A useful Expression pair is to divide and multiply by two. Shape parameters typically expand symmetrically from their center, or asymmetrically in one direction. The trick to keeping these two parameters in sync is to **divide by 2 in one expression, and multiply by 2 in the other**.

Another way to perform the same operation, is to multiply the variable by a *ratio,* written as a fraction inside parentheses. Dividing by 2 becomes multiplying by 1/2. Multiply by 2 becomes multiply by 2/1.

**Multiplying by ratios creates reciprocal expressions simply by flipping the fraction.** (2/3) compliments (3/2); (3/4) works with (4/3); and (7/8) mirrors (8/7).

Next, let’s try a simple function. I’ll add the function “**greater**” in one expression to compare the trigger variable with a set value. This expression will assign whichever value is larger. Similarly, the function “**lesser**“ picks the smaller of two values. The two parameters are still related, but the expressions can not exceed their Greater and Lesser limits.

The function “**range**” restricts an expression between both a high and a low value.

Another useful function for Relation Expression is “**Sign**”. Symmetrical parameters don’t have a problem being positive or negative, but asymmetrical parameters often require positive numbers only. A negative value might cause the node to fail, or the parameter might be clamped at 0.01 to prevent hitting zero. To convert a negative parameter to its positive value, the trigger variable is multiplied against its sign:

**Rectangle.width*Sign(Rectangle.width)**

If the variable is negative, it will be multiplied against negative 1. When the variable is positive, it is multiplied against 1. Either way, the expression produces a parameter with a positive value.

Check the online Archimatix manual for more math functions. The Expressions here are limited by the Relation. The triggering parameter is the only variable that can be referenced, and the related parameter is the only target of the assigned value.

**2. Modify a Node with Math Functions **

If I know the width and height of a right triangle, I can use the Pythagorean Theorem to calculate the long-length, called the hypotenuse. With a little trigonometry, I can also calculate the angle of the hypotenuse, called “*theta”*.

I’ll create a **math function node** that inputs *width* and *height*, and applies Expressions to the parameters to output *hypotenuse* and *theta*.

In the 2D Library is a node called **RampShape**. It’s a good start because it makes a 90 degree “Right Triangle”. RampShape already has the 2 input parameters: *height* and *width.* It’s drawing the hypotenuse, but that length is not a parameter.

Under the Logic tab are just 3 lines of Turtle script.

** mov 0 0 90**

** right width**

** fwd height**

The first line in the script transports the imaginary “turtle” to location X-0, Y-0…, and rotates the turtle 90 degrees – this is where the 90 degree angle comes from.

Next, the turtle draws a line to the right, and then draws a line forward – from the perspective of the turtle.

The 2 control parameters, *width* and *height* appear within the script as variables. The turtle draws a line to the right, the value as the *width* parameter. And the turtle moves forward, the value of the *height* parameter.

That’s the end of the script! The third leg of the triangle is not described in the logic at all. Instead, the shape is set to *Close*, and that’s where the hypotenuse comes from. At the end of the script, the turtle draws a straight line back to where it started to close the shape.

Since there’s no parameter for hypotenuse, I’ll need to modify the **RampShape** node to add it. Create a new Control Parameter by clicking on the box, and re-name it: *hypotenuse. * Capitalization counts, so I use lowercase to match the other parameters.

I’ll also create a second control parameter, and re-name it: *theta*.

**3. Parameter Expressions**

Launch Notes or Notepad, or a similar text app where we can write out this Expression:

** hypotenuse=Sqrt(height*height+width*width)**

The Pythagorean Theorem is written as an Expression to solve the hypotenuse. The variable *hypotenuse* stands alone on the left, while all the math operations and functions are on the right.

This is the structure for all Archimatix Expressions: a single variable on the left, math operators and functions on the right.

In the Relation Expressions the variables were pre-assigned, so I could only modify the functions. But in a parameter, we use the full-Expression.

But where do I put these expressions? Under which parameters?

I need to add this Expression to all parameters that will trigger *hypotenuse* to re-calculate. Not under *hypotenuse* itself – if I knew that value, I wouldn’t need an Expression to create it. The parameters that trigger *hypotenuse* are referenced within the function: *height* and *width*.

Copy-Paste the full Expression to both the *height* and *width* parameters.

Back in Notepad, I’ll write another Expression to calculate the angle: theta.

**theta=Atan2(height,width)**

This Expression is a little different. That’s a comma between *height* and *width*, not a math operator. That’s because this function “Arc Tangent 2” inputs 2 variables *height* and *width*, and returns the *angle* in degrees.

Copy-Paste the theta expression under both *height *and* width*.

The node now calculates *hypotenuse* and *theta*.

To check that hypotenuse is working I’ll input a height and width that’s easy to remember:

height=3, width=4, and hypotenuse=5.

To check that theta is working, I set height and width to the same value. When width and height are equal, theta will be 45°. If height is lower, theta will be lower. When height is higher, theta will be higher.

If you aren’t seeing these numbers, check the Expressions for spelling errors or typos. Remember capitalization counts.

**4. Control Parameters: Input and Output**

The parameter *hypotenuse* has no Expressions attached. It isn’t an input, so it cannot be used to set the other legs of the triangle.

Back in Notepad, I’ll re-arrange the Pythagorean Therom to solve for the other legs:

The Expression to find height is:

**height=Sqrt(hypotenuse*hypotenuse-width*width)**

The Expression to find width is:

**width=Sqrt(hypotenuse*hypotenuse-height*height)**

I can apply one of these Expressions under the hypotenuse parameter, and its corresponding input, but not both at the same time or I’ll get a feedback loop where *hypotenuse* overwrites the corresponding input.

To avoid this feedback loop, I could make 3 separate Pythagarus Nodes: one to solve for *hypotenuse*, one to solve for *height*, and a third that solves for *width*… But a typical workaround would be to modify the node in the graph and add Expression functions as they are needed.

Under the *Node Menu,* I’ll *Duplicate* the node, and edit the copy.

For this workaround, I’ll add safe output parameters that won’t overwrite the original height and width. These safe parameters will calculate after *hypotenuse*, and won’t feedback into it.

I create 2 more Control Parameters, and name them: *heightSafe* and *widthSafe*.

In Notepad, substitute the safe variables:

Solve for height becomes: **heightSafe=Sqrt(hypotenuse*hypotenuse-width*width)**

Solve for width becomes: ** widthSafe=Sqrt(hypotenuse*hypotenuse-height*height)**

Paste the edited Expressions into the parameters. It now solves for any side of the triangle with one node.

But… Admittedly… This isn’t exactly intuitive. The safe parameters seem redundant, and to be honest it feels like a workaround. It’s fine in the graph. Any complex parametric model will contain modified nodes, but I wouldn’t save this to the Library.

There’s a better way.

**5. Logic Expressions**

The third location where we can add our Expression in Archimatix, is inside the node’s Logic.

The Logic has limited scripting – most commands are for moving and drawing the Turtle, as we saw before – but Math functions work here, as well as Loops, and Conditional Logic.

Make another Duplicate of the original hypotenuse node.

Expressions looks a little different in a logic script. Rather than *hypotenuse=*, use the Turtle command: *set (variable),* followed by the function.

The hypotenuse expression becomes:

**set hypotenuse Sqrt(height*height+width*width)**

When this line is added, *hypotenuse* is no longer an input. The script has the final say. The parameter has become Read-Only.

In the turtle script add:

**set theta Atan2(height,width)**

Theta also becomes a Read-Only parameter.

The Expressions under the Control Parameters are no longer necessary, so I’ll delete them. The output parameters are controlled only by the logic script. It doesn’t matter which of the inputs change. Hypotenuse and theta are built-in to the node’s logic so they update together, and without any lag.

This node is more intuitive, since it only accepts inputs from *height* and *width*, and the outputs are read-only.

**6. Conditional Functions**

But I still want to solve for the other sides of the triangle. I’ll add the option to change hypotenuse into an input and solve for the other sides.

Create a new Control Parameter, name it *inputHypotenuse*, and set its type to **bool**. The new parameter appears as a checkbox that can be enabled or disabled, although it is not currently doing anything.

At the top of the Node script, add the conditional logic:

**if inputHypotenuse**

** endif**

The if-statement looks empty because we only need “if (variable)” to check when a boolean is true.

Within the conditional statement, add an empty line. This is where we’ll add the optional Expression to solve for height:

** set height Sqrt(hypotenuse*hypotenuse-width*width)**

Test the boolean switch. When disabled, the node accepts its input from *height* and *width*. *Hypotenuse* is read-only.

When the bool switch is enabled, *hypotenuse* becomes an input, and *height* changes to read-only.

Create a new parameter, set it to Bool, and name it: *solveWidth*.

Add a new line in our logic script, just below “if inputHypotenuse”.

I’ll nest another conditional block here.

** if solveWidth**

** endif**

Between these 2 lines I’ll add the nested **Expression** to solve for *width* instead of *height*.

add:

**set width Sqrt(hypotenuse*hypotenuse-height*height)**

Test the 2 boolean switches.

- With both Bools disabled,
*height*and*width*are inputs and*hypotenuse*is solved.

- With
*inputHypotenuse*enabled, the*hypotenuse*parameter becomes an input, and*height*is solved.

- With both Bools enabled,
*width*is solved.

When solving for width, there’s a rounding error in the height parameter at the edge of its decimal range. When I saw that, I panicked and tried to rewrite my code. But then I realized it is 6 orders of magnitude below the decimal. That’s in the *millionths* of a meter, or a few **microns** in either direction. The width of a human hair is 25 times thicker so this rounding error would not even be visible to the human eye.

It’s only an issue, when this parameter is related to another. it will send this rounding error as feedback, triggering unnecessary recalculations on other parts of the model. Click on the connecting rope to open the Relation Expressions, and delete the feedback Expression so the relation communicates one-way.

**7. Save to Library**

I’m happy with this node. It performs multiple Pythagorean functions and I did not need to save 3 versions. It has a small issue with one of the options, but I can deal with that. I’ll open the *Node Menu* and **Save to Library** as:** Hypotenuse**

The new **Hypotenuse** **node** now appears in the 2D Library, and in a folder named ArchimatixLibrary outside the main Archimatix folder. From here it can be moved to other projects, and Archimatix can safely be updated without over-writing my node.

Also in the ArchimatixLibrary folder, the node has a thumbnail, copied from the original **RampShape** node. I’ll edit the image to make it easier to find in the graph.