Need help on ACAPI_LibPart_UpdateSection
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2010-11-18
01:36 AM
- last edited on
2024-09-09
10:55 AM
by
Doreena Deng
2010-11-18
01:36 AM
Hi,
I am trying to change the subtype of a library part using the ACAPI_LibPart_UpdateSection function as the following code segment:
// ----------------------------------------------------------------
char buffer[1000];
API_LibPartSection section;
GSHandle sectionHdl;
BNZeroMemory (§ion, sizeof (API_LibPartSection));
section.sectType = API_SectAncestors;
sectionHdl = NULL;
// ModelElemID definded as:
// #define ModelElemID "{103E8D2C-8230-42E1-9597-46F84CCE28C0}-{00000000-0000-0000-0000-000000000000}"
strcpy_s (buffer, sizeof (buffer), ModelElemID);
sectionHdl = BMAllocateHandle (strlen(buffer), ALLOCATE_CLEAR, 0);
if (sectionHdl != NULL) {
memcpy (*sectionHdl, buffer, strlen(buffer));
err = ACAPI_LibPart_UpdateSection (libPart.index, §ion, sectionHdl, NULL);
if (err) {
WriteReport_Err (err, "[Do_UpdateLibraryPart]Error in ACAPI_LibPart_UpdateSection, API_SectAncestors, libPart.index = %d", libPart.index);
}
BMKillHandle ((GSHandle*) §ionHdl);
}
// ----------------------------------------------------------------
It does not seem to work. The updated object has the subtype shown as unknown subtype. I have updated other sections of the libpart such as API_Sect1DScript, API_Sect2DScript... ok.
Please help. Thanks in advance.
Regards,
Hoa TU
PS. This is developed for ArchiCAD 12
I am trying to change the subtype of a library part using the ACAPI_LibPart_UpdateSection function as the following code segment:
// ----------------------------------------------------------------
char buffer[1000];
API_LibPartSection section;
GSHandle sectionHdl;
BNZeroMemory (§ion, sizeof (API_LibPartSection));
section.sectType = API_SectAncestors;
sectionHdl = NULL;
// ModelElemID definded as:
// #define ModelElemID "{103E8D2C-8230-42E1-9597-46F84CCE28C0}-{00000000-0000-0000-0000-000000000000}"
strcpy_s (buffer, sizeof (buffer), ModelElemID);
sectionHdl = BMAllocateHandle (strlen(buffer), ALLOCATE_CLEAR, 0);
if (sectionHdl != NULL) {
memcpy (*sectionHdl, buffer, strlen(buffer));
err = ACAPI_LibPart_UpdateSection (libPart.index, §ion, sectionHdl, NULL);
if (err) {
WriteReport_Err (err, "[Do_UpdateLibraryPart]Error in ACAPI_LibPart_UpdateSection, API_SectAncestors, libPart.index = %d", libPart.index);
}
BMKillHandle ((GSHandle*) §ionHdl);
}
// ----------------------------------------------------------------
It does not seem to work. The updated object has the subtype shown as unknown subtype. I have updated other sections of the libpart such as API_Sect1DScript, API_Sect2DScript... ok.
Please help. Thanks in advance.
Regards,
Hoa TU
PS. This is developed for ArchiCAD 12
5 REPLIES 5
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2010-11-18 01:33 PM
2010-11-18
01:33 PM
Hoa wrote:Have you tried using
I am trying to change the subtype of a library part using the ACAPI_LibPart_UpdateSection function as the following code segment:
Ralph Wessel BArch
Central Innovation
Central Innovation
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2010-11-19 12:47 AM
2010-11-19
12:47 AM
Have you tried using APIEnv_OverwriteLibPartID and ACAPI_LibPart_Create to change the object?Ralph,
Thanks for your suggestion, but I can not use the ACAPI_LibPart_Create, because it will change the GUID of the object.
Regards,
Hoa
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2010-11-19 11:22 AM
2010-11-19
11:22 AM
Hoa wrote:Not if you use it with
Thanks for your suggestion, but I can not use the ACAPI_LibPart_Create, because it will change the GUID of the object.
Ralph Wessel BArch
Central Innovation
Central Innovation
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2010-11-21 11:29 PM
2010-11-21
11:29 PM
Ralph,
Thanks. I will have a close look at your suggestion and will let you know the outcome of it.
Regards,
Hoa
Thanks. I will have a close look at your suggestion and will let you know the outcome of it.
Regards,
Hoa
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2010-11-23 04:48 AM
2010-11-23
04:48 AM
I have tried using APIEnv_OverwriteLibPartID and ACAPI_LibPart_Create to change the subtype of the object. Well the result is interesting:
With ArchiCAD 12, the GUID of the object changed, so any object placed before the change will not be recognisable any more.
With ArchiCAD 14, the GUID of the object remained the same, so everything seems ok.
Since we are going to use AC14 soon, so I am not going to worry about the AC12 problem.
Thanks for your help.
Cheers,
Hoa
With ArchiCAD 12, the GUID of the object changed, so any object placed before the change will not be recognisable any more.
With ArchiCAD 14, the GUID of the object remained the same, so everything seems ok.
Since we are going to use AC14 soon, so I am not going to worry about the AC12 problem.
Thanks for your help.
Cheers,
Hoa