<?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: Sun direction documentation in Archicad C++ API</title>
    <link>https://community.graphisoft.com/t5/Archicad-C-API/Sun-direction-documentation/m-p/141498#M5907</link>
    <description>Szia Andor, &lt;BR /&gt;
 &lt;BR /&gt;
I will fix the documentation for APIAny_CalcSunOnPlaceID. &lt;BR /&gt;
Here's an example code from Environment_Control test AddOn: &lt;BR /&gt;
 
&lt;PRE&gt;// ----------------------------------------------------------------------------- 
// Get city/date/time/sun information 
// ----------------------------------------------------------------------------- 
 
static void		Do_DumpLocation (void) 
{
	API_PlaceInfo	placeInfo; 
	API_Vector3D	sunDir; 
	GSErrCode		err; 
 
	BNZeroMemory (&amp;amp;placeInfo, sizeof (API_PlaceInfo)); 
	err = ACAPI_Environment (APIEnv_GetPlaceSetsID, &amp;amp;placeInfo, NULL); 
	if (err) { 
		ErrorBeep ("APIEnv_GetPlaceSetsID", err); 
		return; 
	} 
 
	WriteReport ("actual day: %d", placeInfo.dayOfYear); 
	WriteReport ("actual minute: %d", placeInfo.minOfDay); 
 
	placeInfo.dayOfYear = 45; 
	placeInfo.minOfDay = 8 * 60 + 45; 
	err = ACAPI_Goodies (APIAny_CalcSunOnPlaceID, &amp;amp;placeInfo, NULL); 
	if (err) { 
		ErrorBeep ("APIAny_CalcSunOnPlaceID", err); 
		return; 
	} 
 
	sunDir.x = cos (placeInfo.sunAngXY) * cos (placeInfo.sunAngZ); 
	sunDir.y = sin (placeInfo.sunAngXY) * cos (placeInfo.sunAngZ); 
	sunDir.z = sin (placeInfo.sunAngZ); 
 
	WriteReport ("Sun data at 8:45 on 14th February"); 
	WriteReport ("  xy angle: %lf", placeInfo.sunAngXY); 
	WriteReport ("  z angle:  %lf", placeInfo.sunAngZ); 
	WriteReport ("  dirVect:  (%lf, %lf, %lf) ", sunDir.x, sunDir.y, sunDir.z); 
 
	return; 
}		// Do_DumpLocation&lt;/PRE&gt; &lt;BR /&gt;
 &lt;BR /&gt;
This shows how to calculate the sun direction from the given placeInfo. &lt;BR /&gt;
 &lt;BR /&gt;
Best Regards, &lt;BR /&gt;
Tibor</description>
    <pubDate>Mon, 03 Mar 2014 08:24:17 GMT</pubDate>
    <dc:creator>Tibor Lorantfy</dc:creator>
    <dc:date>2014-03-03T08:24:17Z</dc:date>
    <item>
      <title>Sun direction documentation</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Sun-direction-documentation/m-p/141497#M5906</link>
      <description>&lt;DIV class="actalk-migrated-content"&gt;Hey All,&lt;BR /&gt;&lt;BR /&gt;I think that the documentation for APIAny_CalcSunOnPlaceID is bad, since API_PlaceInfo has been changed.&lt;BR /&gt;&lt;BR /&gt;I try to figure out how does it work now, but I have some troubles. Could you please help?&lt;BR /&gt;
