Cancel
Showing results for 
Search instead for 
Did you mean: 

Using Variables to Define Properties

Creator
Creator

As I've been using FEMAP, I often come across instances where I want to run different analyses, changing just one value (for instance, modifying the radius of a circular rod beam element).  

 

The way I've currently been doing this is running the analysis, editing the value, and then running it again.  I figured there had to be a better way, so I started digging into API programming.  Currently, I've managed to creat a loop that changes a FEMAP Variable (Tools>Variables) and then runs the analysis.  

 

The issue I'm having is associating the FEMAP variable with the property I want to change.  I'm able to assign the property a variable by putting "![VARNAME]" in the property field, and that works fine.  However, it just takes the current value of that variable, and doesn't actually take the reference.  For example, say the variable !RAD = 1.  If I put '!RAD' in the radius box for a circular bar, when I hit OK and go back in, the box has changed to '1'.  Then, if I change the value !RAD to 2, the circular bar radius doesn't update.

 

Does anyone know how to get this to work?  Let me know if what I'm trying to do isn't clear enough.

 

Another option would be to programmatically change this value, but I wanted to keep it as simple as changing a single variable so that I could just copy/paste the code between projects without making numerous changes.

2 REPLIES

Re: Using Variables to Define Properties

Phenom
Phenom
If you have started using the API (not the "Program File" I assume), then perhaps you should extend your API to directly modify the Property Object's properties. For this, you will want to refer to Section 5.48 and the example in 5.48.2 of the API pdf. So, for a beam element, you might be updating Property Array Index 40 in order to change a standard section radius. However, note that the API example shows you how to get and set (and "put" = save) the property array values... so use an unusual property value and a message (feAppMessage) or a "Watch" in the API programming window (or simply check the property itself manually to start with) if you have any doubt as to whether you are accessing and updating the correct Property Array Index for the property you wish to update.

Re: Using Variables to Define Properties

Creator
Creator

Thanks for the reply.  I was hoping to find a "one size fits all" solution, instead of having to create a new api every time I wanted to perform an analysis like this (granted, a lot of the code would be able to carry over).  It looks like it's not possible to do it the way that I was hoping to.  It seems like it would be a great feature to add to FEMAP.  I also use Thermal Desktop, and variables are great with that.