1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
|
if (voxelLayer.Visualization != VoxelVisualization.Surface) voxelLayer.SetVisualization(VoxelVisualization.Surface); voxelLayer.SetSectionContainerExpanded(true); voxelLayer.SetSectionContainerVisibility(true);
var volume = voxelLayer.SelectedVariableProfile.Volume; var volumeSize = volume.GetVolumeSize();
var voxel_pos = new Coordinate3D(0, 0, volumeSize.Z); var voxel_pos_ur = new Coordinate3D(volumeSize.X, volumeSize.Y, volumeSize.Z);
var lineBuilder = new LineBuilderEx(voxel_pos, voxel_pos_ur, null); var diagonal = PolylineBuilderEx.CreatePolyline(lineBuilder.ToSegment());
var num_sections = 12; var spacing = 1 / (double)num_sections;
var orientation = 20.0; var tilt = -15.0;
var normal = voxelLayer.GetNormal(orientation, tilt);
for (int s = 0; s < num_sections; s++) { Coordinate2D end_pt = new Coordinate2D(0, 0); if (s > 0) { var segments = new List<Segment>() as ICollection<Segment>; var part = GeometryEngine.Instance.GetSubCurve3D( diagonal, 0.0, s * spacing, AsRatioOrLength.AsRatio); part.GetAllSegments(ref segments); end_pt = segments.First().EndCoordinate; }
volume.CreateSection(new SectionDefinition() { Name = $"Diagonal {s + 1}", VoxelPosition = new Coordinate3D(end_pt.X, end_pt.Y, volumeSize.Z), Normal = normal, IsVisible = true }); }
|