Skip to content
Calculate 3d object volume, height, width, and depth. (C#/.NET Standard2.0 & .NET Core Global Tools)
C#
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Surveying3D.Cli
Surveying3D.Test
Surveying3D
.gitignore
LICENSE
README.md
Surveying3D.sln
memo.md

README.md

Surveying3D

Calculate the volume, height, width, and depth of the 3d object. This repository include NuGet package and cli. Currently only the wavefront obj format is supported, but glTF will also be supported.

Install

dotnet add package Surveying3D --version 1.0.0
dotnet tool install --global Surveying3D-Cli --version 1.0.1

If you have never used .NET Global Tools, set the path.

  • Linux/Mac
    • $HOME/.dotnet/tools
  • Windows
    • %USERPROFILE%\.dotnet\tools

Details are here.

How to use

Class library

The simplest usage is to give a path.

var results = Surveyor.Survey(pathToModel);

result includes volume, height, width and depth.

CLI

I prepared three commands.

  • test
    • This command takes the path of one object and outputs result to console or file.
  • list
    • This command takes a file containing the model path as input and outputs the result. A file with the model path can be created with "find ` pwd` -name * .obj ".
  • search
    • Search for models with the specified extension (default is obj) under the specified directory and get the results for those models.

If you start without command line arguments, you can see the following details.

$surveying3d

search: Search and measure models with the specified extension under the specified directory.
-d, -rootDirectory: search under root dir
-o, -outputDir: [default=null]output dir, The default output is not a file, but the console
-e, -extension: [default=obj]extension to search
-n, -outputFileName: [default=result.json]String

list: The path of the file describing the list of obj (for example, created with [find `pwd` -name *.obj])
[0]: Text path that describes the model file path.
-o, -outputDir: [default=null]output dir, The default output is not a file, but the console
-n, -outputFileName: [default=result.json]String

test: check one object
[0]: 3d object path
-o, -outputDir: [default=null]output dir, The default output is not a file, but the console
-n, -outputFileName: [default=result.json]output file name

⚠️Note

  • In wavefront obj, the surface can be defined with 3 or more points (triangle, square ...), but this algorithm assumes that the surface definition is 3 points (triangle).

  • If the face is not closed, the exact volume cannot be calculated.

External Library

You can’t perform that action at this time.