diff --git a/src/bcf-toolkit/Builder/Bcf21/VisualizationInfoBuilderExtension.cs b/src/bcf-toolkit/Builder/Bcf21/VisualizationInfoBuilderExtension.cs index e66e3a6..054aa18 100644 --- a/src/bcf-toolkit/Builder/Bcf21/VisualizationInfoBuilderExtension.cs +++ b/src/bcf-toolkit/Builder/Bcf21/VisualizationInfoBuilderExtension.cs @@ -1,6 +1,4 @@ -using System; using System.Collections.Generic; -using BcfToolkit.Model; using BcfToolkit.Model.Bcf21; namespace BcfToolkit.Builder.Bcf21; @@ -51,6 +49,12 @@ public VisualizationInfoBuilder SetPerspectiveCamera( return this; } + public VisualizationInfoBuilder SetViewSetupHints( + ViewSetupHints? viewSetupHints) { + _visualizationInfo.GetComponentsInstance().ViewSetupHints = viewSetupHints; + return this; + } + } \ No newline at end of file diff --git a/src/bcf-toolkit/Builder/Bcf30/MarkupBuilderExensions.cs b/src/bcf-toolkit/Builder/Bcf30/MarkupBuilderExensions.cs index 89d4ef1..a9de83f 100644 --- a/src/bcf-toolkit/Builder/Bcf30/MarkupBuilderExensions.cs +++ b/src/bcf-toolkit/Builder/Bcf30/MarkupBuilderExensions.cs @@ -44,4 +44,9 @@ public MarkupBuilder AddDocumentReferences( documentReferences.ForEach(_markup.Topic.DocumentReferences.Add); return this; } + + public MarkupBuilder SetBimSnippet(BimSnippet bimSnippet) { + _markup.Topic.BimSnippet = bimSnippet; + return this; + } } \ No newline at end of file diff --git a/src/bcf-toolkit/Builder/Bcf30/OrthogonalCameraBuilderExtensions.cs b/src/bcf-toolkit/Builder/Bcf30/OrthogonalCameraBuilderExtensions.cs new file mode 100644 index 0000000..5835184 --- /dev/null +++ b/src/bcf-toolkit/Builder/Bcf30/OrthogonalCameraBuilderExtensions.cs @@ -0,0 +1,33 @@ +using BcfToolkit.Model.Bcf30; + +namespace BcfToolkit.Builder.Bcf30; + +public partial class OrthogonalCameraBuilder { + public OrthogonalCameraBuilder SetCameraViewPoint(double x, double y, double z) { + _camera.CameraViewPoint = new Point { + X = x, + Y = y, + Z = z + }; + return this; + } + + public OrthogonalCameraBuilder SetCameraDirection(double x, double y, double z) { + _camera.CameraDirection = new Direction { + X = x, + Y = y, + Z = z + }; + return this; + } + + public OrthogonalCameraBuilder SetCameraUpVector(double x, double y, double z) { + _camera.CameraUpVector = new Direction { + X = x, + Y = y, + Z = z + }; + return this; + } + +} \ No newline at end of file diff --git a/src/bcf-toolkit/Builder/Bcf30/PerspectiveCameraBuilderExtensions.cs b/src/bcf-toolkit/Builder/Bcf30/PerspectiveCameraBuilderExtensions.cs new file mode 100644 index 0000000..b36a081 --- /dev/null +++ b/src/bcf-toolkit/Builder/Bcf30/PerspectiveCameraBuilderExtensions.cs @@ -0,0 +1,31 @@ +using BcfToolkit.Model.Bcf30; +namespace BcfToolkit.Builder.Bcf30; + +public partial class PerspectiveCameraBuilder { + public PerspectiveCameraBuilder SetCameraViewPoint(double x, double y, double z) { + _camera.CameraViewPoint = new Point { + X = x, + Y = y, + Z = z + }; + return this; + } + + public PerspectiveCameraBuilder SetCameraDirection(double x, double y, double z) { + _camera.CameraDirection = new Direction { + X = x, + Y = y, + Z = z + }; + return this; + } + + public PerspectiveCameraBuilder SetCameraUpVector(double x, double y, double z) { + _camera.CameraUpVector = new Direction { + X = x, + Y = y, + Z = z + }; + return this; + } +} \ No newline at end of file diff --git a/src/bcf-toolkit/Builder/Bcf30/ViewPointBuilder.cs b/src/bcf-toolkit/Builder/Bcf30/ViewPointBuilder.cs index c92c444..400b0ff 100644 --- a/src/bcf-toolkit/Builder/Bcf30/ViewPointBuilder.cs +++ b/src/bcf-toolkit/Builder/Bcf30/ViewPointBuilder.cs @@ -6,7 +6,7 @@ namespace BcfToolkit.Builder.Bcf30; -public class ViewPointBuilder : IViewPointBuilder< +public partial class ViewPointBuilder : IViewPointBuilder< ViewPointBuilder, VisualizationInfoBuilder> { private readonly ViewPoint _viewPoint = new(); diff --git a/src/bcf-toolkit/Builder/Bcf30/ViewPointBuilderExtensions.cs b/src/bcf-toolkit/Builder/Bcf30/ViewPointBuilderExtensions.cs new file mode 100644 index 0000000..64509ff --- /dev/null +++ b/src/bcf-toolkit/Builder/Bcf30/ViewPointBuilderExtensions.cs @@ -0,0 +1,11 @@ +using BcfToolkit.Model.Bcf30; + +namespace BcfToolkit.Builder.Bcf30; + +public partial class ViewPointBuilder { + + public ViewPointBuilder SetVisualizationInfo(VisualizationInfo visualizationInfo) { + _viewPoint.VisualizationInfo = visualizationInfo; + return this; + } +} \ No newline at end of file diff --git a/src/bcf-toolkit/Builder/Bcf30/VisualizationInfoBuilderExtensions.cs b/src/bcf-toolkit/Builder/Bcf30/VisualizationInfoBuilderExtensions.cs index 0d1c2e9..fdfd26a 100644 --- a/src/bcf-toolkit/Builder/Bcf30/VisualizationInfoBuilderExtensions.cs +++ b/src/bcf-toolkit/Builder/Bcf30/VisualizationInfoBuilderExtensions.cs @@ -30,4 +30,19 @@ public VisualizationInfoBuilder AddBitmaps(List? bitmaps) { bitmaps?.ForEach(_visualizationInfo.Bitmaps.Add); return this; } + + public VisualizationInfoBuilder SetOrthogonalCamera(OrthogonalCamera orthogonalCamera) { + _visualizationInfo.OrthogonalCamera = orthogonalCamera; + return this; + } + + public VisualizationInfoBuilder SetPerspectiveCamera(PerspectiveCamera perspectiveCamera) { + _visualizationInfo.PerspectiveCamera = perspectiveCamera; + return this; + } + + public VisualizationInfoBuilder SetVisibility(ComponentVisibility visibility) { + _visualizationInfo.GetComponentsInstance().Visibility = visibility; + return this; + } } \ No newline at end of file diff --git a/src/tests/Builder/Bcf21/BcfBuilderTests.cs b/src/tests/Builder/Bcf21/BcfBuilderTests.cs index 855845b..8179a80 100644 --- a/src/tests/Builder/Bcf21/BcfBuilderTests.cs +++ b/src/tests/Builder/Bcf21/BcfBuilderTests.cs @@ -35,9 +35,9 @@ public void EmptyFieldsConversationTest() { headerBuilder .SetDate(DateTime.Now) .SetReference(string.Empty) - .SetFileName("Filename") - .SetIfcProject("1234567890123456789012") - .SetIfcSpatialStructureElement("1234567890123456789012") + .SetFileName("StructuralModel.ifc") + .SetIfcProject("1g8GxLEzP459ZWW6_RGsez") + .SetIfcSpatialStructureElement("2g8GxLEzP459ZWW6_RGsez") .SetIsExternal(true) .Build(); var headers = new List { header }; @@ -62,8 +62,8 @@ public void EmptyFieldsConversationTest() { .SetModifiedAuthor(string.Empty) .SetDate(DateTime.Today) .SetModifiedDate(DateTime.Today) - .SetAuthor("author1") - .SetCommentProperty("commProp1") + .SetAuthor("john.wick@johnwick.com") + .SetCommentProperty("Pls changes the wall thickness to 8cm") .Build(); var commentPropCanBeEmpty = commentBuilder2 @@ -71,8 +71,8 @@ public void EmptyFieldsConversationTest() { .SetModifiedAuthor(string.Empty) .SetDate(DateTime.Today) .SetModifiedDate(DateTime.Today) - .SetAuthor("author2") - .SetViewPointGuid("111b4df2-0187-49a9-8a4a-23992696bafd") + .SetAuthor("jim.carry@jim.com") + .SetViewPointGuid("444b4df2-0187-49a9-8a4a-23992696bafd") .SetCommentProperty(string.Empty) .Build(); var comments = new List { commentPropMustHaveValue, commentPropCanBeEmpty }; @@ -83,7 +83,7 @@ public void EmptyFieldsConversationTest() { var componentBuilder = new ComponentBuilder(); var component = componentBuilder - .SetIfcGuid("1234567890123456789012") + .SetIfcGuid("3g8GxLEzP459ZWW6_RGsez") .SetOriginatingSystem(string.Empty) .SetAuthoringToolId(string.Empty) .Build(); @@ -104,7 +104,7 @@ public void EmptyFieldsConversationTest() { var viewPoint = viewPointBuilder .SetGuid("444b4df2-0187-49a9-8a4a-23992696bafd") - .SetIndex(5) + .SetIndex(0) .SetSnapshot(string.Empty) .SetSnapshotData(new FileData { Data = "snapshotdata1" diff --git a/src/tests/Builder/Bcf21/SuperBcfFile.cs b/src/tests/Builder/Bcf21/SuperBcfFile.cs new file mode 100644 index 0000000..96989c7 --- /dev/null +++ b/src/tests/Builder/Bcf21/SuperBcfFile.cs @@ -0,0 +1,260 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Threading.Tasks; +using BcfToolkit; +using BcfToolkit.Builder.Bcf21; +using BcfToolkit.Converter; +using BcfToolkit.Model; +using BcfToolkit.Model.Bcf21; +using NUnit.Framework; + +namespace tests.Builder.Bcf21; + + +public class SuperBcfFile { + private BcfBuilder _builder = null!; + private IConverter _converter = null!; + private Worker _worker; + + [SetUp] + public void Setup() { + _builder = new BcfBuilder(); + _converter = new BcfToolkit.Converter.Bcf21.Converter(); + _worker = new Worker(); + } + + [Test] + public async Task CreateSuperBcf21File() { + + var labels = new List { "label1", "label2", }; + var referenceLinks = new List { "http://www.buildingsmart-tech.org", "www.google.com" }; + + + // Header + var headerBuilder = new HeaderFileBuilder(); + var header = + headerBuilder + .SetDate(DateTime.Now) + .SetReference("reference") + .SetFileName("Bauprojekt1.ifc") + .SetIfcProject("4g8GxLEzP459ZWW6_RGsez") + .SetIfcSpatialStructureElement("128GxLEzP459ZWW6_RGsez") + .SetIsExternal(true) + .Build(); + var headers = new List { header }; + + // DocumentReference + var topicDocumentReferenceBuilder = new DocumentReferenceBuilder(); + var topicDocumentReference = + topicDocumentReferenceBuilder + .SetDescription("This is a document ref") + .SetIsExternal(false) + .SetGuid("000b4df2-0187-49a9-8a4a-23992696bafd") + .SetReferencedDocument("ref_document.png") + .Build(); + + var topicDocumentReferenceExternal = + topicDocumentReferenceBuilder + .SetDescription("BCFv1 Markup Schema") + .SetIsExternal(true) + .SetReferencedDocument("http://www.buildingsmart-tech.org/specifications/bcf-releases/bcfxml-v1/markup.xsd/at_download/file<") + .Build(); + + topicDocumentReference.DocumentData = new FileData { + Mime = "image/png", + Data = "iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAABlBMVEX///+/v7+jQ3Y5AAAADklEQVQI12P4AIX8EAgALgAD/aNpbtEAAAAASUVORK5CYII=" + }; + var topicDocumentReferences = new List + {topicDocumentReference, topicDocumentReferenceExternal}; + + // Comments + var commentBuilder1 = new CommentBuilder(); + var commentBuilder2 = new CommentBuilder(); + var comment1 = + commentBuilder1 + .SetGuid("998b4df2-0187-49a9-8a4a-23992696bafd") + .SetModifiedAuthor("john.wick@johnwick.com") + .SetDate(DateTime.Today) + .SetModifiedDate(DateTime.Today) + .SetAuthor("john.wick@johnwick.com") + .SetCommentProperty("This wall should be moved 1cm left.") + .Build(); + var comment2 = + commentBuilder2 + .SetGuid("997b4df2-0187-49a9-8a4a-23992696bafd") + .SetModifiedAuthor("jim.carry@jim.com") + .SetDate(DateTime.Today) + .SetModifiedDate(DateTime.Today) + .SetAuthor("jim.carry@jim.com") + .SetViewPointGuid("444b4df2-0187-49a9-8a4a-23992696bafd") + .SetCommentProperty("This wall should be moved 2cm left.") + .Build(); + var comments = new List + {comment1, comment2}; + + // Viewpoint + var visualizationInfoBuilder = new VisualizationInfoBuilder(); + + var componentBuilder = new ComponentBuilder(); + var component = + componentBuilder + .SetIfcGuid("0g8GxLEzP459ZWW6_RGsez") + .SetOriginatingSystem("originatingSystem") + .SetAuthoringToolId("authoringToolId") + .Build(); + var components = new List { component }; + + var visibilityBuilder = new VisibilityBuilder(); + var compVis = + visibilityBuilder + .SetDefaultVisibility(true) + .AddExceptions(components) + .Build(); + + var orthoBuilder = new OrthogonalCameraBuilder(); + var ortho = + orthoBuilder + .SetCameraDirection(1.2, 2.4, 3.6) + .SetCameraUpVector(11.2, 21.4, 31.6) + .SetCameraViewPoint(11.2, 12.4, 13.6) + .SetViewToWorldScale(1.0) + .Build(); + + var vsHintBuilder = new ViewSetupHintsBuilder(); + var vsHint = + vsHintBuilder + .SetOpeningVisible(true) + .SetSpaceVisible(true) + .SetSpaceBoundariesVisible(true) + .Build(); + + + var bitmapBuilder = new BitmapBuilder(); + var bitmap = + bitmapBuilder + .SetReference("reference") + .SetUp(41.2, 24.4, 43.6) + .SetFormat("Png") + .SetHeight(3.2) + .SetLocation(13.2, 23.4, 33.6) + .SetNormal(31.2, 32.4, 33.6) + .Build(); + var visBitmaps = new List { bitmap, bitmap }; + + var coloringBuilder = new ComponentColoringColorBuilder(); + var coloring = + coloringBuilder + .SetColor("40E0D0") + .AddComponents(components) + .Build(); + var colorings = new List { coloring, coloring }; + + var clippingPlaneBuilder = new ClippingPlaneBuilder(); + + var clippingPlane = + clippingPlaneBuilder + .SetLocation(15.2, 2.4, 3.6) + .SetDirection(1.2, 52.4, 3.6) + .Build(); + var clippingPlanes = new List { clippingPlane, clippingPlane }; + + var visualizationInfo = + visualizationInfoBuilder + .SetGuid("333b4df2-0187-49a9-8a4a-23992696bafd") + .SetOrthogonalCamera(ortho) + .SetViewSetupHints(vsHint) + .AddBitmaps(visBitmaps) + .AddColorings(colorings) + .AddSelections(components) + .AddClippingPlanes(clippingPlanes) + .SetVisibility(compVis) + .AddSelections(components) + .Build(); + + var viewPointBuilder = new ViewPointBuilder(); + var viewPoint = + viewPointBuilder + .SetGuid("444b4df2-0187-49a9-8a4a-23992696bafd") + .SetIndex(0) + .SetSnapshot("snapshot.png") + .SetSnapshotData(new FileData { + Mime = "data:image/png;base64", + Data = "iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAABlBMVEX///+/v7+jQ3Y5AAAADklEQVQI12P4AIX8EAgALgAD/aNpbtEAAAAASUVORK5CYII=" + }) + .SetViewPoint("viewpoint.bcfv") + .SetVisualizationInfo(visualizationInfo) + .Build(); + + var viewPoints = new List { viewPoint }; + + var bimSnippetBuilder = new BimSnippetBuilder(); + var bimSnippet = + bimSnippetBuilder + .SetReference("https://.../snippetExample.ifc") + .SetIsExternal(true) + .SetSnippetType("snippetType") + .SetReferenceSchema("refSchema") + .Build(); + + var topicRelatedTopic1 = new TopicRelatedTopic(); + topicRelatedTopic1.Guid = "4ffb4df2-0187-49a9-8a4a-23992696bafd"; + + var topicRelatedTopic2 = new TopicRelatedTopic(); + topicRelatedTopic2.Guid = "5ffb4df2-0187-49a9-8a4a-23992696bafd"; + + var relatedTopics = new List + {topicRelatedTopic1, topicRelatedTopic2}; + + var bcf = _builder + .AddMarkup(m => m + .AddHeaderFiles(headers) + .SetTitle("Wall reposition issue") + .SetPriority("Low") + .SetGuid("3ffb4df2-0187-49a9-8a4a-23992696bafd") + .SetCreationAuthor("john.wick@johnwick.com") + .SetModifiedAuthor("john.wick@johnwick.com") + .SetAssignedTo("jim.carry@jim.com") + .SetStage("PreDesign") + .SetTopicType("Warning") + .SetTopicStatus("Closed") + .SetDescription("Give me more details") + .AddLabels(labels) + .AddReferenceLinks(referenceLinks) + .AddDocumentReferences(topicDocumentReferences) + .AddComments(comments) + .AddViewPoints(viewPoints) + .SetIndex(0) + .SetCreationDate(DateTime.Today) + .SetDueDate(DateTime.Today) + .SetModifiedDate(DateTime.Today) + .SetBimSnippet(bimSnippet) + .AddRelatedTopics(relatedTopics)) + .SetProject(p => p + .SetProjectId("3ZSh2muKX7S8MCESk95seC") + .SetProjectName("projectName") + .SetExtensionSchema("extensionSchema")) + // .SetDocumentData(docData) + .Build(); + + await _converter.ToBcf(bcf, + "Resources/Bcf/v2.1/super21.bcfzip"); + } + + + public async Task ReadBcf21FileTest() { + var samples = new List { + "Resources/Bcf/v2.1/super21.bcfzip" + }; + + var tasks = samples.Select(async path => { + await using var stream = + new FileStream(path, FileMode.Open, FileAccess.Read); + var bcf = await _worker.BcfFromStream(stream); + Assert.That(bcf.Version.VersionId, Is.EqualTo("3.0")); + }).ToArray(); + + await Task.WhenAll(tasks); + } +} \ No newline at end of file diff --git a/src/tests/Builder/Bcf30/BcfBuilderTests.cs b/src/tests/Builder/Bcf30/BcfBuilderTests.cs index 81385db..4693054 100644 --- a/src/tests/Builder/Bcf30/BcfBuilderTests.cs +++ b/src/tests/Builder/Bcf30/BcfBuilderTests.cs @@ -24,7 +24,7 @@ public void BuildBcfWithComplexFields() { .SetTopicType("Issue") .SetTopicStatus("Open")) .SetExtensions(e => e - .AddTopicType("ERROR") + .AddTopicType("Error") .AddTopicStatus("OPEN") .AddPriority("HIGH")) .SetProject(p => p diff --git a/src/tests/Builder/Bcf30/SuperBcfFile.cs b/src/tests/Builder/Bcf30/SuperBcfFile.cs new file mode 100644 index 0000000..2d8e940 --- /dev/null +++ b/src/tests/Builder/Bcf30/SuperBcfFile.cs @@ -0,0 +1,297 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Threading.Tasks; +using BcfToolkit; +using BcfToolkit.Builder.Bcf30; +using BcfToolkit.Converter; +using BcfToolkit.Model; +using BcfToolkit.Model.Bcf30; +using NUnit.Framework; +using BcfBuilder = BcfToolkit.Builder.Bcf30.BcfBuilder; +using File = BcfToolkit.Model.Bcf30.File; + +namespace tests.Builder.Bcf30; + + +public class SuperBcfFile { + private BcfBuilder _builder = null!; + private IConverter _converter = null!; + private Worker _worker; + + [SetUp] + public void Setup() { + _builder = new BcfBuilder(); + _converter = new BcfToolkit.Converter.Bcf30.Converter(); + _worker = new Worker(); + } + + [Test] + public async Task CreateSuperBcf30File() { + + var labels = new List { "label1", "label2", }; + var referenceLinks = new List { "http://www.buildingsmart-tech.org", "www.google.com" }; + + // Header + var fileBuilder = new FileBuilder(); + var headerFile = + fileBuilder + .SetReference("reference") + .SetIsExternal(true) + .SetFileName("StructuralModel.ifc") + .SetDate(DateTime.Today) + .SetIfcProject("5g8GxLEzP459ZWW6_RGsez") + .SetIfcSpatialStructureElement("138GxLEzP459ZWW6_RGsez") + .Build(); + var headers = new List { headerFile }; + + // DocumentReference + var topicDocumentReferenceBuilder = new DocumentReferenceBuilder(); + var topicDocumentReference = + topicDocumentReferenceBuilder + .SetDescription("description") + .SetGuid("000b4df2-0187-49a9-8a4a-23992696bafd") + .SetDocumentGuid("447b4df2-0187-49a9-8a4a-23992696bafd") + .Build(); + + var topicDocumentReferenceExternal = + topicDocumentReferenceBuilder + .SetDescription("BCF 3.0 Markup Schema") + .SetUrl("http://www.buildingsmart-tech.org/specifications/bcf-releases/bcfxml-v1/markup.xsd/at_download/file<") + .Build(); + var topicDocumentReferences = new List { topicDocumentReference, topicDocumentReferenceExternal }; + + // Comments + var commentBuilder1 = new CommentBuilder(); + var commentBuilder2 = new CommentBuilder(); + var comment1 = + commentBuilder1 + .SetGuid("999b4df2-0187-49a9-8a4a-23992696bafd") + .SetModifiedAuthor("john.wick@johnwick.com") + .SetDate(DateTime.Today) + .SetModifiedDate(DateTime.Today) + .SetAuthor("john.wick@johnwick.com") + .SetCommentProperty("Pls changes the wall thickness to 8cm") + .Build(); + var comment2 = + commentBuilder2 + .SetGuid("998b4df2-0187-49a9-8a4a-23992696bafd") + .SetModifiedAuthor("jim.carry@jim.com") + .SetDate(DateTime.Today) + .SetModifiedDate(DateTime.Today) + .SetAuthor("jim.carry@jim.com") + .SetViewPointGuid("445b4df2-0187-49a9-8a4a-23992696bafd") + .SetCommentProperty("Pls changes the wall thickness to 8cm") + .Build(); + var comments = new List { comment1, comment2 }; + + // Viewpoint + var visualizationInfoBuilder = new VisualizationInfoBuilder(); + var componentBuilder = new ComponentBuilder(); + var component = + componentBuilder + .SetIfcGuid("118GxLEzP459ZWW6_RGsez") + .SetOriginatingSystem("originatingSystem") + .SetAuthoringToolId("authoringToolId") + .Build(); + var components = new List { component }; + + var visibilityBuilder = new VisibilityBuilder(); + var compVis = + visibilityBuilder + .SetDefaultVisibility(true) + .AddExceptions(components) + .Build(); + + var persBuilder = new PerspectiveCameraBuilder(); + var pers = + persBuilder + .SetCameraDirection(51.2, 2.4, 3.6) + .SetCameraUpVector(16.2, 2.4, 3.6) + .SetCameraViewPoint(71.2, 2.4, 3.6) + .SetFieldOfView(2.0) + .Build(); + + var vsHintBuilder = new ViewSetupHintsBuilder(); + var vsHint = + vsHintBuilder + .SetOpeningVisible(true) + .SetSpaceVisible(true) + .SetSpaceBoundariesVisible(true) + .Build(); + + var bitmapBuilder = new BitmapBuilder(); + var bitmap = + bitmapBuilder + .SetReference("reference") + .SetUp(19.2, 2.4, 3.6) + .SetFormat("Png") + .SetHeight(3.2) + .SetLocation(91.2, 2.4, 3.6) + .SetNormal(17.2, 2.4, 3.6) + .Build(); + var bitmaps = new List { bitmap, bitmap }; + + var coloringBuilder = new ComponentColoringColorBuilder(); + var coloring = + coloringBuilder + .SetColor("40E0D0") + .AddComponents(components) + .Build(); + var colorings = new List { coloring, coloring }; + + var clippingPlaneBuilder = new ClippingPlaneBuilder(); + var clippingPlane = + clippingPlaneBuilder + .SetLocation(1.22, 2.4, 3.6) + .SetDirection(1.32, 2.4, 3.6) + .Build(); + var clippingPlanes = new List { clippingPlane, clippingPlane }; + + var lineBuilder1 = new LineBuilder(); + var lineBuilder2 = new LineBuilder(); + + var line1 = + lineBuilder1 + .SetEndPoint(1.42, 2.4, 3.6) + .SetStartPoint(1.42, 4.4, 3.6) + .Build(); + + var line2 = + lineBuilder2 + .SetEndPoint(3.2, 2.4, 3.6) + .SetStartPoint(3.2, 4.4, 3.6) + .Build(); + + var lines = new List { line1, line2 }; + + var visualizationInfo = + visualizationInfoBuilder + .SetGuid("334b4df2-0187-49a9-8a4a-23992696bafd") + .SetPerspectiveCamera(pers) + .AddBitmaps(bitmaps) + .AddColorings(colorings) + .AddClippingPlanes(clippingPlanes) + .SetVisibility(compVis) + .AddSelections(components) + .AddLines(lines) + .Build(); + + var viewPointBuilder = new ViewPointBuilder(); + var viewPoint = + viewPointBuilder + .SetGuid("445b4df2-0187-49a9-8a4a-23992696bafd") + .SetIndex(0) + .SetSnapshot("snapshot") + .SetSnapshotData(new FileData { + Data = "aGVsbG8=" + }) + .SetViewPoint("viewpoint.bcfv") + .SetVisualizationInfo(visualizationInfo) + .Build(); + + var viewPoints = new List { viewPoint }; + + var bimSnippetBuilder = new BimSnippetBuilder(); + var bimSnippet = + bimSnippetBuilder + .SetReference("https://.../snippetExample.ifc") + .SetIsExternal(true) + .SetSnippetType("snippetType") + .SetReferenceSchema("refSchema") + .Build(); + + var projectInfoBuilder = new ProjectInfoBuilder(); + var project = + projectInfoBuilder + .SetProjectId("446b4df2-0187-49a9-8a4a-23992696bafd") + .SetProjectName("Test project") + .Build(); + + var documentBuilder = new DocumentBuilder(); + var documentData = new FileData { + Data = "aGVsbG8=" + }; + var doc = + documentBuilder + .SetDescription("desc") + .SetGuid("447b4df2-0187-49a9-8a4a-23992696bafd") + .SetFileName("NewIfc.ifc") + .SetDocumentData(documentData) + .Build(); + var docList = new List { doc }; + var docBuilder = new DocumentInfoBuilder(); + + var docInfo = + docBuilder + .AddDocuments(docList) + .Build(); + + var priorities = new List { "Low", "Critical", "High" }; + var users = new List { "john.wick@johnwick.com", "jim.carry@jim.com" }; + var stages = new List { "PreDesign", "Design" }; + var snippetTypes = new List { "snippetType1", "snippetType2" }; + var topicLabels = new List { "ARC", "STR" }; + var topicStatuses = new List { "Open", "Closed" }; + var topicTypes = new List { "Issue", "Warning", "Error" }; + + var extensionsBuilder = new ExtensionsBuilder(); + var extensions = + extensionsBuilder + .AddPriorities(priorities) + .AddUsers(users) + .AddStages(stages) + .AddSnippetTypes(snippetTypes) + .AddTopicLabels(topicLabels) + .AddTopicStatuses(topicStatuses) + .AddTopicTypes(topicTypes) + .Build(); + + var bcf = _builder + .SetProject(project) + .SetDocument(docInfo) + .SetExtensions(extensions) + .AddMarkup(m => m + .AddDocumentReferences(topicDocumentReferences) + .AddHeaderFiles(headers) + .AddReferenceLinks(referenceLinks) + .AddLabels(labels) + .AddComments(comments) + .AddViewPoints(viewPoints) + .SetTitle("Wall reposition issue") + .SetPriority("Critical") + .SetGuid("3ffb4df2-0187-49a9-8a4a-23992696bafd") + .SetCreationAuthor("john.wick@johnwick.com") + .SetModifiedAuthor("john.wick@johnwick.com") + .SetAssignedTo("jim.carry@jim.com") + .SetStage("Design") + .SetTopicType("Error") + .SetTopicStatus("Open") + .SetDescription("description") + .SetIndex(0) + .SetCreationDate(DateTime.Today) + .SetDueDate(DateTime.Today) + .SetModifiedDate(DateTime.Today) + .SetBimSnippet(bimSnippet)) + .Build(); + + await _converter.ToBcf(bcf, + "Resources/Bcf/v3.0/super30.bcfzip"); + } + + public async Task ReadBcf30FileTest() { + var samples = new List { + "Resources/Bcf/v3.0/super30.bcfzip" + }; + + var tasks = samples.Select(async path => { + await using var stream = + new FileStream(path, FileMode.Open, FileAccess.Read); + var bcf = await _worker.BcfFromStream(stream); + Assert.That(bcf.Version.VersionId, Is.EqualTo("3.0")); + }).ToArray(); + + await Task.WhenAll(tasks); + } +} \ No newline at end of file diff --git a/src/tests/Resources/Bcf/v2.1/super21.bcfzip b/src/tests/Resources/Bcf/v2.1/super21.bcfzip new file mode 100644 index 0000000..c42334f Binary files /dev/null and b/src/tests/Resources/Bcf/v2.1/super21.bcfzip differ diff --git a/src/tests/Resources/Bcf/v3.0/super30.bcfzip b/src/tests/Resources/Bcf/v3.0/super30.bcfzip new file mode 100644 index 0000000..8224554 Binary files /dev/null and b/src/tests/Resources/Bcf/v3.0/super30.bcfzip differ