&lt;PRE&gt;&lt;I&gt;
&lt;/I&gt;double getSunDir (void){
	API_PlaceInfo  placeInfo;
	API_Attribute  attrib;
	GSErrCode      err;

	BNZeroMemory (&amp;amp;attrib, sizeof (API_Attribute));
	attrib.header.typeID = API_CityID;
	CHCopyC ("Budapest", attrib.header.name);

	err = ACAPI_Attribute_Search (&amp;amp;attrib.header);
	if (!err) {
		BNZeroMemory (&amp;amp;placeInfo, sizeof (API_PlaceInfo));
		placeInfo.timeZone = attrib.city.zone;
		placeInfo.latitude = attrib.city.latitude;
		placeInfo.longitude = attrib.city.longitude;
		DBPrintf("latitude %d",placeInfo.latitude);
		DBPrintf("longitude %d",placeInfo.longitude);
		placeInfo.sumTime = false;    // winter time 
		placeInfo.dayOfYear = 60;
		placeInfo.minOfDay = 600;
		placeInfo.north = PI / 2;     // up direction

		err = ACAPI_Goodies (APIAny_CalcSunOnPlaceID, &amp;amp;placeInfo, NULL);
		return placeInfo.sunAngXY;
	}
	else{
	DBPrintf("We don't know where the sun is.");
	return 0;
	}
	
}&lt;/PRE&gt;
&lt;/DIV&gt;</description>
      <pubDate>Tue, 01 Aug 2023 14:29:40 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Sun-direction-documentation/m-p/141497#M5906</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-08-01T14:29:40Z</dc:date>
    </item>
    <item>
      <title>Re: Sun direction documentation</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Sun-direction-documentation/m-p/141498#M5907</link>
      <description>Szia Andor, &lt;BR /&gt;
 &lt;BR /&gt;
I will fix the documentation for APIAny_CalcSunOnPlaceID. &lt;BR /&gt;
Here's an example code from Environment_Control test AddOn: &lt;BR /&gt;
 
&lt;PRE&gt;// ----------------------------------------------------------------------------- 
// Get city/date/time/sun information 
// ----------------------------------------------------------------------------- 
 
static void		Do_DumpLocation (void) 
{
	API_PlaceInfo	placeInfo; 
	API_Vector3D	sunDir; 
	GSErrCode		err; 
 
	BNZeroMemory (&amp;amp;placeInfo, sizeof (API_PlaceInfo)); 
	err = ACAPI_Environment (APIEnv_GetPlaceSetsID, &amp;amp;placeInfo, NULL); 
	if (err) { 
		ErrorBeep ("APIEnv_GetPlaceSetsID", err); 
		return; 
	} 
 
	WriteReport ("actual day: %d", placeInfo.dayOfYear); 
	WriteReport ("actual minute: %d", placeInfo.minOfDay); 
 
	placeInfo.dayOfYear = 45; 
	placeInfo.minOfDay = 8 * 60 + 45; 
	err = ACAPI_Goodies (APIAny_CalcSunOnPlaceID, &amp;amp;placeInfo, NULL); 
	if (err) { 
		ErrorBeep ("APIAny_CalcSunOnPlaceID", err); 
		return; 
	} 
 
	sunDir.x = cos (placeInfo.sunAngXY) * cos (placeInfo.sunAngZ); 
	sunDir.y = sin (placeInfo.sunAngXY) * cos (placeInfo.sunAngZ); 
	sunDir.z = sin (placeInfo.sunAngZ); 
 
	WriteReport ("Sun data at 8:45 on 14th February"); 
	WriteReport ("  xy angle: %lf", placeInfo.sunAngXY); 
	WriteReport ("  z angle:  %lf", placeInfo.sunAngZ); 
	WriteReport ("  dirVect:  (%lf, %lf, %lf) ", sunDir.x, sunDir.y, sunDir.z); 
 
	return; 
}		// Do_DumpLocation&lt;/PRE&gt; &lt;BR /&gt;
 &lt;BR /&gt;
This shows how to calculate the sun direction from the given placeInfo. &lt;BR /&gt;
 &lt;BR /&gt;
Best Regards, &lt;BR /&gt;
Tibor</description>
      <pubDate>Mon, 03 Mar 2014 08:24:17 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Sun-direction-documentation/m-p/141498#M5907</guid>
      <dc:creator>Tibor Lorantfy</dc:creator>
      <dc:date>2014-03-03T08:24:17Z</dc:date>
    </item>
    <item>
      <title>Re: Sun direction documentation</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Sun-direction-documentation/m-p/141499#M5908</link>
      <description>Ran into the incorrect documentation also.&lt;BR /&gt;
&lt;BR /&gt;
I was wondering if there is a way to pull out the current selected city in the sun directoin in Archicad 19</description>
      <pubDate>Sat, 18 Nov 2017 02:10:22 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Sun-direction-documentation/m-p/141499#M5908</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-11-18T02:10:22Z</dc:date>
    </item>
  </channel>
</rss>

