Today I was asked how to multiply measures in MacroGenerator. There are several ways to. Today's solution is to use a code point.
First create a project with a prompted measure Input and a math measure Output. To visual see the results I've added objects that are lines showing the length of and Output.
To download my starting project right click on Multiply Start.mg4 (5.2 KB) and select save to file.
Now I will insert a code point Calc after the start point. This is to modify the Output immediately after Input was created but before the points values are set.
Under Type I select Measure since Output is a measure. Under List I select the name of the measure I'm using, Output. Item is preset correctly to Value. I click the paste button to insert the following text.
@Measure[Output].Value
For test purposes I hard code the value to 2. The code looks like:
@Measure[Output].Value = 2;
I click Ok and don't see a change. MacroGenerator stores values of points to increase speed. It didn't recalculate the measure changed by the code point Calc. When I click Recalc I get the following.
The second line is now longer. Good! That worked. Now I use the drop down to change the code point to
@Measure[Output].Value = @Measure[Input].Value * 2;
When I click Ok and Recalc I get the following drawing.
Inspecting V1 and V2 by hovering over them shows me that V2 is twice as high. Good. It works!
Here is my final project. MultiplyDone.mg4 (6.4 KB) Multiply Done Right click and save it.
Multiplying by two is a very simple example but I could do much more complicated calculations. More on that later.
Hi Gary, I tried do watch the multiply start file but it cannot be found?
Monika,
You are right. I will search for it. Thanks for asking about it.
Thank you . . . . that would be helpful
Monika,
Here is the file Multiply Start.mg4 (5.2 KB)
Thank you for your effort