// Set the specific properties of the Datasmith light actor. static public void SetLightProperties( Asset in_lightAsset, Element in_sourceElement, FDatasmithFacadeActorLight io_datasmithLightActor ) { // Set whether or not the Datasmith light is enabled. io_datasmithLightActor.SetEnabled(IsEnabled(in_lightAsset)); double intensity = GetIntensity(in_lightAsset); if (intensity > 0) { // Set the Datasmith light intensity. io_datasmithLightActor.SetIntensity(intensity); } // Set the Datasmith light linear color. var color = GetColor(in_lightAsset); io_datasmithLightActor.SetColor((float)color[0], (float)color[1], (float)color[2], 1.0F); double temperature = GetTemperature(in_lightAsset); if (temperature > 0) { // Set the Datasmith light temperature (in Kelvin degrees). io_datasmithLightActor.SetTemperature(temperature); } var lightParameters = GetLightParameter(in_sourceElement); // Set the Datasmith light type. FDatasmithFacadeActorLight.ELightType lightType = GetLightType(lightParameters); io_datasmithLightActor.SetLightType(lightType); string iesFileName = GetIesFile(in_lightAsset); string iesCacheData = GetIesCacheData(in_lightAsset); if (iesFileName.Length > 0) { // Write a IES definition file and set its file path for the Datasmith light. // Use the user's temporary folder as IES definition file folder path. io_datasmithLightActor.WriteIESFile(Path.GetTempPath(), iesFileName, iesCacheData); } // Set the intensity unit of the Datasmith point light and derived types. // All lights in Revit seem to be in candelas by default. io_datasmithLightActor.SetPointIntensityUnit(FDatasmithFacadeActorLight.EPointLightIntensityUnit.Candelas); // Set the Datasmith area light shape. io_datasmithLightActor.SetAreaShape(ConvertLightShape(GetLightShape(in_lightAsset))); // Set the Datasmith area light distribution. io_datasmithLightActor.SetAreaType(ConvertLightType(GetLightDistribution(in_lightAsset))); float width = GetWidth(in_lightAsset); if (width > 0) { // Set the Datasmith area light shape size on the Y axis (in world units). io_datasmithLightActor.SetAreaWidth(width); } float length = GetLength(in_lightAsset); if (length > 0) { // Set the Datasmith area light shape size on the X axis (in world units). io_datasmithLightActor.SetAreaLength(length); } float innerConeAngle = GetInnerConeAngle(lightParameters); if (innerConeAngle > 0) { io_datasmithLightActor.SetSpotInnerConeAngle(innerConeAngle); } float outerConeAngle = GetOuterConeAngle(lightParameters); if (outerConeAngle > 0) { io_datasmithLightActor.SetSpotOuterConeAngle(outerConeAngle); } }
public void SetLightType(FDatasmithFacadeActorLight.ELightType InLightType) { DatasmithFacadeCSharpPINVOKE.FDatasmithFacadeActorLight_SetLightType(swigCPtr, (int)InLightType); }