Giter VIP home page Giter VIP logo

rvmsharp's Introduction

RvmSharp

A library and utility for reading and converting RVM files.

Library supports .NET 8.0+ and .NET Standard 2.1

This repo also contains a pipeline for converting from Rvm to the Reveal file format. See CadRevealComposer

RvmSharp Dependencies

Usage

To read an RVM file:

using var stream = File.OpenRead(rvmFilename);
RvmFile rvmFile = RvmParser.ReadRvm(stream);
rvmFile.AttachAttributes(txtFilename);

To tessellate:

var rvmStore = new RvmStore();
rvmStore.RvmFiles.AddRange(rvmFiles);
RvmConnect.Connect(rvmStore);
RvmAlign.Align(rvmStore);
var leafs = rvmStore.RvmFiles.SelectMany(rvm => rvm.Model.Children.SelectMany(CollectGeometryNodes)).ToArray();

private static IEnumerable<RvmNode> CollectGeometryNodes(RvmNode root)
{
    if (root.Children.OfType<RvmPrimitive>().Any())
        yield return root;
    foreach (var geometryNode in root.Children.OfType<RvmNode>().SelectMany(CollectGeometryNodes))
        yield return geometryNode;
}

RvmSharp.Exe is a sample application using RvmSharp to process and export triangulated OBJ models.

# Run the command below to see the required arguments.
dotnet.exe run --configuration Release --project "RvmSharp.Exe/RvmSharp.Exe.csproj" -- --help # Replace '--help' with your arguments.

Cad Reveal Composer

The CAD Reveal Composer is a fast converter for RVM files into the Reveal formats used by the cognite/reveal 3D Viewer.

It can be invoked using the script below:

.\scripts\Convert-RvmToI3df.ps1 -InputDirectory $AFolderWithRvmAndTxtFiles -ProjectId 1 -ModelId 2 -RevisionId 1 -ArtifactDirectory $OutputDirectory 

Invoke from IDE

-i $AFolderWithRvmAndTxtFiles -o $OutputDirectory -ProjectId 1 -ModelId 2 -RevisionId 1 

Invoke from CLI

dotnet run -c Release --project "..\rvmsharp\CadRevealComposer.exe" -i $AFolderWithRvmAndTxtFiles -o $OutputDirectory --ProjectId 1 --ModelId 1 --RevisionId 1

Example Data

Equinor has published the Huldra dataset, including RVM files to the public.

https://data.equinor.com/dataset/Huldra

Visit this link and create a user to download a complete source dataset of an oil platform, including RVM files that can be used with rvmsharp.

Contribution

If you find some nice optimizations or tricks, do not hesitate to create an issue discussing if it should be contributed to the rvmsharp project.

While any contributions are appreciated please make an issue to discuss the approach before coding a major change. This helps both us and you set expectations :)

Formatting

We use csharpier for formatting.

You can run it manually by running the following in your command line.

dotnet tool restore
dotnet csharpier .

Install the addon for your IDE, and enable formatting when saving files to avoid spending time on formatting!

Remark:
You need to run dotnet tool restore to install and update csharpier for the IDE addons to work as expected.

Credits

This project is based on rvmparser by @cdyk

This repository contains sample data from the Equinor ASA - Huldra Dataset https://data.equinor.com/dataset/Huldra. A copy of the license can be found here.

rvmsharp's People

Contributors

argr1 avatar benjaminkjopkofoed avatar codethestuff avatar espenrl avatar minorai avatar strepto avatar vegasten avatar vero-so avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

strepto

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.