logo
NOTICE:  This is the new PunchCAD forum. You should have received an email with your new password around August 27, 2014. If you did not, or would like it reset, simply use the Lost Password feature, and enter Answer as the security answer.
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
eHam  
#1 Posted : Thursday, October 30, 2008 7:27:51 PM(UTC)
eHam

Rank: Junior Member

Joined: 11/20/2007(UTC)
Posts: 17

The description of the expression parser indicates a value can be a param. Further, a param is defined as an alpha with an optional integer (e.g. A, b2, etc.).

I use the expression parser quite a bit and I was hoping that param might offer a way to access data from an existing object (length, diameter, etc.). As far as I can see, not so.

Absent any example of using a param in an expression, I can't figure out what param really evaluates to. If, for instance, you enter A1 in a data entry field, V6 returns an error message.
Tim Olson  
#2 Posted : Friday, October 31, 2008 9:10:32 AM(UTC)
Tim Olson

Rank: Senior Member

Joined: 2/2/2007(UTC)
Posts: 5,447
United States

Was thanked: 499 time(s) in 353 post(s)
>>way to access data from an existing object (length, diameter, etc.).

Unfortunately no. I've been looking for a way to tie attributes to the constraint variables (like height of an extrusion).

>>I can't figure out what param really evaluates to.

Perhaps below will help.


There is also a param, const, and macro interface. In any numeric input field you can enter a new definition as follows:

@param=expression
This format creates a param value. The value of param is evaluated at the time it is created. It will not change value until a replacement is entered.

@const=#expression
This format creates a const value. The value of const is evaluated at the time it is created. Once created, a const cannot be replaced (unless you hand edit the prefs\UserMacros.ini file).

@macro=@expression
This format creates a macro value. The value of macro is evaluated each time it is referenced. Hence, its value can change over time as any param or const values are updated.

For example, in an input field enter:

@a=5// param a has the value 5.0
@B=#a*2// const B has the const value of 10.0
@M=@rnd(a)// macro M will be a random number between 0 and a

You can use a, B, or M anywhere the expression syntax allows a value!

So for a line's length you could now enter M+5 and the line's length would end up being some value between 5 and 10 (=5+a). If you then re-entered @a=10, and then entered M+5 as the line's length again, it would end up being some value between 5 and 15 (=5+a).
Tim Olson
IMSI Design/Encore
eHam  
#3 Posted : Friday, October 31, 2008 9:12:01 PM(UTC)
eHam

Rank: Junior Member

Joined: 11/20/2007(UTC)
Posts: 17

Tim,

Thanks. The info will come in handy. Its a lot easier to remember (and enter) A1 instead of .066623

Eradley ham
eHam  
#4 Posted : Friday, October 31, 2008 9:16:39 PM(UTC)
eHam

Rank: Junior Member

Joined: 11/20/2007(UTC)
Posts: 17

Tim,
Thank you. The information will be very handy. Its easier to remember (and enter) A1 than .06662 for instance.

E. Ham
Tim Olson  
#5 Posted : Saturday, November 1, 2008 2:56:51 PM(UTC)
Tim Olson

Rank: Senior Member

Joined: 2/2/2007(UTC)
Posts: 5,447
United States

Was thanked: 499 time(s) in 353 post(s)
Yes. Once you define a constant, it will be remebered as it is stored in an ini file for later launches.

Tim
Tim Olson
IMSI Design/Encore
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.