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

Is it possible to add a parameter with jlink that uses an External File for Restricted Parameters?

SOLVED
ssuttle
Regular Member

Is it possible to add a parameter with jlink that uses an External File for Restricted Parameters?

We have added a pulldown using the external file for adding restricted parameters. I want to be able to add this to existing CREO files with jlink. Does anyone know if this is possible? I have tried just adding the parameter like you would a regular one and that does not seem to work. On Creo 3.0 M110. Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Is it possible to add a parameter with jlink that uses an External File for Restricted Parameters?

Yes, this is possible. My res. parameters file (RPF):

restricted_param.lst

RES_PARAMS = {

    {

    Name = model_color

    Type = string

    Default = 'blue'

    Enum = { 'blue', 'red', 'green' }

    }

}


The code to add parameter to model (part, or assembly):

Solid model = (Solid) session.GetCurrentModel();

ParamValue pv = pfcModelItem.CreateStringParamValue("blue");

model.CreateParam("model_color", pv);


If your RPF values will change often you can read this file before creating parameter and then create parameter with correct values.



View solution in original post

4 REPLIES 4

Re: Is it possible to add a parameter with jlink that uses an External File for Restricted Parameters?

I don't know this for a fact but I suspect it is not possible. Only the toolkit API can be used to modify the access level for a parameter. You can read more about this in the following PTC article (CS39947).

https://support.ptc.com/appserver/cs/view/solution.jsp?n=CS39947&art_lang=en&posno=1&q=toolkit%20par...

Mike

Re: Is it possible to add a parameter with jlink that uses an External File for Restricted Parameters?

Mike,

     I am not trying to modify it. I am trying to create the paramter. If it is not there I can go in an manually create it but I have not been able to create It via JLink.

Re: Is it possible to add a parameter with jlink that uses an External File for Restricted Parameters?

Yes, this is possible. My res. parameters file (RPF):

restricted_param.lst

RES_PARAMS = {

    {

    Name = model_color

    Type = string

    Default = 'blue'

    Enum = { 'blue', 'red', 'green' }

    }

}


The code to add parameter to model (part, or assembly):

Solid model = (Solid) session.GetCurrentModel();

ParamValue pv = pfcModelItem.CreateStringParamValue("blue");

model.CreateParam("model_color", pv);


If your RPF values will change often you can read this file before creating parameter and then create parameter with correct values.



View solution in original post

Re: Is it possible to add a parameter with jlink that uses an External File for Restricted Parameters?

Thanks Skvarka, that worked perfectly. I think I might not have been setting the string value correctly so it was failing. Regardless, your answer works. Thanks again.

Announcements