Welcome to MCAD Central

Join our MCAD Central community forums, the largest resource for MCAD (Mechanical Computer-Aided Design) professionals, including files, forums, jobs, articles, calendar, and more.

Register Log in

Changing the Parameter Type (i.e. string to real number)

G

Guest

Guest
Method 1:

Using the Model Tree: Create a column in your model tree under model parameters the same name as the parameter you want to change (this is a good way to enter values too). It should display the value of the parameter. Click on it and use 'backspace' to clear the field. Don't hit enter, just arrow (or pick) to a different field. If you pick on the (now empty) field of the parameter you just erased, it should give you a pop up to choose string, integer, etc. and you're off! I've seen it take more than once to get the field clear, so if it doesn't take the first time, give it another shot.



Method 2:

Using Pro/PROGRAM: Open the Pro/Program file. In the input section, modify the parameter type. For instance, if you have a parameter called HEIGHT that is an integer and you want to change it to a string variable, Pro/Program code will look like the following:



INPUT

TEST STRING

END INPUT
 

Dave Hebel

New member
string_parameter="" + fam_inst_param_value /*to convert fam_inst_param_value to a string parameter

string_parameter_length=string_length(string_parameter) /*overall string_parameter string length

num_of_characters=string_length(string_parameter)

multiplier=1 /*sets default multiplier to 1
actual_value=0 /*sets default actual value to 0

/* Start - convert a 3 letter string into a real number

if num_of_characters>=3
multiplier=multiplier*1 /*change to *10 if more than 3 characters

if extract(string_parameter,3,1)=="1"
character3=1*multiplier
endif

if extract(string_parameter,3,1)=="2"
character3=2*multiplier
endif

if extract(string_parameter,3,1)=="3"
character3=3*multiplier
endif

if extract(string_parameter,3,1)=="4"
character3=4*multiplier
endif

if extract(string_parameter,3,1)=="5"
character3=5*multiplier
endif

if extract(string_parameter,3,1)=="6"
character3=6*multiplier
endif

if extract(string_parameter,3,1)=="7"
character3=7*multiplier
endif

if extract(string_parameter,3,1)=="8"
character3=8*multiplier
endif

if extract(string_parameter,3,1)=="9"
character3=9*multiplier
endif

if extract(string_parameter,3,1)=="0"
character3=0*multiplier
endif

actual_value=character3
endif

if num_of_characters>=2

multiplier=multiplier*10 /*change to *10 if more than 3 characters

if extract(string_parameter,2,1)=="1"
character2=1*multiplier
endif

if extract(string_parameter,2,1)=="2"
character21=2*multiplier
endif

if extract(string_parameter,2,1)=="3"
character2=3*multiplier
endif

if extract(string_parameter,2,1)=="4"
character2=4*multiplier
endif

if extract(string_parameter,2,1)=="5"
character2=5*multiplier
endif

if extract(string_parameter,2,1)=="6"
character2=6*multiplier
endif

if extract(string_parameter,2,1)=="7"
character2=7*multiplier
endif

if extract(string_parameter,2,1)=="8"
character2=8*multiplier
endif

if extract(string_parameter,2,1)=="9"
character2=9*multiplier
endif

if extract(string_parameter,2,1)=="0"
character2=multiplier
endif

actual_value=actual_value+character2

endif

if num_of_characters==1 /*if characters = 1, don't change multiplier

multiplier=multiplier

else

multiplier=multiplier*10

endif

if num_of_characters>=1

if extract(string_parameter,1,1)=="1"
character1=1*multiplier
endif

if extract(string_parameter,1,1)=="2"
character1=2*multiplier
endif

if extract(string_parameter,1,1)=="3"
character1=3*multiplier
endif

if extract(string_parameter,1,1)=="4"
character1=4*multiplier
endif

if extract(string_parameter,1,1)=="5"
character1=5*multiplier
endif

if extract(string_parameter,1,1)=="6"
character1=6*multiplier
endif

if extract(string_parameter,1,1)=="7"
character1=7*multiplier
endif

if extract(string_parameter,1,1)=="8"
character1=8*multiplier
endif

if extract(string_parameter,1,1)=="9"
character1=9*multiplier
endif

actual_value=actual_value+character1

endif

/* End - convert a 3 letter string into a real number
 

Sponsor

Top