Cancel
Showing results for
Did you mean:

# Array of formula driven variables

N/A

Hi there!
I started drawing a guitar neck. I would like to draw the fret positions on a separate
layer.
Given a fixed scale length for the guitar (string length), the position of fret
#n (with respect to the end of the fretboard, i.e. the string nut) is a function
of n.
As far as I saw, using the Variable Array, I could create 22 variables (for 22 fret
positions) of the form Xn = f(n). I was wondering if there was an easy way to create
the array of variable automatically (as I would do in Excel for example, entering
the formula in the first cell - expressed as a function of the line index - and
extending it to 22 cells), instead of entering 22 variable names and formulas by
hand.
If i understood properly there is a way to link Excel cells' values to SolidEdge's
variables. But I do not have Office installed on my computer, and anyway, I'd prefer
not to rely on a second software.
In C what I want would simply look like this :
---------------------------
float X;
for (int i = 0; i > 22; i++)
{
X = f(i); // with f any defined function
}
---------------------------
Once I'd have those variables, I was thinking of drawing lines on the fretboard
and use a driving dimension to locate them at the distance Xn from the fretboard
end.
I would be pleased if someone had a better, quicker way of achieving this kind of
result (not that I am too lazy to enter 22 variables, but I always like to get it
done from the least steps possible, even if it takes longer to learn how to minimize
the steps number).
Thank you all.
Best regards.
Cedric.

5 REPLIES

# Re: Array of formula driven variables

N/A
Cedric,
Here is one way you can do this. Use the image attached for reference.
Dimensions may be defined through a formula.
1. Draw your geometry. In the image I have the outside lines that represent
the neck of the guitar. I have drawn in vertical lines that represent the
frets. You do not have to put them in the exact location. All you have to do
is to get them close.
2. Dimension the length of the neck. This is the 20 inch dimension.
3. Place Distance between dimensions starting from the right between each
vertical fret line.
4. Define the right most dimension as a function of the overall length / the
number of spaces between the frets. That is 5 in this case. 4.1. To do
this double click on the 3.077 dimension. You will see a Formula field in
the ribbon bar at the top of the display.
4.2 Click on the 20 inch dimension. You will see the system generated
name for the dimension display in the formula field. You may rename
dimensions to give them more meaningful names.
4.3 In the formula field key in /5 after the name of the 20 inch
dimension. That is the slash '/' and the number 5.
4.4 Press the Enter key on the keyboard.
4.5 You now have defined the distance between the right end of the neck
and the first fret through a formula. Notice that the line moves and the
dimension changes color. This is because the dimension is driven through a
formula.
5. Define the remaining dimensions that control the distance between the
other frets as a function of the dimension you just defined.
5.1 Double click on one of the other dimensions.
5.2 Click on the right most fret dimension. This is the one you defined
the formula for.
5.3 Press the Enter key on the keyboard. You just defined this dimension
to be equal to the first dimension.
5.4 Repeat the steps for the remaining dimensions. Notice that there is
not a dimension to the right most vertical line.
6. Change the length dimension of the neck. Click on the length dimension
and use the mouse wheel to change the value of the dimension. Or you can
just key in the length. As the length changes the distances between the
frets will also change.
Have fun!
Rick B.

# Re: Array of formula driven variables

N/A

