GithubHelp home page GithubHelp logo

orbingol / rw3dm Goto Github PK

View Code? Open in Web Editor NEW
32.0 5.0 11.0 183 KB

Rhino/OpenNURBS importer and exporter for NURBS-Python (geomdl)

License: MIT License

CMake 8.07% C++ 91.93%
rhino python opennurbs cmake bspline nurbs curve surface geomdl

rw3dm's Introduction

RW3DM - Rhino Extensions for NURBS-Python (geomdl)

Appveyor Status Azure Status

RW3DM project provides executables for exporting and importing OpenNURBS/Rhino .3DM files in JSON format. It utilizes OpenNURBS library for reading and writing .3DM files and JsonCpp for importing and exporting geomdl geometry data.

Installation and Updating RW3DM

Downloading RW3DM

You can download the precompiled Windows 64-bit binaries under Actions tab.

Compiling RW3DM

If you prefer to compile the binaries on your own, you can follow the following list as a reference:

  1. Clone the repository: git clone https://github.com/orbingol/rw3dm.git
  2. Change to the directory of the local repository: cd rw3dm
  3. Update submodules: git submodule update --init
  4. Create a build directory for CMake-generated files, e.g. mkdir build
  5. Enter the build directory, e.g. cd build
  6. Run CMake to generate build configuration files, e.g. cmake .. or use CMake GUI
  7. Compile and install
  • For Windows, you will find the Visual Studio project files under build directory.
  • After opening Visual Studio, choose Release from the build combobox, then right click on INSTALL and choose Rebuild
  • For Linux, run make install inside the build directory
  • The install directory will be build/install by default
  • You can modify the install directory using RW3DM_INSTALL_DIR variable while configuring the project with CMake
  1. Go to the install directory, e.g. cd install or the one you configured with CMake during step 6
  2. You will find the executables inside the install directory

Updating RW3DM

If you prefer to update the compiled binaries on your own, you can follow the following list as a reference:

  1. Pull the latest commits: git pull --rebase
  2. Update submodules: git submodule update
  3. Repeat steps from 5 to 9

Notes on installing and updating

For Windows

  • Visual Studio 2017 or newer is required to compile OpenNURBS
  • Please install C++ support on Visual Studio as it is not installed by default
  • Choose Release as the build configuration inside Visual Studio before you compile the package

For Linux

  • It is tested with gcc 7.3 and it should be compatible with any gcc version supporting C++17
  • Please remember to install the compiler packages for your Linux distribution

Using RW3DM

Reading .3DM files

on2json executable can be used to convert .3DM files to JSON format supported by geomdl. The JSON files can be imported via geomdl's exchange.import_json API call.

Writing .3DM files

json2on executable can be used to convert JSON format supported by geomdl to .3DM files. The JSON files can be exported via geomdl's exchange.export_json API call.

Available arguments

Run on2json and json2on to see the available command-line arguments:

  • extract_curves: Extract curves (Default is extract surfaces)
  • normalize: Normalize knot vectors and scale trim curves to [0,1] domain
  • sense: Extract surface and trim curve direction w.r.t. the face
  • show_config: Print the configuration
  • silent: Disable all printed messages
  • trims: Extract trim curves

Example: on2json MyONFile.3dm extract_curves=True, extracts curves from MyONFile.3dm

Author

License

rw3dm's People

Contributors

orbingol avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

rw3dm's Issues

[ERROR] Geometry data was NOT extracted successfully

Hi everyone!

I just followed instructions from README.md file on Compiling RW3DM part, that is clone project, update submodules, create and run CMake command into build directory, run make install command (I have both executables on2json and json2on into install directory).

But when I'm using the command ./on2json test.3dm, I have the followed answer:


ON2JSON: Geometry Extractor for Rhino/OpenNURBS (RW3DM v2.1.4)
OpenNURBS version: 7.0.20071.14390

[ERROR] Geometry data was NOT extracted successfully


I am using Ubuntu 20.04 and I didn't found any similar problem on the web.

Thank you.

How to use command line for on2json file?

