<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to add a worksheet and a view into a folder in ArchiCAD API? in Archicad C++ API</title>
    <link>https://community.graphisoft.com/t5/Archicad-C-API/How-to-add-a-worksheet-and-a-view-into-a-folder-in-ArchiCAD-API/m-p/575365#M8885</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.graphisoft.com/t5/user/viewprofilepage/user-id/8527"&gt;@BerndSchwarzenbacher&lt;/a&gt;, Can you help me with this question, please?&lt;/P&gt;</description>
    <pubDate>Tue, 14 Nov 2023 03:59:55 GMT</pubDate>
    <dc:creator>Tran Thanh Lo</dc:creator>
    <dc:date>2023-11-14T03:59:55Z</dc:date>
    <item>
      <title>How to add a worksheet and a view into a folder in ArchiCAD API?</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/How-to-add-a-worksheet-and-a-view-into-a-folder-in-ArchiCAD-API/m-p/575127#M8880</link>
      <description>&lt;P&gt;Hi guys,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can you help me with this?&lt;/P&gt;
&lt;P&gt;I created a worksheet like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV&gt;&lt;LI-CODE lang="cpp"&gt;// Create WorkSheet
API_DatabaseInfo dbInfo = {};
dbInfo.typeID = APIWind_WorksheetID;
GS::snuprintf(dbInfo.name, sizeof(dbInfo.name), viewName.ToUStr().Get());
//GS::snuprintf(dbInfo.ref, sizeof(dbInfo.ref), "W01");
ACAPI_Database(APIDb_NewDatabaseID, &amp;amp;dbInfo);

And also tried to create a view and a folder like this:

//Create Folder
API_NavigatorItem folderItem;
BNZeroMemory(&amp;amp;folderItem, sizeof(API_NavigatorItem));

folderItem.itemType = API_FolderNavItem;
folderItem.mapId = API_PublicViewMap;

GS::ucscpy(folderItem.uName, viewName.ToUStr());

ACAPI_Navigator(APINavigator_NewNavigatorViewID, &amp;amp;folderItem, NULL, NULL);

GS::Guid parentAndChild[2];
parentAndChild[0] = APIGuid2GSGuid(folderItem.guid);// Folder guid
parentAndChild[1] = APIGuid2GSGuid(APINULLGuid);


API_NavigatorItem saveItem;
BNZeroMemory(&amp;amp;saveItem, sizeof(API_NavigatorItem));

saveItem.itemType = API_StoryNavItem;
saveItem.mapId = API_PublicViewMap;
saveItem.floorNum = story.Id;


GS::ucscpy(saveItem.uName, viewName.ToUStr());

saveItem.customName = true;
API_NavigatorView saveView;
BNZeroMemory(&amp;amp;saveView, sizeof(API_NavigatorView));
ACAPI_Navigator(APINavigator_NewNavigatorViewID, &amp;amp;saveItem, &amp;amp;saveView, parentAndChild);//saveItem

&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now I want to create a view from the worksheet above, then I want to add the view from the worksheet and a newly created view to a newly created folder as above.&lt;/P&gt;
&lt;P&gt;Can you give me advice? thank you very much&lt;/P&gt;
&lt;/DIV&gt;</description>
      <pubDate>Mon, 16 Sep 2024 12:39:57 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/How-to-add-a-worksheet-and-a-view-into-a-folder-in-ArchiCAD-API/m-p/575127#M8880</guid>
      <dc:creator>Tran Thanh Lo</dc:creator>
      <dc:date>2024-09-16T12:39:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to add a worksheet and a view into a folder in ArchiCAD API?</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/How-to-add-a-worksheet-and-a-view-into-a-folder-in-ArchiCAD-API/m-p/575365#M8885</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.graphisoft.com/t5/user/viewprofilepage/user-id/8527"&gt;@BerndSchwarzenbacher&lt;/a&gt;, Can you help me with this question, please?&lt;/P&gt;</description>
      <pubDate>Tue, 14 Nov 2023 03:59:55 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/How-to-add-a-worksheet-and-a-view-into-a-folder-in-ArchiCAD-API/m-p/575365#M8885</guid>
      <dc:creator>Tran Thanh Lo</dc:creator>
      <dc:date>2023-11-14T03:59:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to add a worksheet and a view into a folder in ArchiCAD API?</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/How-to-add-a-worksheet-and-a-view-into-a-folder-in-ArchiCAD-API/m-p/577188#M8914</link>
      <description>&lt;P&gt;Hi Thanh,&lt;BR /&gt;&lt;BR /&gt;Your first two steps of creating the worksheet and the view folder are correct.&lt;BR /&gt;I think you provided wrong information for the &lt;STRONG&gt;APINavigator_NewNavigatorViewID&lt;/STRONG&gt; function. Namely the parentAndChild guid is provided incorrectly and also saveItem probably needs more information (specifically the guid of the navigator item). In general it's important to distinguish between the Database and a corresponding Navigator Item.&lt;BR /&gt;&lt;BR /&gt;Anyway I found it's easiest with the &lt;STRONG&gt;APINavigator_CloneProjectMapItemToViewMapID &lt;/STRONG&gt;function. To get the guid of the navigator item corresponding to the worksheet database, we use the search function. Note that the following example only works if the "test" worksheet is not yet created.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="cpp"&gt;// Create WorkSheet
API_DatabaseInfo dbInfo = {};
dbInfo.typeID = APIWind_WorksheetID;
GS::snuprintf (dbInfo.name, sizeof (dbInfo.name), "test");
GSErrCode err = ACAPI_Database (APIDb_NewDatabaseID, &amp;amp;dbInfo, nullptr, nullptr);

// Create Folder
API_NavigatorItem folderItem{};
folderItem.itemType = API_FolderNavItem;
folderItem.mapId = API_PublicViewMap;
GS::ucscpy (folderItem.uName, L"ViewFolderTestFolder");
err = ACAPI_Navigator (APINavigator_NewNavigatorViewID, &amp;amp;folderItem);

// Find Worksheet Navigator Item
GS::Array&amp;lt;API_NavigatorItem&amp;gt; results;
API_NavigatorItem search{};
search.mapId = API_ProjectMap;
search.itemType = API_WorksheetDrawingNavItem;
search.db = dbInfo;

err = ACAPI_Navigator (APINavigator_SearchNavigatorItemID, &amp;amp;search, nullptr, &amp;amp;results);
if (results.GetSize () != 1) {
	ACAPI_WriteReport ("Size: %d", true, results.GetSize ());
	return;
}

// Clone Worksheet to View Map
API_Guid viewGuid;
err = ACAPI_Navigator (APINavigator_CloneProjectMapItemToViewMapID, &amp;amp;results[0].guid, &amp;amp;folderItem.guid, &amp;amp;viewGuid);
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;BR /&gt;Hope that helps,&lt;BR /&gt;Bernd&lt;/P&gt;</description>
      <pubDate>Thu, 23 Nov 2023 21:23:40 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/How-to-add-a-worksheet-and-a-view-into-a-folder-in-ArchiCAD-API/m-p/577188#M8914</guid>
      <dc:creator>BerndSchwarzenbacher</dc:creator>
      <dc:date>2023-11-23T21:23:40Z</dc:date>
    </item>
  </channel>
</rss>

