cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

How to change parameter type via J-link?

SOLVED
Highlighted
Level 1

How to change parameter type via J-link?

Hi,

I'm trying to set parameter value of assembly via J-link class.

We are using Wildfire 5.1.

I'm trying to set value of parameter PRO_MP_ALT_AREA under Alternate Mass Properties.

Session session = pfcGlobal.GetProESession ();

Model model = session.GetCurrentModel();

Parameter param = model.GetParam("PRO_MP_ALT_AREA");

double myValue = 1.0;

param.SetValue(pfcModelItem.CreateDoubleParamValue(myValue));

But all I get is XBadGetParamValue Exception.

(not be confused with it’s name, this Exception is thrown from set method too)

It seems that ParamValueType is PARAM_NOT_SET (Unknown in table below) and that causes the problem.

But how can i change it to PARAM_DOUBLE??? I’ve found no set method in API.

params.png

What am I doing wrong?

Any help will be appreciated.

Tags (1)
1 ACCEPTED SOLUTION

Accepted Solutions

Re: How to change parameter type via J-link?

Using of Relations did the trick.


stringseq relations = model.GetRelations();

int relationRow = relations.getarraysize();

relations.set(relationRow, "PRO_MP_ALT_AREA = 0");

model.SetRelations(relations);

model.RegenerateRelations();

relations.removerange(relationRow, relationRow + 1);

model.SetRelations(relations);

3 REPLIES 3

Re: How to change parameter type via J-link?

The type of a parameter cannot be changed. You can capture the value of an existing parameter, delete the parameter and create a new parameter of the same name with the type you want.

You will have to repair any places the previous parameter was used.

Alternatively, you can create a new parameter of the desired type with a new name; correct any places the old parameter was used to use the new parameter, then delete the old parameter and rename the new parameter to the name the old parameter had used.

I think your problem is that these parameters are set only by xtop.exe; they may not be accessible by outside software.

Re: How to change parameter type via J-link?

Thanks for your reply.

It looks like that "real" type of PRO_MP_ALT_AREA is double. With double i'll be pretty happy. When I enter any value manualy--there is desired type--PARAM_DOUBLE. Manual entering of String or Integer is not allowed or possible.

At this moment (with some value), parameter is accessible even with my class. Standard Set methods are working. But I'd like to make it automatic. I can not prompt user to activate parameter maualy.

Deleting of PRO_MP_ALT_AREA parameter (to be replaced by newly created) is not possible too. Working with main set (not PRO_MP or PRO_MP_ALT) of parameters looks easier.

I'd like to stick with PRO_MP_ALT because these parameters are unique for instances of family. In case of using standard main parameter it will be the same for all instances unless i make it table driven which is terrible idea.

1. So is there really no way how to assign value to Alternate Mass Properties set automatically?

2. Or is there any different way how to set this value? LST file or something? I have start part on my mind but I want to work with and fix legacy parts too...

Thanks for advices.

Re: How to change parameter type via J-link?

Using of Relations did the trick.


stringseq relations = model.GetRelations();

int relationRow = relations.getarraysize();

relations.set(relationRow, "PRO_MP_ALT_AREA = 0");

model.SetRelations(relations);

model.RegenerateRelations();

relations.removerange(relationRow, relationRow + 1);

model.SetRelations(relations);