I just type on2json MyONFile.3dm extract_curves=True in example(change it with my own filename)

it says on2json is not command line

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the solution you'd like
A clear and concise description of what you want to happen.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

json2on: Fix trim curve export

json2on can generate the trims of the BRep faces but it does not support converting inner trim curves from geomdl JSON to OpenNURBS .3dm format.

Difficulties in installing the 3dm Import Module

Describe the bug
CMake 3.13.2 gives out Error when following the Installing procedure.

To Reproduce
Steps to reproduce the behavior:

  1. Downloaded the repository to a local file, under a custom name
  2. Updated the submodules using Git Bash
  3. CMake gives out Error: "Error in configuration process, project files may be invalid"
    image

json2on.exe and json file format

It looks like the output from json2on.exe is wrong when you use the current json file format. The current json file format records the control points without multiplying coordinates by the weights. It seems that json2on.exe needs the control points with the weights applied. If you simply multiple the coordinates of the control points by the weight, then json2on.exe will produce the correct output.

To Reproduce

  1. Run the fiberInGroove.py script. This will output json file that should contain a cylindrical NURBS surface named fiberSurface.json.
  2. Run json2on.exe fiberSurface.json to produce fiberSurface.3dm
  3. Launch Rhino. Import fiberSurface.3dm and see that geometry is distorted because control points are not located correctly.
  4. Import fiberSurfaceMod3_Correct.json and see that it is semi-cylindrical surface. The control points in this .json file have been multiplied by the weights listed at the end of the .json file.

These screen snapshots illustrate the differences between the two json files.
RhinoScreenSnapshots.zip

Maybe you want to think about adding a switch to the export json function that allows you to select which version of control points to export?

on2json/json2on: command not found

When I applied the instructions, I am getting "command not found" on the terminal. Is there any missing point(s) on my side? I am not sure. What should I do?

Screenshot from 2021-07-02 14-32-39

Configuration:

  • Operating system: Ubuntu 20.04
  • CMake version: 3.16.3

A boundary area onto trimmed surface

I try to export a trimmed surface from python-nurbs library. However when I open the exported 3dm file, I saw a boundary that is covering the curve.

Screenshot (2641)
Is it normal to trimming operations?

Conversion of a .3dm file with a simple sphere into a geomdl-compatible .json fails

Im new to geomdl / rw3dm, facing some problems with converting primitives like e.g. a sphere from 3dm to json format.

The sphere is displayed in Rhino correctly.
However, after converting the 3dm file with on2sjon, and importing again with geomdl, the geometry is significantly different from what I would expect:

import os
from geomdl import NURBS
from geomdl import exchange
from geomdl.visualization import VisMPL as vis
Import surfaces

surfs = exchange.import_json("sph_r_0p5m.json")
Plot the control point grid and the evaluated surface

surfs[0].sample_size = 100
surfs[0].delta=0.05
surfs[0].vis = vis.VisSurface()
surfs[0].render()

geometry.zip -> 3dm and json file

I have tried to toggle normalize ... no effect.

Im grateful for any help, thanks!

geomdl
geometry.zip
rhino

on2json: Failed to convert solid CAD models to JSON

I tried to extract the surface control points of a solid model using the on2json executable, but the operation failed. After analysing the case, I found that rw3dm does not support converting solid models; instead, the same object is constructed using the NURBS surfaces and joined to form a solid will work fine.
Note: By solid model, I mean, cad models created by extruding from a curve etc.

bug.zip

Steps to reproduce the behaviour:

  1. I am attaching a sample .3DM file of a cuboid body.
  2. Run the on2json executable to extract only the surfaces: on2json cuboid.3dm extract_curves=false;
  3. The error screenshot is attached.

Cannot open file "xxx.3dm" for reading

Hi:

Thanks for the amazing library.

I got the following error message after running on2json.exe

[ERROR] Cannot open file 'egg.3dm' for reading
[ERROR] Geometry data was NOT extracted successfully

I wonder what this message means. Btw, The file was created by Rhino 7.

Thanks.

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.