Hi Ricky.
I understand fully your example (I think so), but I cannot apply your solution to
my case, because the distance between each fret varies. The distance from the fret
#0 (the end of the fingerboard) a fret #n is a non linear function of n. For example
it could be f(n) = L/n where L is the 20mm dimension on your example picture.
So I could start as you did and edit the position of each fret and enter L for fret
1, L/2 for fret 2, ... L/n for fret n.
I should do that 22 times for usual neck which could be (is) tedious.
So I was looking for a way to automatically define an array of variables, say called
Xn, where each Xn = L/n. This can be done in Excel for example.
I would only need to enter Xn for the position of fret n as a driving dimension.
I hope this is a clearer description of the problem.
Thank you again!
Regards.
C
"Ricky Black" wrote:
>Cedric,
>Here is one way you can do this. Use the image attached for reference.
>Dimensions may be defined through a formula.
>1. Draw your geometry. In the image I have the outside lines that represent
>
>the neck of the guitar. I have drawn in vertical lines that represent the
>
>frets. You do not have to put them in the exact location. All you have to
>do
>is to get them close.
>2. Dimension the length of the neck. This is the 20 inch dimension.
>3. Place Distance between dimensions starting from the right between each
>
>vertical fret line.
>4. Define the right most dimension as a function of the overall length / the
>
>number of spaces between the frets. That is 5 in this case. 4.1. To do
>
>this double click on the 3.077 dimension. You will see a Formula field in
>
>the ribbon bar at the top of the display.
> 4.2 Click on the 20 inch dimension. You will see the system generated
>
>name for the dimension display in the formula field. You may rename
>dimensions to give them more meaningful names.
> 4.3 In the formula field key in /5 after the name of the 20 inch
>dimension. That is the slash '/' and the number 5.
> 4.4 Press the Enter key on the keyboard.
> 4.5 You now have defined the distance between the right end of the neck
>
>and the first fret through a formula. Notice that the line moves and the
>dimension changes color. This is because the dimension is driven through a
>
>formula.
>5. Define the remaining dimensions that control the distance between the
>other frets as a function of the dimension you just defined.
> 5.1 Double click on one of the other dimensions.
> 5.2 Click on the right most fret dimension. This is the one you defined
>
>the formula for.
> 5.3 Press the Enter key on the keyboard. You just defined this dimension
>
>to be equal to the first dimension.
> 5.4 Repeat the steps for the remaining dimensions. Notice that there is
>
>not a dimension to the right most vertical line.
>6. Change the length dimension of the neck. Click on the length dimension
>
>and use the mouse wheel to change the value of the dimension. Or you can
>just key in the length. As the length changes the distances between the
>frets will also change.
>
>Have fun!
>Rick B.
>
>
>

# Re: Array of formula driven variables

N/A
Cedric,
You can do what you are asking for. I provided the example as a simple
example. You may define your own formulas in Variale table. Click on Tools
and then Variables. you may define your formulas here. Then you may define
your dimensions being equal to a formula defined in variable table. See the
attached image.

# Re: Array of formula driven variables

N/A

Hi Ricky.
I'll investigate this tonight.
Cheers,
Cedric.
"Ricky Black" wrote:
>Cedric,
>You can do what you are asking for. I provided the example as a simple
>example. You may define your own formulas in Variale table. Click on Tools
>
>and then Variables. you may define your formulas here. Then you may define
>
>your dimensions being equal to a formula defined in variable table. See the
>
>attached image.
>
>
>

# Re: Array of formula driven variables

N/A

Hi Rick.
I had a quick look at the Varaible table yesterday night.
First thing : the window looks a bit different from yours. I guess you took a screenshot
of a newer version of SE.
Second : Your example shows me how to define a formula using other defined variables.
What I would like to do is define a function, i.e. an expression of generic variables.
Using your example, I would like to define Add as "Add(x,y) = x + y" and then define
MyDimension as "Add(A,B)". So that later I could define MyDimension2 as Add(C,D)
for example.
In my case, I would define the function NutToFret as "NutToFret(n) = 1 - 1/(b^n)"
(where b is a known constant).
Then I could define X1 as NutToFret(1), X2 as NutToFret(2),...
i.e generically : Xn as NutToFret(n).
Is the only way of defining such a function to use a Visual Basic function?
Thanks Ricky.
Regards.

"Ricky Black" wrote:
>Cedric,
>You can do what you are asking for. I provided the example as a simple
>example. You may define your own formulas in Variale table. Click on Tools
>
>and then Variables. you may define your formulas here. Then you may define
>
>your dimensions being equal to a formula defined in variable table. See the
>
>attached image.
>
>
>