internal static global::System.Runtime.InteropServices.HandleRef getCPtr(FDatasmithFacadeActorLight obj) { return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr); }
// 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); } }
// 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); } 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); FamilyInstance LightInstance = in_sourceElement as FamilyInstance; // Rotate the IES photometric web to match that of Revit. // Note: if tilt angle is present, it will be exported at part of the family instance transform, // so no need to process it here. io_datasmithLightActor.SetIesRotation(-90f * (LightInstance.Mirrored ? -1f : 1f), 0f, -90f); } if (io_datasmithLightActor is FDatasmithFacadeSpotLight pointLightActor) { // Set the intensity unit of the Datasmith point light and derived types. // All lights in Revit seem to be in candelas by default. pointLightActor.SetIntensityUnits(FDatasmithFacadePointLight.EPointLightIntensityUnit.Candelas); } if (io_datasmithLightActor is FDatasmithFacadeAreaLight areaLightActor) { // Set the Datasmith area light shape. areaLightActor.SetLightShape(ConvertLightShape(GetLightShape(in_lightAsset))); // Set the Datasmith area light distribution. areaLightActor.SetLightType(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). areaLightActor.SetWidth(width); } float length = GetLength(in_lightAsset); if (length > 0) { // Set the Datasmith area light shape size on the X axis (in world units). areaLightActor.SetLength(length); } } if (io_datasmithLightActor is FDatasmithFacadeSpotLight spotLightActor) { var lightParameters = GetLightParameter(in_sourceElement); float innerConeAngle = GetInnerConeAngle(lightParameters); if (innerConeAngle > 0) { spotLightActor.SetInnerConeAngle(innerConeAngle); } float outerConeAngle = GetOuterConeAngle(lightParameters); if (outerConeAngle > 0) { spotLightActor.SetOuterConeAngle(outerConeAngle); } } }