<?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: Dynamic size of UserData in Archicad C++ API</title>
    <link>https://community.graphisoft.com/t5/Archicad-C-API/Dynamic-size-of-UserData/m-p/570905#M8724</link>
    <description>&lt;P&gt;Hi TK!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can get the size of the entire data buffer when reading with &lt;STRONG&gt;BMGetHandleSize&lt;/STRONG&gt;. &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Assuming you are storing a list of strings, I think it would be best to read and write the single entries delimited with a &lt;A href="https://en.wikipedia.org/wiki/Null_character" target="_self"&gt;null character "\0"&lt;/A&gt;. When you read the data, you'd iterate through the characters until you hit the \0 character and that would mark the end of the current string entry.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;An alternative would be to work on a bit higher level and use&lt;STRONG&gt; GS::IChannel/GS::OChannel&lt;/STRONG&gt;. You can see an example of their use in &lt;STRONG&gt;AddOnObject_Manager&lt;/STRONG&gt; example project. I think one could adapt that approach to be used for element user data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope that helps! Let me know if in case you need more information on this.&lt;/P&gt;
&lt;P&gt;Bernd&lt;/P&gt;</description>
    <pubDate>Sun, 15 Oct 2023 22:33:23 GMT</pubDate>
    <dc:creator>BerndSchwarzenbacher</dc:creator>
    <dc:date>2023-10-15T22:33:23Z</dc:date>
    <item>
      <title>Dynamic size of UserData</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Dynamic-size-of-UserData/m-p/570851#M8715</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to attach (and than read) some user data to attributes I'm creating in my add-on.&lt;/P&gt;&lt;P&gt;The thing is the data is actually an array of strings of various lengths and sizes.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Technically, I know the size of the entire data buffer when creating the handle for saving, but what about reading?&lt;/P&gt;&lt;P&gt;I assume that Archicad knows how many bytes it allocated for the handle when retrieving data, but how do I get that?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Should I attach this information in the data itself? Or is there another, more 'proper' way of dealing with this?&lt;/P&gt;</description>
      <pubDate>Tue, 17 Sep 2024 11:22:01 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Dynamic-size-of-UserData/m-p/570851#M8715</guid>
      <dc:creator>Lk__</dc:creator>
      <dc:date>2024-09-17T11:22:01Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic size of UserData</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Dynamic-size-of-UserData/m-p/570905#M8724</link>
      <description>&lt;P&gt;Hi TK!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can get the size of the entire data buffer when reading with &lt;STRONG&gt;BMGetHandleSize&lt;/STRONG&gt;. &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Assuming you are storing a list of strings, I think it would be best to read and write the single entries delimited with a &lt;A href="https://en.wikipedia.org/wiki/Null_character" target="_self"&gt;null character "\0"&lt;/A&gt;. When you read the data, you'd iterate through the characters until you hit the \0 character and that would mark the end of the current string entry.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;An alternative would be to work on a bit higher level and use&lt;STRONG&gt; GS::IChannel/GS::OChannel&lt;/STRONG&gt;. You can see an example of their use in &lt;STRONG&gt;AddOnObject_Manager&lt;/STRONG&gt; example project. I think one could adapt that approach to be used for element user data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope that helps! Let me know if in case you need more information on this.&lt;/P&gt;
&lt;P&gt;Bernd&lt;/P&gt;</description>
      <pubDate>Sun, 15 Oct 2023 22:33:23 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Dynamic-size-of-UserData/m-p/570905#M8724</guid>
      <dc:creator>BerndSchwarzenbacher</dc:creator>
      <dc:date>2023-10-15T22:33:23Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic size of UserData</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Dynamic-size-of-UserData/m-p/570962#M8728</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hi Bernd,&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;This looks exactly what I was looking for.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks!&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Oct 2023 07:08:40 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Dynamic-size-of-UserData/m-p/570962#M8728</guid>
      <dc:creator>Lk__</dc:creator>
      <dc:date>2023-10-16T07:08:40Z</dc:date>
    </item>
  </channel>
</rss>

