AC crashes
Anonymous
Not applicable
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2011-08-24
05:11 PM
- last edited on
‎2023-08-03
09:41 AM
by
Doreena Deng
‎2011-08-24
05:11 PM
Hello,
Im trying to develop something, and first of all need to access floor id.
I tried this code:
What am I doing wrong?
Is there another way to access this kind of information? (story information)
Thanks a lot!
Im trying to develop something, and first of all need to access floor id.
I tried this code:
API_WorkspaceInfo workspaceInfo; API_StoryInfo storyInfo; API_ProjectInfo projectInfo; GSErrCode err; Int32 ind; err = ACAPI_Environment (APIEnv_ProjectID, &projectInfo, NULL); err = ACAPI_Environment (APIEnv_UserWorkspaceID, &workspaceInfo, &projectInfo.userId); BNZeroMemory (&storyInfo, sizeof (API_StoryInfo)); ACAPI_Environment (APIEnv_GetStorySettingsID, &storyInfo, NULL); ind = (*workspaceInfo.stories); //ACAPI_WriteReport("", ); ACAPI_WriteReport( " "+(*storyInfo.data)[storyInfo.firstStory].floorId, true);When I run the built add-on, through AC, the program crushes (bug report).
What am I doing wrong?
Is there another way to access this kind of information? (story information)
Thanks a lot!
Labels:
- Labels:
-
Add-On (C++)
6 REPLIES 6
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2011-08-27 04:47 PM
‎2011-08-27
04:47 PM
zanzibar wrote:I've answered your question about retrieving storey information in another post. Just a few comments about your code:
Hello,
Im trying to develop something, and first of all need to access floor id.
I tried this code: ...etc... When I run the built add-on, through AC, the program crushes (bug report).
Is there another way to access this kind of information? (story information)
- 1. You should
alwayszero out all structures before using them with API functions. You did this for storeyInfo, but not projectInfoor workspaceInfo.
2. You aren't checking the error code returned by these function calls. If any of them fail, you should not expect the returned values to be valid or meaningful.
3. What are you expecting the addition operator to do in the first parameter passed to ACAPI_WriteReport? Do you realise that the expression " " is a const char*, i.e. a pointer, and that adding an integer will result in a pointer to a non-specific memory address?
4. Where did the variableicome from (line 10)? Is this a sensible subscript value?
5. Don't forget to release any memory allocated by these functions, e.g. the storey array returned byAPIEnv_GetStorySettingsID. Otherwise, you will suffer serious memory leaks.
Ralph Wessel BArch
Central Innovation
Central Innovation
Anonymous
Not applicable
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2011-08-27 04:54 PM
‎2011-08-27
04:54 PM
Well, I guess that its because im not used to this platform.
I actually used the BNZeroMemory function because I saw that the example scripts use it, and I even tried to understand what it means, but it didnt work well. do u have any idea how to explain me that in a simpler way?
And I didnt really catch what u meant in par 4.
Thanks for ur attention!
I actually used the BNZeroMemory function because I saw that the example scripts use it, and I even tried to understand what it means, but it didnt work well. do u have any idea how to explain me that in a simpler way?
And I didnt really catch what u meant in par 4.
Thanks for ur attention!
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2011-08-27 05:20 PM
‎2011-08-27
05:20 PM
zanzibar wrote:I think you need to take a course in C/C++ (or study the subject). A C programmer would not expect to be able to write:
Well, I guess that its because im not used to this platform.
I actually used the BNZeroMemory function because I saw that the example scripts use it, and I even tried to understand what it means, but it didnt work well. do u have any idea how to explain me that in a simpler way?
And I didnt really catch what u meant in par 4.
Thanks for ur attention!
"1 + 1 = " + 2;That's something you might do with BASIC.
Similarly,
My 4th point was referring to the following line:
ind = (*workspaceInfo.stories);Where does the subscript value
Ralph Wessel BArch
Central Innovation
Central Innovation
Anonymous
Not applicable
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2011-08-27 07:40 PM
‎2011-08-27
07:40 PM
The "i" value comes from a loop that runs this function for each floor, I assumed that 0,1,2 and so on are floor indexes.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2011-08-28 10:21 AM
‎2011-08-28
10:21 AM
zanzibar wrote:I assumed so, but it would have been very helpful if you had left the loop in your sample code. Loops and subscript variables are common sources of hanging/crashing problems. I'm also assuming your loop begins just after the call to
The "i" value comes from a loop that runs this function for each floor, I assumed that 0,1,2 and so on are floor indexes.
Ralph Wessel BArch
Central Innovation
Central Innovation
Anonymous
Not applicable
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2011-08-28 03:02 PM
‎2011-08-28
03:02 PM
Well, youv'e helped me a lot, thx!!!
