public Nullable<double> Value {get; set;}
Public Property Value As Nullable(Of Double)
public Nullable<double> Value {get; set;}
Public Property Value As Nullable(Of Double)
//var voxelLayer = ... ; //Must be on the QueuedTask.Run() //Visualization must be surface if (voxelLayer.Visualization != VoxelVisualization.Surface) voxelLayer.SetVisualization(VoxelVisualization.Surface); //Get the variable profile on which to create the iso surface var variable = voxelLayer.SelectedVariableProfile; // o Visualization must be Surface // o Variable profile must be continuous // o Variable MaxNumberofIsoSurfaces must not have been reached... if (variable.CanCreateIsosurface) { //Note: calling create if variable.CanCreateIsosurface == false //will trigger an InvalidOperationException //Specify a voxel value for the iso surface //At 2.x - //var min = variable.GetVariableStatistics().MinimumValue; //var max = variable.GetVariableStatistics().MaximumValue; var min = variable.Statistics.MinimumValue; var max = variable.Statistics.MaximumValue; var mid = (max + min) / 2; //color range (i.e. values that are being rendered) var renderer = variable.Renderer as CIMVoxelStretchRenderer; var color_min = renderer.ColorRangeMin; var color_max = renderer.ColorRangeMax; //keep the surface within the current color range (or it //won't render) if (mid < color_min) { mid = renderer.ColorRangeMin; } else if (mid > color_max) { mid = renderer.ColorRangeMax; } //Create the iso surface var suffix = Math.Truncate(mid * 100) / 100; variable.CreateIsosurface(new IsosurfaceDefinition() { Name = $"Surface {suffix}", Value = mid, IsVisible = true }); }
//var voxelLayer = ... ; //Must be on the QueuedTask.Run() var variable = voxelLayer.SelectedVariableProfile; //Change the color of the first surface for the given profile var surface = variable.GetIsosurfaces().FirstOrDefault(); if (surface != null) { if (voxelLayer.Visualization != VoxelVisualization.Surface) voxelLayer.SetVisualization(VoxelVisualization.Surface); //Change the iso surface voxel value surface.Value = surface.Value * 0.9; //get a random color var count = new Random().Next(0, 100); var colors = ColorFactory.Instance.GenerateColorsFromColorRamp( ((CIMVoxelStretchRenderer)variable.Renderer).ColorRamp, count); var idx = new Random().Next(0, count - 1); surface.Color = colors[idx]; //set the custom color flag true to lock the color //locking the color prevents it from being changed if the //renderer color range or color theme is updated surface.IsCustomColor = true; //update the surface variable.UpdateIsosurface(surface); }
Target Platforms: Windows 11, Windows 10