We value your input!
Please participate in Archicad 28 Home Screen and Tooltips/Quick Tutorials survey

Archicad C++ API
About Archicad add-on development using the C++ API.
SOLVED!

Why this code cannot change story name?

Newbie
Participant

With this snapshot of code:

 

 

API_StoryCmdType storyCmd;
storyCmd.action = APIStory_Rename;
storyCmd.index = storyInfo.lastStory;
storyCmd.uName[storyInfo.lastStory] = GS::uchar_t("TAS");
GSErrCode err = ACAPI_Environment(APIEnv_ChangeStorySettingsID, &storyCmd); 

 

 

I wonder why it did not change the story name without any error.

Please advise.

 

1 ACCEPTED SOLUTION

Accepted Solutions
Solution
Viktor Kovacs
Graphisoft
Graphisoft

Not sure what is your intention with this line:

storyCmd.uName[storyInfo.lastStory] = GS::uchar_t("TAS");

This code modifies one character in the name at the index of lastStory. That character will probably be a "T" since you convert a string to one character. Probably you would like to write something like this:

GS::UniString newName = "TAS";
GS::ucscpy (storyCmd.uName, newName.ToUStr ());

 

View solution in original post

1 REPLY 1
Solution
Viktor Kovacs
Graphisoft
Graphisoft

Not sure what is your intention with this line:

storyCmd.uName[storyInfo.lastStory] = GS::uchar_t("TAS");

This code modifies one character in the name at the index of lastStory. That character will probably be a "T" since you convert a string to one character. Probably you would like to write something like this:

GS::UniString newName = "TAS";
GS::ucscpy (storyCmd.uName, newName.ToUStr ());