<?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: Help with setting morph's hidden edges in the API in Archicad C++ API</title>
    <link>https://community.graphisoft.com/t5/Archicad-C-API/Help-with-setting-morph-s-hidden-edges-in-the-API/m-p/572951#M8798</link>
    <description>&lt;P&gt;Hello Bernd,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the reply&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Yes it seems to be a bug, the interesting thing is that for us it happens in every version that our addon supports (from AC 23 to AC 27), so my thoughts where that either I was doing something horribly wrong, or this feature is just so unpopular that no one else noticed?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Anyways thanks for the help, greatly appreciated!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- Manel&lt;/P&gt;</description>
    <pubDate>Fri, 27 Oct 2023 09:28:55 GMT</pubDate>
    <dc:creator>ManelCG</dc:creator>
    <dc:date>2023-10-27T09:28:55Z</dc:date>
    <item>
      <title>Help with setting morph's hidden edges in the API</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Help-with-setting-morph-s-hidden-edges-in-the-API/m-p/572691#M8783</link>
      <description>&lt;P&gt;Hello everyone,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is my first post in this forum, so I hope everything is fine in it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Over the last few months I have been developing an ArchiCAD add-on for the company I work at. The Add-On is pretty much finished, however, there is one issue that bugs us.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;At some point in the addon, I am creating a bunch of morphs. We want the morphs to have Hard Hidden edges. I noticed that the API setting for this (HardVisible, HardHidden and SoftHidden) basically serves the same purpose as the EdgeType buttons in the AC GUI (Hard, Hidden and Soft).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="cpp"&gt;typedef enum {
	APIMorphEdgeType_SoftHiddenEdge,
	APIMorphEdgeType_HardHiddenEdge,
	APIMorphEdgeType_HardVisibleEdge

} API_MorphEdgeTypeID;&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, no matter how many different things I try, I cannot get the morphs to be imported with the hard-hidden setting. They always get imported as hard-visible.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note that, selecting all the morphs inside the GUI and manually clicking the "Hidden Edge" button, succeeds to set the morphs edge type, and the result is what we want.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also note that my addon also creates Mesh objects, which do succesfuly get imported with hidden edges. Our problem is only with the morphs.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is a summary of how I am creating the morphs (I will omit very long parts of the code, so there might be errors in the attached code):&lt;/P&gt;
&lt;P&gt;Please note: The AC class is a small static class that I created that wraps the very repetitive ACAPI calls.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="cpp"&gt;GSErrCode Importer::CreateMorph(...) {
	API_Element acMorph;
	API_ElementMemo memo;
	GSErrCode err = AC::InitAPIElement(API_MorphID, acMorph, memo); // A small function that wraps the BNZeroMemory functions and all that stuff

    // Note: I am clearly setting the HardHiddenEdge
	acMorph.morph.edgeType = APIMorphEdgeType_HardHiddenEdge;
	acMorph.morph.bodyType = APIMorphBodyType_SolidBody;
	acMorph.morph.castShadow = true;
	acMorph.morph.receiveShadow = true;

	// Transformation matrix for morph.
	acMorph.morph.tranmat = AC::GetMorphTMX(*T);

	// construct the body structure
	auto bodyData = AC::InitMorphBodyData();

    // Set the body shape, materials, etc (long code so I ommit it)

	// close the body and copy it to the memo
	err = ACAPI_Body_Finish (bodyData, &amp;amp;memo.morphBody, &amp;amp;memo.morphMaterialMapTable);
	if(err != NoError)
            ... handling errors

	err = ACAPI_Body_Dispose (&amp;amp;bodyData);
	if(err != NoError)
             ... handling errors

	err = ACAPI_Element_Create (&amp;amp;acMorph, &amp;amp;memo);

	if(err != NoError)
            ... handling errors
	
	ACAPI_DisposeElemMemoHdls (&amp;amp;memo);

	return err;
}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Once the addon finishes its execution, the morphs have the Hard Visible edge type.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Furthermore, if I do the following while debugging:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="cpp"&gt;void AC::SetMorphHiddenEdges(API_Guid g)
{
	API_Element elem;
	GetElementFromGuid(g, &amp;amp;elem);

    // elem.morph.edgeType = APIMorphEdgeType_HardVisibleEdge although it was set in the CreateMorphFunction to be HardHidden???

    // Explicitly set it to hard hidden
	elem.morph.edgeType = APIMorphEdgeType_HardHiddenEdge;
	auto err = ACAPI_Element_Change(&amp;amp;elem, nullptr, nullptr, 0, true);

    // err is NoError!

	GetElementFromGuid(g, &amp;amp;elem);

    // elem.morph.edgeType is hardvisible again!

    return;
}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;it is clearly shown by my debugger that after calling the Element Change function, and retrieving the morph again by its guid, the edge type has been reset again to the hard visible.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I also tried using this method, with no success:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="cpp"&gt;void AC::SetMorphHiddenEdges(API_Guid g)
{
	API_Element elem;
	API_Element pars;
	API_Element mask;

	BNZeroMemory(&amp;amp;elem, sizeof(API_Element));
	GetElementFromGuid(g, &amp;amp;elem);

	// elem.morph.edgeType is hardVisible, lets try to fix that...

	BNZeroMemory(&amp;amp;pars, sizeof(API_Element));
	BNZeroMemory(&amp;amp;mask, sizeof(API_Element));

	ACAPI_ELEMENT_MASK_CLEAR(mask);
	ACAPI_ELEMENT_MASK_SET(mask, API_MorphType, edgeType);

	pars.header.type = API_MorphID;
	pars.morph.edgeType = APIMorphEdgeType_HardHiddenEdge;

	GS::Array&amp;lt;API_Guid&amp;gt; guids({ g });

	auto err = ACAPI_Element_ChangeMore(guids, &amp;amp;pars, nullptr, &amp;amp;mask, 0, true);

	BNZeroMemory(&amp;amp;elem, sizeof(API_Element));
	GetElementFromGuid(g, &amp;amp;elem);
	// elem.morph.edgeType is still hard visible!
}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Am I missing something? How can I change this setting from the API?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any help is greatly appreciated. Also, if I must post some extra information, please do not hesitate to ask me!&lt;/P&gt;</description>
      <pubDate>Tue, 17 Sep 2024 09:25:50 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Help-with-setting-morph-s-hidden-edges-in-the-API/m-p/572691#M8783</guid>
      <dc:creator>ManelCG</dc:creator>
      <dc:date>2024-09-17T09:25:50Z</dc:date>
    </item>
    <item>
      <title>Re: Help with setting morph's hidden edges in the API</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Help-with-setting-morph-s-hidden-edges-in-the-API/m-p/572738#M8786</link>
      <description>&lt;P&gt;Hi Manel,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To me it looks like you are doing everything right. I was curious and tried it myself and also found the same behavior as you.&lt;BR /&gt;Curiously these 3 things seem to be ignored by &lt;STRONG&gt;ACAPI_Element_Create&lt;/STRONG&gt;:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;STRONG&gt;elem.morph.level&lt;/STRONG&gt; seems to always come out to 1.0&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;elem.morph.bodyType&lt;/STRONG&gt; seems to always result in &lt;STRONG&gt;APIMorphBodyType_Solid&lt;/STRONG&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;elem.morph.edgeType&lt;/STRONG&gt; seems to always come out to &lt;STRONG&gt;APIMorphEdgeType_HardVisibleEdge&lt;/STRONG&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;I'm wondering if there's some bug in the API. The 3 mentioned fields are aligned in memory right after each other, so that might be a clue, but it's really shooting in the dark.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, when creating a morph manually in Archicad, one can only choose Hard Visible edges. That might also be related.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sorry I couldn't be of more help, but I hope knowing that you are not the only one stumped by this might help a bit &lt;span class="lia-unicode-emoji" title=":grinning_face_with_sweat:"&gt;😅&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best,&lt;/P&gt;
