Start a topic
With the exception of Windchill, The PTC Community is on read-only status until April 6 in preparation for moving our community to a new platform. Learn more here
cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

The PTC Community is on temporary read only status in preparation for moving our community to a new platform. Learn more here

Translate the entire conversation x

Pb pour affecter une valeur de cote à un paramètre chaine (string)

CS_4559659
2-Explorer

Pb pour affecter une valeur de cote à un paramètre chaine (string)

  • Bonjour,

Je viens de passer sur CREO 12, j'étais auparavant sur CREO 3.0.

Sur CREO 3.0, il met arrivé de créer un paramètre de type chaîne (string) ( par exemple A) et, via une boucle if() dans les relations, lui affecter tantôt le caractère - ou une valeur de cote (exemple : d123) ce qui pouvait donner par exemple ceci :

 

if(p120==1)

A="-"

else

If(p120==2)

A=d123

endif

endif

 

p120 pouvait, par exemple représenter un nombre de répétition d'un trou et d123 l'entraxe entre 2 trous si le nombre de répétition p120 est supérieur à 1. Ainsi, dans une table de famille, et donc dans la région de répétition correspondante sur une mise en plan, pour une instance de table de famille avec 1 trou le paramètre A affichait - et pour une instance de table de famille avec 2 trous le paramètre A affichait la valeur de la côte d123.

et cela fonctionnait sans problème, mais depuis que je suis passé sur CREO 12, cela ne fonctionne plus !

Ma syntaxe dans les relations est elle toujours bonne ?

Existe-t-il une autre manière d'afficher dans une table de répétition soit -, soit une valeur de cote en fonction du nombre de trous ?

Merci d'avance à ceux qui essaierons de comprendre mon pb.

CS

ACCEPTED SOLUTION

Accepted Solutions

It appears you are assigning an integer value to a parameter that you initially defined as a String. Creo will do this, but it has been documented in the past that doing so causes the parameter ("A" for you) to be changed to an integer parameter. As far as I have seen, the program doesn't flag an error it just does this.

 

Perhaps it would work better if you used something like

IF ( P120 < 2 )
  A = "-"
ELSE
  A = ITOS ( P120 )
ENDIF

View solution in original post

2 REPLIES 2

It appears you are assigning an integer value to a parameter that you initially defined as a String. Creo will do this, but it has been documented in the past that doing so causes the parameter ("A" for you) to be changed to an integer parameter. As far as I have seen, the program doesn't flag an error it just does this.

 

Perhaps it would work better if you used something like

IF ( P120 < 2 )
  A = "-"
ELSE
  A = ITOS ( P120 )
ENDIF

Bonjour KenFarley,

Merci beaucoup, avec la fonction ITOS() ou RTOS() cela refonctionne correctement.

Cordialement,

CS.

Announcements


NEW Creo+ Topics: Real-time Collaboration

Top Tags