cancel
Showing results for 
Search instead for 
Did you mean: 
EN
cancel
Showing results for 
Search instead for 
Did you mean: 
Newbie
Participant

Why null char[] checking not working?

I am try to put a condition checking for empty value of char[] as below code but still not working.

 
GS::Array<API_NavigatorItem> items;
API_NavigatorItem item = {};
char str[128];
memset(str, '\0', sizeof(str));
item.guid = guid;
item.mapId = mapId; //NavigatorPaletteTestGlobals::GetInstance().GetNavigatorMapID();
GSErrCode err = ACAPI_Navigator(APINavigator_GetNavigatorChildrenItemsID, &item, nullptr, &items);
if (err != NoError)
return;
for (API_NavigatorItem& childItem : items) {
if (GS::UniString(childItem.uiId).ToCStr().Get() != NULL) {
ACAPI_WriteReport("Value >>%s<>%s =>%i", true, GS::UniString(childItem.uiId).ToCStr().Get(), GS::UniString(str).ToCStr().Get(),childItem.isIndependent);
}
}
 
Appreciated for any help to fix this issue.
 
 
1 Solution

Accepted Solutions

OK now I think I've understood. And I've tested it a bit.
It seems that you can't delete items which are part of a cloned folder as you've found out.
The cloned folders have itemType = API_UndefinedNavItem.

So you could check if an items parent has this item type.

To get an items parent you can use APINavigator_GetNavigatorParentItemID.

Hope that helps!

Automating Archicad with Add-Ons, GDL-Objects & Python Archi-XT.com

Go to post

6 Replies 6

I think this condition

 

GS::UniString(childItem.uiId).ToCStr().Get() != NULL

 

will never be true, since you are creating an UniString object right there and this will have a pointer existing.

 

It's a bit unclear what exactly you want to achieve.

Maybe you need this?

 

!GS::UniString(childItem.uiId).IsEmpty()

 

 

Automating Archicad with Add-Ons, GDL-Objects & Python Archi-XT.com
Newbie
Participant

Hello bschwb,

 

Actually I want to list the viewmap of navigator and check whether the item can be deleted or not as below picture but still can't find our the way.

Not sure you have any suggestion or not.

 

Thanks in advance.

 


Snap-2023-07-10-14-54-23.png

Which ones in the picture do you want to delete?

Automating Archicad with Add-Ons, GDL-Objects & Python Archi-XT.com
Newbie
Participant

Hello bschwb,

 

From the given picture, if you select 'Floor Plans' then you can delete, but it's sub items such as story 1 you can't delete. I still can't find way to check whether the selected item can or can not delete from API function.

 

Thanks.

 

OK now I think I've understood. And I've tested it a bit.
It seems that you can't delete items which are part of a cloned folder as you've found out.
The cloned folders have itemType = API_UndefinedNavItem.

So you could check if an items parent has this item type.

To get an items parent you can use APINavigator_GetNavigatorParentItemID.

Hope that helps!

Automating Archicad with Add-Ons, GDL-Objects & Python Archi-XT.com
Newbie
Participant

Hello bschwb,

 

You're right, It does what I am looking.

 

Thanks for suggestion.

 

Didn't find the answer?

Check other topics in this Forum

Back to Forum

Read the latest accepted solutions!

Accepted Solutions

Start a new conversation!