&lt;P&gt;Bernd&lt;/P&gt;</description>
      <pubDate>Wed, 25 Oct 2023 18:59:33 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Help-with-setting-morph-s-hidden-edges-in-the-API/m-p/572738#M8786</guid>
      <dc:creator>BerndSchwarzenbacher</dc:creator>
      <dc:date>2023-10-25T18:59:33Z</dc:date>
    </item>
    <item>
      <title>Re: Help with setting morph's hidden edges in the API</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Help-with-setting-morph-s-hidden-edges-in-the-API/m-p/572951#M8798</link>
      <description>&lt;P&gt;Hello Bernd,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the reply&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Yes it seems to be a bug, the interesting thing is that for us it happens in every version that our addon supports (from AC 23 to AC 27), so my thoughts where that either I was doing something horribly wrong, or this feature is just so unpopular that no one else noticed?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Anyways thanks for the help, greatly appreciated!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- Manel&lt;/P&gt;</description>
      <pubDate>Fri, 27 Oct 2023 09:28:55 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Help-with-setting-morph-s-hidden-edges-in-the-API/m-p/572951#M8798</guid>
      <dc:creator>ManelCG</dc:creator>
      <dc:date>2023-10-27T09:28:55Z</dc:date>
    </item>
    <item>
      <title>Re: Help with setting morph's hidden edges in the API</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Help-with-setting-morph-s-hidden-edges-in-the-API/m-p/591038#M9236</link>
      <description>&lt;P&gt;&lt;a href="https://community.graphisoft.com/t5/user/viewprofilepage/user-id/92587"&gt;@ManelCG&lt;/a&gt;&amp;nbsp;&lt;a href="https://community.graphisoft.com/t5/user/viewprofilepage/user-id/8527"&gt;@BerndSchwarzenbacher&lt;/a&gt;&amp;nbsp; Any updates on this? I am also facing the same&lt;/P&gt;</description>
      <pubDate>Tue, 05 Mar 2024 06:59:11 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Help-with-setting-morph-s-hidden-edges-in-the-API/m-p/591038#M9236</guid>
      <dc:creator>Aathil</dc:creator>
      <dc:date>2024-03-05T06:59:11Z</dc:date>
    </item>
    <item>
      <title>Re: Help with setting morph's hidden edges in the API</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Help-with-setting-morph-s-hidden-edges-in-the-API/m-p/591065#M9237</link>
      <description>&lt;P&gt;No, as of today we still haven't found a solution to this problem. It very much looks like an API bug or some oversight. Really hoping that this gets fixed in some upcoming version as we would benefit from this feature working as intended. There have been an embarrassing amount of hours gone into trying to fix this&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":grinning_face_with_sweat:"&gt;😅&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Mar 2024 09:49:46 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Help-with-setting-morph-s-hidden-edges-in-the-API/m-p/591065#M9237</guid>
      <dc:creator>ManelCG</dc:creator>
      <dc:date>2024-03-05T09:49:46Z</dc:date>
    </item>
  </channel>
</rss>

