<?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: Material is forgotten in a 3D subroutine in GDL</title>
    <link>https://community.graphisoft.com/t5/GDL/Material-is-forgotten-in-a-3D-subroutine/m-p/572517#M5771</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;thanks for Your answers, I think the bug shouldn't come out for short scripts (it's too eye-popping), so I have put here the whole gsm (standalone), AC27 .gsm.&lt;/P&gt;
&lt;P&gt;The difference is something like this:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SamKarli_0-1698162316258.png" style="width: 400px;"&gt;&lt;img src="https://community.graphisoft.com/t5/image/serverpage/image-id/47895i29F67BAF4EF11237/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SamKarli_0-1698162316258.png" alt="SamKarli_0-1698162316258.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;and if You comment out 3D script line 280:&lt;/P&gt;
&lt;DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;EM&gt;_ = _mat &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;! Dummy op&lt;/EM&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SamKarli_1-1698162381640.png" style="width: 400px;"&gt;&lt;img src="https://community.graphisoft.com/t5/image/serverpage/image-id/47896i6F5E0AA06602DE96/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SamKarli_1-1698162381640.png" alt="SamKarli_1-1698162381640.png" /&gt;&lt;/span&gt;
&lt;P&gt;(the frame is 'grey' instead of the given colour.&lt;/P&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 24 Oct 2023 15:47:25 GMT</pubDate>
    <dc:creator>Sam Karli</dc:creator>
    <dc:date>2023-10-24T15:47:25Z</dc:date>
    <item>
      <title>Material is forgotten in a 3D subroutine</title>
      <link>https://community.graphisoft.com/t5/GDL/Material-is-forgotten-in-a-3D-subroutine/m-p/572421#M5767</link>
      <description>&lt;P&gt;In a moderately complicated 3D script, that uses multiple subroutines (one calling another in a tree-like order) i have a material defining&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;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;! ---------------------------------
"Venting Window":
! ---------------------------------
! ---------------- Outer Frame ----------------
	addz yFrameIn
	print mFrameOut
		_mat		= mFrameOut
		_profile	= prFrameOut
		_xProfSize	= xFrameOut
		_yProfSize	= yFrameOut
		_xRectL		= 0
		_xRectR		= wFrame
		_yRectT		= -_hFrame
		_yRectB		= 0

		gosub "DrawRectangularFrame"
	del 1&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;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;where mFrameOut is a valid parameter of the script.&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;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;! ---------------------------------
"DrawRectangularFrame":
! ---------------------------------
!	_mat - material
!	_profile - profile ID to draw
!	_xProfSize, _yProfSize - if _profile = 0, profile rectangle height and width
!	_xRectL, _xRectR, _yRectT, _yRectB - path left, right, top, bottom corners

	_ = _mat			! Dummy op
	material _mat		!_mat

	if _profile then
		_autoShiftProfiles  = bAutoShiftProfiles

		gosub "GetProfile"
	endif

	if _bProfError | not(_profile) then
		put 0,			0,			 0
		put _xProfSize,	0,			 0
		put _xProfSize,	_yProfSize,	 0
		put 0,			_yProfSize,	 0
		put 0,			0,			-1
	endif

	TUBE nsp/3, 7, 1 + 2,
		get(nsp),

		_xRectL + 1,	_yRectB,		0,	0,

		_xRectL,		_yRectB,		0,	0,
		_xRectL,		_yRectT,		0,	0,
		_xRectR, 		_yRectT,		0,	0,
		_xRectR,  		_yRectB,		0,	0,
		_xRectL, 		_yRectB,		0,	0,

		_xRectL, 		_yRectB - 1,	0,	0
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;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;problem is that if the&lt;/P&gt;
&lt;DIV&gt;
&lt;DIV&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; _ = _mat &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;! Dummy op&lt;/EM&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;(or print _mat, anything using that _mat variable)&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;row is missing/commented out the material command in the next row will practically no effect: the material will not be set.&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;If I print out the material etc, it looks like having the right numeric ID all the time.&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;Looks like a lóbaszó nagy bug.&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;Original development was done in AC26 and now I check it in AC27, both versions having this bug (this workaround fix using the _ variable is done in AC27, I haven't checked it in AC26). BTW I have used similar approaches (in previous ArchiCADs) and haven't seen anything similar.&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;Note that &lt;EM&gt;_mat&lt;/EM&gt; variable is only used here, so I think there is no any hidden overwriting that.&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Thu, 26 Sep 2024 11:48:41 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/GDL/Material-is-forgotten-in-a-3D-subroutine/m-p/572421#M5767</guid>
      <dc:creator>Sam Karli</dc:creator>
      <dc:date>2024-09-26T11:48:41Z</dc:date>
    </item>
    <item>
      <title>Re: Material is forgotten in a 3D subroutine</title>
      <link>https://community.graphisoft.com/t5/GDL/Material-is-forgotten-in-a-3D-subroutine/m-p/572441#M5768</link>
      <description>&lt;P&gt;In this script the material is correctly set (AC 26 macOS):&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;! ---------------------------------
"Venting Window":
! ---------------------------------
! ---------------- Outer Frame ----------------
	addz yFrameIn
	!print mFrameOut
		_mat		= mFrameOut
		_profile	= 1
		_xProfSize	= 1
		_yProfSize	= 1
		_xRectL		= 0
		_xRectR		= 1
		_yRectT		= -1
		_yRectB		= 0
		_bProfError = 1

		gosub "DrawRectangularFrame"
	del 1

! ---------------------------- E N D ----------------------------------- !
! ---------------------------- E N D ----------------------------------- !

END  ! -- END -- END -- END -- END -- END -- END -- END -- END -- END -- !

! ---------------------------- E N D ----------------------------------- !
! ---------------------------- E N D ----------------------------------- !

! ---------------------------------
"DrawRectangularFrame":
! ---------------------------------
!	_mat - material
!	_profile - profile ID to draw
!	_xProfSize, _yProfSize - if _profile = 0, profile rectangle height and width
!	_xRectL, _xRectR, _yRectT, _yRectB - path left, right, top, bottom corners

	material _mat		!_mat

	if _profile then

		gosub "GetProfile"
	endif

	if _bProfError | not(_profile) then
		put 0,			0,			 0
		put _xProfSize,	0,			 0
		put _xProfSize,	_yProfSize,	 0
		put 0,			_yProfSize,	 0
		put 0,			0,			-1
	endif

	TUBE nsp/3, 7, 1 + 2,
		get(nsp),

		_xRectL + 1,	_yRectB,		0,	0,

		_xRectL,		_yRectB,		0,	0,
		_xRectL,		_yRectT,		0,	0,
		_xRectR, 		_yRectT,		0,	0,
		_xRectR,  		_yRectB,		0,	0,
		_xRectL, 		_yRectB,		0,	0,

		_xRectL, 		_yRectB - 1,	0,	0
return

! ---------------------------------------------------------------------- !
! ---------------------------------------------------------------------- !


"GetProfile":

PUT 0, 0,0,
0, 0, 1,
1, 0, 1,
1,0, 0


RETURN

! ---------------------------------------------------------------------- !
! ---------------------------------------------------------------------- !
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Oct 2023 10:38:17 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/GDL/Material-is-forgotten-in-a-3D-subroutine/m-p/572441#M5768</guid>
      <dc:creator>Jochen Suehlo</dc:creator>
      <dc:date>2023-10-24T10:38:17Z</dc:date>
    </item>
    <item>
      <title>Re: Material is forgotten in a 3D subroutine</title>
      <link>https://community.graphisoft.com/t5/GDL/Material-is-forgotten-in-a-3D-subroutine/m-p/572482#M5770</link>
      <description>&lt;P&gt;What happens, if you put "&lt;/P&gt;
&lt;PRE class="lia-code-sample  language-markup"&gt;&lt;CODE&gt;material _mat&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;after&lt;/P&gt;
&lt;PRE class="lia-code-sample  language-markup"&gt;&lt;CODE&gt;gosub "GetProfile"&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 24 Oct 2023 13:32:45 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/GDL/Material-is-forgotten-in-a-3D-subroutine/m-p/572482#M5770</guid>
      <dc:creator>Jochen Suehlo</dc:creator>
      <dc:date>2023-10-24T13:32:45Z</dc:date>
    </item>
    <item>
      <title>Re: Material is forgotten in a 3D subroutine</title>
      <link>https://community.graphisoft.com/t5/GDL/Material-is-forgotten-in-a-3D-subroutine/m-p/572517#M5771</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;thanks for Your answers, I think the bug shouldn't come out for short scripts (it's too eye-popping), so I have put here the whole gsm (standalone), AC27 .gsm.&lt;/P&gt;
&lt;P&gt;The difference is something like this:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SamKarli_0-1698162316258.png" style="width: 400px;"&gt;&lt;img src="https://community.graphisoft.com/t5/image/serverpage/image-id/47895i29F67BAF4EF11237/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SamKarli_0-1698162316258.png" alt="SamKarli_0-1698162316258.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;and if You comment out 3D script line 280:&lt;/P&gt;
&lt;DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;EM&gt;_ = _mat &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;! Dummy op&lt;/EM&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SamKarli_1-1698162381640.png" style="width: 400px;"&gt;&lt;img src="https://community.graphisoft.com/t5/image/serverpage/image-id/47896i6F5E0AA06602DE96/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SamKarli_1-1698162381640.png" alt="SamKarli_1-1698162381640.png" /&gt;&lt;/span&gt;
&lt;P&gt;(the frame is 'grey' instead of the given colour.&lt;/P&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Oct 2023 15:47:25 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/GDL/Material-is-forgotten-in-a-3D-subroutine/m-p/572517#M5771</guid>
      <dc:creator>Sam Karli</dc:creator>
      <dc:date>2023-10-24T15:47:25Z</dc:date>
    </item>
    <item>
      <title>Re: Material is forgotten in a 3D subroutine</title>
      <link>https://community.graphisoft.com/t5/GDL/Material-is-forgotten-in-a-3D-subroutine/m-p/572531#M5772</link>
      <description>&lt;P&gt;Sometimes it happens that variables declared in a subroutine which is laid physically below the place where the variable is used, the variable cannot be found by the GDL interpreter. This always happens with Array declarations. I never had this before with material declerations, but in your case is it so.&lt;BR /&gt;Please place the subroutine &lt;SPAN&gt;"DrawRectangularFrame":&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;at the end of the script: then it works (for me it did).&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Oct 2023 16:33:42 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/GDL/Material-is-forgotten-in-a-3D-subroutine/m-p/572531#M5772</guid>
      <dc:creator>Jochen Suehlo</dc:creator>
      <dc:date>2023-10-24T16:33:42Z</dc:date>
    </item>
    <item>
      <title>Re: Material is forgotten in a 3D subroutine</title>
      <link>https://community.graphisoft.com/t5/GDL/Material-is-forgotten-in-a-3D-subroutine/m-p/572632#M5778</link>
      <description>&lt;P&gt;Good point, I have seen things like that, too.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 25 Oct 2023 07:58:34 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/GDL/Material-is-forgotten-in-a-3D-subroutine/m-p/572632#M5778</guid>
      <dc:creator>Sam Karli</dc:creator>
      <dc:date>2023-10-25T07:58:34Z</dc:date>
    </item>
  </channel>
</rss>

