We value your input! Please participate in Archicad 28 Home Screen and Tooltips/Quick Tutorials survey
2014-03-01 11:21 AM - last edited on 2023-08-01 04:29 PM by Doreena Deng
double getSunDir (void){ API_PlaceInfo placeInfo; API_Attribute attrib; GSErrCode err; BNZeroMemory (&attrib, sizeof (API_Attribute)); attrib.header.typeID = API_CityID; CHCopyC ("Budapest", attrib.header.name); err = ACAPI_Attribute_Search (&attrib.header); if (!err) { BNZeroMemory (&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, &placeInfo, NULL); return placeInfo.sunAngXY; } else{ DBPrintf("We don't know where the sun is."); return 0; } }
2014-03-03 09:24 AM
// ----------------------------------------------------------------------------- // Get city/date/time/sun information // ----------------------------------------------------------------------------- static void Do_DumpLocation (void) { API_PlaceInfo placeInfo; API_Vector3D sunDir; GSErrCode err; BNZeroMemory (&placeInfo, sizeof (API_PlaceInfo)); err = ACAPI_Environment (APIEnv_GetPlaceSetsID, &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, &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
2017-11-18 03:10 AM