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

Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X

How to change parameter type via J-link?

Stanley
12-Amethyst

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.

ACCEPTED SOLUTION

Accepted Solutions
Stanley
12-Amethyst
(To:Stanley)

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);

View solution in original post

3 REPLIES 3
dschenken
21-Topaz I
(To:Stanley)

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.

Stanley
12-Amethyst
(To:dschenken)

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.

Stanley
12-Amethyst
(To:Stanley)

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);

Announcements


Top Tags