strcat

Hi !
I’ve a (probably stupid…?!) question, not so related to Anybody functions but rather language.

Schematically, I’ve 3 files in my model :

  • One to define “input variables” ; among other I write a global variable named “Mesures” :
    #define Mesure Me

  • the “AnyManExternal_customized”, little changed compared to “AnyManExternal” and in which I call the 3d file by an #include statement.

  • the 3d file named “MesuresMe.any” (so : #include “MesuresMe.any”).

What I would like is to automatically set the include statement to replace “Me” by the name I wrote in my define statement.
I tried smthg like #include strcat(“Mesure” + Mesure + “.any”) but it seems really wrong !

Would it be any way to do it ??

Thank you for your advices !
Lauranne

Hello Lauranne,

maybe you could get around this problem using a path statement:
for using the string in the include, you define a path and use this in the include instead, e.g.


#define MEASURE Me
#path MEASUREFILE "Mesure" + MEASURE + ".any"
#include "<MEASUREFILE>"

Hope that works in your case.

Best regards
Daniel

Hello Daniel,
Thank you for the tips ; however it doesn’t work ; here is the error :
ERROR(SCR.SCN6) : D:/S…e/4…y/1…s/P…y/A…n/V…n/C…l/S…g/AnyManExternalUpperBody.any(11) : ‘Me’ : Unexpected character.

It seems unable to concatenate the whole string… Would you have any idea about the problem ?

Thank you !
Lauranne

Oh, I think that is kind of a stupid mistake. Please try

#define MEASURE "Me"

instead. Sorry for that.

Daniel

So great !
Thank you !!
Lauranne

So great ! Works like a charm !
Thank you !!
Lauranne