GithubHelp home page GithubHelp logo

mcneel / rhino3dm Goto Github PK

View Code? Open in Web Editor NEW
598.0 56.0 134.0 226.95 MB

Libraries based on OpenNURBS with a RhinoCommon style

License: MIT License

CMake 0.34% C++ 17.51% Python 1.52% Batchfile 0.03% C 6.85% C# 73.66% Smalltalk 0.01% Shell 0.02% JavaScript 0.07%
opennurbs wasm python python3 rhino3d rhinocommon javascript-library hacktoberfest

rhino3dm's Introduction

rhino3dm

workflow ci workflow ci

PyPIPyPI - Downloads

NuGetNuGet Downloads

npmnpm

rhino3dm is a set of libraries based on the OpenNURBS geometry library with a "RhinoCommon" style. This provides the ability to access and manipulate geometry through .NET, Python or JavaScript applications independent of Rhino.

Functionality includes

  • Create, interrogate, and store all geometry types supported in Rhino. This includes points, point clouds, NURBS curves and surfaces, polysurfaces (B-Reps), meshes, annotations, extrusions, and SubDs.
  • Work with non-geometry classes supported in Rhino like layers, object attributes, transforms and viewports
  • Read and write all of the above information to and from the .3dm file format
  • Use as a client to make calls into the Rhino Compute cloud server for advanced manipulation of geometry objects
  • Available on most platforms (Windows, macOS, Linux)

rhino3dm.py (Python)

rhino3dm.py is a python package that can be used on all current versions of CPython (3.7 - 3.11) and is available on all platforms (Windows, macOS, Linux)

rhino3dm.js packages are available on pypi: https://pypi.org/project/rhino3dm/

pip install --user rhino3dm

See our python documentation for details

rhino3dm.js (JavaScript and node.js)

rhino3dm.js is a javascript library with an associated web assembly (rhino3dm.wasm). rhino3dm.js should run on all major browsers as well as node.js.

rhino3dm.js packages are available on npm: https://www.npmjs.com/package/rhino3dm

<!DOCTYPE html>

<body>

  <!-- Import maps polyfill -->
  <!-- Remove this when import maps will be widely supported -->
  <script async src="https://unpkg.com/[email protected]/dist/es-module-shims.js"></script>

  <script type="importmap">
      {
          "imports": {
            "rhino3dm":"https://unpkg.com/[email protected]/rhino3dm.module.min.js"
          }
      }
  </script>

  <script type="module">

    import rhino3dm from 'rhino3dm'
    const rhino = await rhino3dm()
    const sphere = new rhino.Sphere( [1,2,3,], 12 )
    console.log(sphere.diameter)

  </script>

</body>

</html>

See our javascript documentation for details

Rhino3dm.NET

Rhino3dm.NET (formerly known as Rhino3dmIO) allows you to write standalone .NET applications.

rhino3dm.net packages are available on nuget: https://www.nuget.org/packages/Rhino3dm/

From this repository we build macOS, windows, and linux packages in various runtimes which all all delivered via the nuget package.

More

Some more details and discussions can be found at:

rhino3dm's People

Contributors

acormier avatar arendvw avatar cdriesler avatar coditect avatar croudyj avatar dalefugier avatar dan-rigdon-bel avatar dancergraham avatar davidandresleon avatar dependabot[bot] avatar fraguada avatar geertarien avatar golsby avatar gtalarico avatar jesterking avatar jlasor avatar karimi avatar kovacsv avatar lfertig avatar matthewsorensen avatar michaelqxx avatar pearswj avatar pilcru avatar s3ththompson avatar sbaer avatar scotttd avatar spaceman007 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  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  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  avatar  avatar  avatar  avatar

Watchers

 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rhino3dm's Issues

unable to build on linux

same error with both py2.7 and py3.7, gcc-4, gcc-6, llvm-9

Failed to build rhino3dm
Installing collected packages: rhino3dm
    Running setup.py install for rhino3dm ... error
    ERROR: Command errored out with exit status 1:
     command: /sw/packages/external/python/2.7.13/platform-linux/arch-x86_64/os-CentOS-7/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-req-build-BYVT7S/setup.py'"'"'; __file__='"'"'/tmp/pip-req-build-BYVT7S/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-X_psU6/install-record.txt --single-version-externally-managed --prefix /sw/dev/maxnbk/packages/rhino3dm/0.10.0/platform-linux/arch-x86_64/os-CentOS-7/python-2.7 --no-compile
         cwd: /tmp/pip-req-build-BYVT7S/
    Complete output (108 lines):
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-2.7
    creating build/lib.linux-x86_64-2.7/rhino3dm
    copying src/rhino3dm/__init__.py -> build/lib.linux-x86_64-2.7/rhino3dm
    running egg_info
    writing src/rhino3dm.egg-info/PKG-INFO
    writing top-level names to src/rhino3dm.egg-info/top_level.txt
    writing dependency_links to src/rhino3dm.egg-info/dependency_links.txt
    reading manifest file 'src/rhino3dm.egg-info/SOURCES.txt'
    reading manifest template 'MANIFEST.in'
    warning: no files found matching '*.pyd' under directory 'src/rhino3dm'
    warning: no files found matching '*.so' under directory 'src/rhino3dm'
    writing manifest file 'src/rhino3dm.egg-info/SOURCES.txt'
    copying src/rhino3dm/__init__.pyi -> build/lib.linux-x86_64-2.7/rhino3dm
    copying src/rhino3dm/py.typed -> build/lib.linux-x86_64-2.7/rhino3dm
    warning: build_py: byte-compiling is disabled, skipping.

    running build_ext
    extdir = /tmp/pip-req-build-BYVT7S/build/lib.linux-x86_64-2.7/rhino3dm
    sourcedir/tmp/pip-req-build-BYVT7S
    -- The C compiler identification is GNU 6.3.1
    -- The CXX compiler identification is GNU 6.3.1
    -- Check for working C compiler: /opt/rh/devtoolset-6/root/usr/bin/cc
    -- Check for working C compiler: /opt/rh/devtoolset-6/root/usr/bin/cc -- works
    -- Detecting C compiler ABI info
    -- Detecting C compiler ABI info - done
    -- Detecting C compile features
    -- Detecting C compile features - done
    -- Check for working CXX compiler: /opt/rh/devtoolset-6/root/usr/bin/c++
    -- Check for working CXX compiler: /opt/rh/devtoolset-6/root/usr/bin/c++ -- works
    -- Detecting CXX compiler ABI info
    -- Detecting CXX compiler ABI info - done
    -- Detecting CXX compile features
    -- Detecting CXX compile features - done
    Python Compile
    -- Found PythonInterp: /sw/packages/external/python/2.7.13/platform-linux/arch-x86_64/os-CentOS-7/bin/python (found version "2.7.13")
    -- Found PythonLibs: /sw/packages/external/python/2.7.13/platform-linux/arch-x86_64/os-CentOS-7/lib/libpython2.7.so
    -- Performing Test HAS_CPP14_FLAG
    -- Performing Test HAS_CPP14_FLAG - Success
    -- pybind11 v2.4.3
    -- Performing Test HAS_FLTO
    -- Performing Test HAS_FLTO - Success
    -- LTO enabled
    -- Configuring done
    -- Generating done
    -- Build files have been written to: /tmp/pip-req-build-BYVT7S/build/temp.linux-x86_64-2.7
    make[3]: warning: jobserver unavailable: using -j1.  Add '+' to parent make rule.
    Scanning dependencies of target _rhino3dm
    [  0%] Building CXX object CMakeFiles/_rhino3dm.dir/bindings/base64.cpp.o
    [  0%] Building CXX object CMakeFiles/_rhino3dm.dir/bindings/bindings.cpp.o
    In file included from /tmp/pip-req-build-BYVT7S/src/bindings/../lib/opennurbs/opennurbs.h:53:0,
                     from /tmp/pip-req-build-BYVT7S/src/bindings/bindings.h:19,
                     from /tmp/pip-req-build-BYVT7S/src/bindings/bindings.cpp:1:
    /tmp/pip-req-build-BYVT7S/src/bindings/../lib/opennurbs/opennurbs_lock.h:118:44: error: use of deleted function ‘std::atomic<int>::atomic(const std::atomic<int>&)’
       std::atomic<int> m_lock_value = ON_Lock::UnlockedValue;
                                                ^~~~~~~~~~~~~
    In file included from /tmp/pip-req-build-BYVT7S/src/bindings/../lib/opennurbs/opennurbs_system.h:595:0,
                     from /tmp/pip-req-build-BYVT7S/src/bindings/../lib/opennurbs/opennurbs.h:29,
                     from /tmp/pip-req-build-BYVT7S/src/bindings/bindings.h:19,
                     from /tmp/pip-req-build-BYVT7S/src/bindings/bindings.cpp:1:
    /opt/rh/devtoolset-6/root/usr/include/c++/6.3.1/atomic:616:7: note: declared here
           atomic(const atomic&) = delete;
           ^~~~~~
    /opt/rh/devtoolset-6/root/usr/include/c++/6.3.1/atomic:620:17: note:   after user-defined conversion: constexpr std::atomic<int>::atomic(std::atomic<int>::__integral_type)
           constexpr atomic(__integral_type __i) noexcept : __base_type(__i) { }
                     ^~~~~~
    CMakeFiles/_rhino3dm.dir/build.make:75: recipe for target 'CMakeFiles/_rhino3dm.dir/bindings/bindings.cpp.o' failed
    make[5]: *** [CMakeFiles/_rhino3dm.dir/bindings/bindings.cpp.o] Error 1
    CMakeFiles/Makefile2:77: recipe for target 'CMakeFiles/_rhino3dm.dir/all' failed
    make[4]: *** [CMakeFiles/_rhino3dm.dir/all] Error 2
    Makefile:83: recipe for target 'all' failed
    make[3]: *** [all] Error 2
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-req-build-BYVT7S/setup.py", line 152, in <module>
        include_package_data=True
      File "/sw/packages/external/setuptools/41.4.0/python-2.7/lib/python2.7/site-packages/setuptools/__init__.py", line 145, in setup
        return distutils.core.setup(**attrs)
      File "/sw/packages/external/python/2.7.13/platform-linux/arch-x86_64/os-CentOS-7/lib/python2.7/distutils/core.py", line 151, in setup
        dist.run_commands()
      File "/sw/packages/external/python/2.7.13/platform-linux/arch-x86_64/os-CentOS-7/lib/python2.7/distutils/dist.py", line 953, in run_commands
        self.run_command(cmd)
      File "/sw/packages/external/python/2.7.13/platform-linux/arch-x86_64/os-CentOS-7/lib/python2.7/distutils/dist.py", line 972, in run_command
        cmd_obj.run()
      File "/sw/packages/external/setuptools/41.4.0/python-2.7/lib/python2.7/site-packages/setuptools/command/install.py", line 61, in run
        return orig.install.run(self)
      File "/sw/packages/external/python/2.7.13/platform-linux/arch-x86_64/os-CentOS-7/lib/python2.7/distutils/command/install.py", line 563, in run
        self.run_command('build')
      File "/sw/packages/external/python/2.7.13/platform-linux/arch-x86_64/os-CentOS-7/lib/python2.7/distutils/cmd.py", line 326, in run_command
        self.distribution.run_command(command)
      File "/sw/packages/external/python/2.7.13/platform-linux/arch-x86_64/os-CentOS-7/lib/python2.7/distutils/dist.py", line 972, in run_command
        cmd_obj.run()
      File "/sw/packages/external/python/2.7.13/platform-linux/arch-x86_64/os-CentOS-7/lib/python2.7/distutils/command/build.py", line 127, in run
        self.run_command(cmd_name)
      File "/sw/packages/external/python/2.7.13/platform-linux/arch-x86_64/os-CentOS-7/lib/python2.7/distutils/cmd.py", line 326, in run_command
        self.distribution.run_command(command)
      File "/sw/packages/external/python/2.7.13/platform-linux/arch-x86_64/os-CentOS-7/lib/python2.7/distutils/dist.py", line 972, in run_command
        cmd_obj.run()
      File "/tmp/pip-req-build-BYVT7S/setup.py", line 45, in run
        self.build_extension(ext)
      File "/tmp/pip-req-build-BYVT7S/setup.py", line 99, in build_extension
        system("make")
      File "/tmp/pip-req-build-BYVT7S/setup.py", line 20, in system
        raise RuntimeError('The command "{}" exited with {}'.format(cmd, rc))
    RuntimeError: The command "make" exited with 2

Rhino3DM JIT compilation dependent?

Are any elements of Rhino3DM relying on “just-in-time”(JIT) compilation at runtime?
Same question framed differently: does Rhino3DM support “Ahead-of-time”(AOT) compilation?

CircleCI: use scripts for javascript build

As of #189, we can now use:
script/boostrap.py --platform js (optional)
followed by:
script/setup.py --platform js --overwrite
followed by:
script/build.py --platform js --overwrite --verbose

This is (🤞) a more robust version of of src/build_javascript.py.

Once this is done, I believe src/build_javascript.py can be deleted.

Documentation is updated here:
https://github.com/mcneel/rhino3dm/blob/master/docs/javascript/RHINO3DM-BUILD.JS.md

I have only tested these scripts on macOS. If there are problems on linux, please let me know.

Use CMake 3.10.2 on Ubuntu and WSL

Only use the latest that is easy to install with sudo apt-get. We don't need a later version yet, as far as I know. This should simplify installation instructions.

Library for javascript dependent on browser

The rhino3dm module for javascript uses the btoa function on this line;

args['algo'] = btoa(definition);

That function is declared on the Window object of the browser and will not work on e.g. node.js.

For those who neea a workaround for node.js could be to declare the function if it does not exist:

if (typeof btoa === 'undefined') {
  global.btoa = function (str) {
    return Buffer.from(str, 'binary').toString('base64');
  };
}

No `constructor defined` for ...

Ran into this error when trying to create Plane and Interval
My goal was to create a rc.PlaneSurface

Are there any other ways of creating these objects in rhino3dm python?

>>> import rhino3dm as rc

>>> rc.Plane()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: rhino3dm._rhino3dm.Plane: No constructor defined!

>>> rc.Plane(rc.Point3d(0,0,0), rc.Vector3d(1,0,0))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: rhino3dm._rhino3dm.Plane: No constructor defined!
>>> 

I'm I crazy??

Why the hell can't I wrap this??

var rhino3dm = require('rhino3dm')

function init() {
	return new Promise((resolve, reject) => {
		rhino3dm()
		.then(rhino => {
			// resolve("some other return") this would resolve the promise
			resolve(rhino) // but not this
		})
	})
}

init()
.then(rhino => {
	// never gets here?!
	let sphere = new rhino.Sphere([1,2,3,], 12)
	console.log(sphere.radius)
})
.catch(err => {
	//...thenable returned by rhino doesn't define catch
})

Where is this weirdness coming from?
What am I missing here?

Thanks

Emscripten 1.39.6 breaks JavaScript build

At the end of the build I got the following error:

...
[100%] Linking CXX executable rhino3dm.html
shared:ERROR: Customizing EXPORT_NAME requires that the HTML be customized to use that name (see https://github.com/emscripten-core/emscripten/issues/10086)
CMakeFiles/rhino3dm.dir/build.make:6517: recipe for target 'rhino3dm.html' failed
make[2]: *** [rhino3dm.html] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/rhino3dm.dir/all' failed
make[1]: *** [CMakeFiles/rhino3dm.dir/all] Error 2
Makefile:129: recipe for target 'all' failed
make: *** [all] Error 2

This looks to be related to emscripten-core/emscripten@3043df9. It happens using both the old and new build scripts.

Tested on Ubuntu 18.04

$ python bootstrap.py -p js

Checking JavaScript Dependencies...

Checking Git...
  This system is running Git 2.17.1
  We are currently using Git 2.17.1
 OK: Git version 2.17.1 found.

Checking Python...
  This system is running Python 2.7.15
  We are currently using Python 2.7.17
 WARNING: Python version 2.7.15 found, an older version. We are currently using 2.7.17.  On Ubuntu, you can install python 2 using sudo apt install python

Checking Emscripten...
  This system is running Emscripten 1.39.5
  We are currently using Emscripten 1.39.5
 OK: Emscripten version 1.39.5 found.

Checking CMake...
  This system is running CMake 3.10.2
  We are currently using CMake 3.16.2
 WARNING: CMake version 3.10.2 found, an older version. We are currently using 3.16.2.  On Ubuntu, you can install CMake using: sudo snap install cmake --classic

No Access to XFormTransformation Data

There is no way to get the actual transformation data from the BND_Transform class (the corresponding function "ToFloatArray()" in bnd_xform.h, line 61, is not implemented). This makes it impossible to properly place instance references when reading from the 3dm file.

Point3d javascript bindings

Would be great to have more Point3d bindings for javascript to work with compute functions that have endpoints that take a Point3d.

Mesh method 'toThreejsJSON' converts mesh to Y-Axes up

When converting a rhino mesh to a threejs mesh the function assumes the target axes (Threejs) has the Y axes as a vertical, which is the default for Threejs.

There should be a way to configure the target axes configuration when converting from a Rhino mesh to a Threejs mesh, either as a function parameter or a new toThreejsJSON function.

Update Python installation instructions for linux

Based on the conversation in #121, I'm not sure we've got the right prerequisites listed for installing rhino3dm(.py) via pip on linux.

I believe the following are required:

  • python (well, duh! Python 2.7+ or 3.7+)
  • pip (or pip3)
  • cmake
  • gcc + g++

Needs a bit of testing and one liners writing for Ubuntu and Linux Mint (most common?) that install everything via apt. Some packages are pre-installed (such as gcc on Mint).

Install Issue

Hi,

➜  ~ python --version
Python 3.7.3
➜  ~ pip --version
pip 19.2.3 from /home/{username}/.local/lib/python3.7/site-packages/pip (python 3.7)

Ubunter 18.0.4.3

Might be me and my setup but, thought I'd report to see if it's something with rhino3dm itself. Looking over the errors I'm not sure how to track down the issues myself.

I get the following error if I run pip install rhino3dm, run it in Blender 2.8 python/pip version of python (where I want it) and or the direct release here on github (v0.1.6). Any thoughts on this by chance?

Thanks!

➜  ~ pip install rhino3dm
Collecting rhino3dm
  Using cached https://files.pythonhosted.org/packages/2d/4d/933b108e41988ad3987e5e1545b85a639578ec30ab332086dc13170645d3/rhino3dm-0.7.1.tar.gz
Building wheels for collected packages: rhino3dm
  Building wheel for rhino3dm (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /usr/bin/python3.7 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-fm04txvn/rhino3dm/setup.py'"'"'; __file__='"'"'/tmp/pip-install-fm04txvn/rhino3dm/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-028ni8kn --python-tag cp37
       cwd: /tmp/pip-install-fm04txvn/rhino3dm/
  Complete output (122 lines):
  /usr/lib/python3.7/distutils/dist.py:274: UserWarning: Unknown distribution option: 'long_description_content_type'
    warnings.warn(msg)
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-3.7
  creating build/lib.linux-x86_64-3.7/rhino3dm
  copying src/rhino3dm/__init__.py -> build/lib.linux-x86_64-3.7/rhino3dm
  running egg_info
  writing src/rhino3dm.egg-info/PKG-INFO
  writing dependency_links to src/rhino3dm.egg-info/dependency_links.txt
  writing top-level names to src/rhino3dm.egg-info/top_level.txt
  reading manifest file 'src/rhino3dm.egg-info/SOURCES.txt'
  reading manifest template 'MANIFEST.in'
  warning: no files found matching '*.pyd' under directory 'src/rhino3dm'
  warning: no files found matching '*.so' under directory 'src/rhino3dm'
  writing manifest file 'src/rhino3dm.egg-info/SOURCES.txt'
  copying src/rhino3dm/__init__.pyi -> build/lib.linux-x86_64-3.7/rhino3dm
  copying src/rhino3dm/py.typed -> build/lib.linux-x86_64-3.7/rhino3dm
  running build_ext
  Traceback (most recent call last):
    File "/tmp/pip-install-fm04txvn/rhino3dm/setup.py", line 32, in run
      out = subprocess.check_output(['cmake', '--version'])
    File "/usr/lib/python3.7/subprocess.py", line 395, in check_output
      **kwargs).stdout
    File "/usr/lib/python3.7/subprocess.py", line 472, in run
      with Popen(*popenargs, **kwargs) as process:
    File "/usr/lib/python3.7/subprocess.py", line 775, in __init__
      restore_signals, start_new_session)
    File "/usr/lib/python3.7/subprocess.py", line 1522, in _execute_child
      raise child_exception_type(errno_num, err_msg, err_filename)
  FileNotFoundError: [Errno 2] No such file or directory: 'cmake': 'cmake'
  
  During handling of the above exception, another exception occurred:
  
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "/tmp/pip-install-fm04txvn/rhino3dm/setup.py", line 147, in <module>
      include_package_data=True
    File "/home/nate/.local/lib/python3.7/site-packages/setuptools/__init__.py", line 129, in setup
      return distutils.core.setup(**attrs)
    File "/usr/lib/python3.7/distutils/core.py", line 148, in setup
      dist.run_commands()
    File "/usr/lib/python3.7/distutils/dist.py", line 966, in run_commands
      self.run_command(cmd)
    File "/usr/lib/python3.7/distutils/dist.py", line 985, in run_command
      cmd_obj.run()
    File "/usr/lib/python3/dist-packages/wheel/bdist_wheel.py", line 204, in run
      self.run_command('build')
    File "/usr/lib/python3.7/distutils/cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "/usr/lib/python3.7/distutils/dist.py", line 985, in run_command
      cmd_obj.run()
    File "/usr/lib/python3.7/distutils/command/build.py", line 135, in run
      self.run_command(cmd_name)
    File "/usr/lib/python3.7/distutils/cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "/usr/lib/python3.7/distutils/dist.py", line 985, in run_command
      cmd_obj.run()
    File "/tmp/pip-install-fm04txvn/rhino3dm/setup.py", line 36, in run
      ", ".join(e.name for e in self.extensions))
  RuntimeError: CMake must be installed to build the following extensions: rhino3dm/_rhino3dm
  Error in sys.excepthook:
  Traceback (most recent call last):
    File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 63, in apport_excepthook
      from apport.fileutils import likely_packaged, get_recent_crashes
    File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5, in <module>
      from apport.report import Report
    File "/usr/lib/python3/dist-packages/apport/report.py", line 30, in <module>
      import apport.fileutils
    File "/usr/lib/python3/dist-packages/apport/fileutils.py", line 23, in <module>
      from apport.packaging_impl import impl as packaging
    File "/usr/lib/python3/dist-packages/apport/packaging_impl.py", line 24, in <module>
      import apt
    File "/usr/lib/python3/dist-packages/apt/__init__.py", line 23, in <module>
      import apt_pkg
  ModuleNotFoundError: No module named 'apt_pkg'
  
  Original exception was:
  Traceback (most recent call last):
    File "/tmp/pip-install-fm04txvn/rhino3dm/setup.py", line 32, in run
      out = subprocess.check_output(['cmake', '--version'])
    File "/usr/lib/python3.7/subprocess.py", line 395, in check_output
      **kwargs).stdout
    File "/usr/lib/python3.7/subprocess.py", line 472, in run
      with Popen(*popenargs, **kwargs) as process:
    File "/usr/lib/python3.7/subprocess.py", line 775, in __init__
      restore_signals, start_new_session)
    File "/usr/lib/python3.7/subprocess.py", line 1522, in _execute_child
      raise child_exception_type(errno_num, err_msg, err_filename)
  FileNotFoundError: [Errno 2] No such file or directory: 'cmake': 'cmake'
  
  During handling of the above exception, another exception occurred:
  
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "/tmp/pip-install-fm04txvn/rhino3dm/setup.py", line 147, in <module>
      include_package_data=True
    File "/home/nate/.local/lib/python3.7/site-packages/setuptools/__init__.py", line 129, in setup
      return distutils.core.setup(**attrs)
    File "/usr/lib/python3.7/distutils/core.py", line 148, in setup
      dist.run_commands()
    File "/usr/lib/python3.7/distutils/dist.py", line 966, in run_commands
      self.run_command(cmd)
    File "/usr/lib/python3.7/distutils/dist.py", line 985, in run_command
      cmd_obj.run()
    File "/usr/lib/python3/dist-packages/wheel/bdist_wheel.py", line 204, in run
      self.run_command('build')
    File "/usr/lib/python3.7/distutils/cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "/usr/lib/python3.7/distutils/dist.py", line 985, in run_command
      cmd_obj.run()
    File "/usr/lib/python3.7/distutils/command/build.py", line 135, in run
      self.run_command(cmd_name)
    File "/usr/lib/python3.7/distutils/cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "/usr/lib/python3.7/distutils/dist.py", line 985, in run_command
      cmd_obj.run()
    File "/tmp/pip-install-fm04txvn/rhino3dm/setup.py", line 36, in run
      ", ".join(e.name for e in self.extensions))
  RuntimeError: CMake must be installed to build the following extensions: rhino3dm/_rhino3dm
  ----------------------------------------
  ERROR: Failed building wheel for rhino3dm
  Running setup.py clean for rhino3dm
Failed to build rhino3dm
Installing collected packages: rhino3dm
  Running setup.py install for rhino3dm ... error
    ERROR: Command errored out with exit status 1:
     command: /usr/bin/python3.7 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-fm04txvn/rhino3dm/setup.py'"'"'; __file__='"'"'/tmp/pip-install-fm04txvn/rhino3dm/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-v5ca8dv9/install-record.txt --single-version-externally-managed --compile
         cwd: /tmp/pip-install-fm04txvn/rhino3dm/
    Complete output (126 lines):
    /usr/lib/python3.7/distutils/dist.py:274: UserWarning: Unknown distribution option: 'long_description_content_type'
      warnings.warn(msg)
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.7
    creating build/lib.linux-x86_64-3.7/rhino3dm
    copying src/rhino3dm/__init__.py -> build/lib.linux-x86_64-3.7/rhino3dm
    running egg_info
    writing src/rhino3dm.egg-info/PKG-INFO
    writing dependency_links to src/rhino3dm.egg-info/dependency_links.txt
    writing top-level names to src/rhino3dm.egg-info/top_level.txt
    reading manifest file 'src/rhino3dm.egg-info/SOURCES.txt'
    reading manifest template 'MANIFEST.in'
    warning: no files found matching '*.pyd' under directory 'src/rhino3dm'
    warning: no files found matching '*.so' under directory 'src/rhino3dm'
    writing manifest file 'src/rhino3dm.egg-info/SOURCES.txt'
    copying src/rhino3dm/__init__.pyi -> build/lib.linux-x86_64-3.7/rhino3dm
    copying src/rhino3dm/py.typed -> build/lib.linux-x86_64-3.7/rhino3dm
    running build_ext
    Traceback (most recent call last):
      File "/tmp/pip-install-fm04txvn/rhino3dm/setup.py", line 32, in run
        out = subprocess.check_output(['cmake', '--version'])
      File "/usr/lib/python3.7/subprocess.py", line 395, in check_output
        **kwargs).stdout
      File "/usr/lib/python3.7/subprocess.py", line 472, in run
        with Popen(*popenargs, **kwargs) as process:
      File "/usr/lib/python3.7/subprocess.py", line 775, in __init__
        restore_signals, start_new_session)
      File "/usr/lib/python3.7/subprocess.py", line 1522, in _execute_child
        raise child_exception_type(errno_num, err_msg, err_filename)
    FileNotFoundError: [Errno 2] No such file or directory: 'cmake': 'cmake'
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-fm04txvn/rhino3dm/setup.py", line 147, in <module>
        include_package_data=True
      File "/home/nate/.local/lib/python3.7/site-packages/setuptools/__init__.py", line 129, in setup
        return distutils.core.setup(**attrs)
      File "/usr/lib/python3.7/distutils/core.py", line 148, in setup
        dist.run_commands()
      File "/usr/lib/python3.7/distutils/dist.py", line 966, in run_commands
        self.run_command(cmd)
      File "/usr/lib/python3.7/distutils/dist.py", line 985, in run_command
        cmd_obj.run()
      File "/home/nate/.local/lib/python3.7/site-packages/setuptools/command/install.py", line 61, in run
        return orig.install.run(self)
      File "/usr/lib/python3.7/distutils/command/install.py", line 589, in run
        self.run_command('build')
      File "/usr/lib/python3.7/distutils/cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "/usr/lib/python3.7/distutils/dist.py", line 985, in run_command
        cmd_obj.run()
      File "/usr/lib/python3.7/distutils/command/build.py", line 135, in run
        self.run_command(cmd_name)
      File "/usr/lib/python3.7/distutils/cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "/usr/lib/python3.7/distutils/dist.py", line 985, in run_command
        cmd_obj.run()
      File "/tmp/pip-install-fm04txvn/rhino3dm/setup.py", line 36, in run
        ", ".join(e.name for e in self.extensions))
    RuntimeError: CMake must be installed to build the following extensions: rhino3dm/_rhino3dm
    Error in sys.excepthook:
    Traceback (most recent call last):
      File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 63, in apport_excepthook
        from apport.fileutils import likely_packaged, get_recent_crashes
      File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5, in <module>
        from apport.report import Report
      File "/usr/lib/python3/dist-packages/apport/report.py", line 30, in <module>
        import apport.fileutils
      File "/usr/lib/python3/dist-packages/apport/fileutils.py", line 23, in <module>
        from apport.packaging_impl import impl as packaging
      File "/usr/lib/python3/dist-packages/apport/packaging_impl.py", line 24, in <module>
        import apt
      File "/usr/lib/python3/dist-packages/apt/__init__.py", line 23, in <module>
        import apt_pkg
    ModuleNotFoundError: No module named 'apt_pkg'
    
    Original exception was:
    Traceback (most recent call last):
      File "/tmp/pip-install-fm04txvn/rhino3dm/setup.py", line 32, in run
        out = subprocess.check_output(['cmake', '--version'])
      File "/usr/lib/python3.7/subprocess.py", line 395, in check_output
        **kwargs).stdout
      File "/usr/lib/python3.7/subprocess.py", line 472, in run
        with Popen(*popenargs, **kwargs) as process:
      File "/usr/lib/python3.7/subprocess.py", line 775, in __init__
        restore_signals, start_new_session)
      File "/usr/lib/python3.7/subprocess.py", line 1522, in _execute_child
        raise child_exception_type(errno_num, err_msg, err_filename)
    FileNotFoundError: [Errno 2] No such file or directory: 'cmake': 'cmake'
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-fm04txvn/rhino3dm/setup.py", line 147, in <module>
        include_package_data=True
      File "/home/nate/.local/lib/python3.7/site-packages/setuptools/__init__.py", line 129, in setup
        return distutils.core.setup(**attrs)
      File "/usr/lib/python3.7/distutils/core.py", line 148, in setup
        dist.run_commands()
      File "/usr/lib/python3.7/distutils/dist.py", line 966, in run_commands
        self.run_command(cmd)
      File "/usr/lib/python3.7/distutils/dist.py", line 985, in run_command
        cmd_obj.run()
      File "/home/nate/.local/lib/python3.7/site-packages/setuptools/command/install.py", line 61, in run
        return orig.install.run(self)
      File "/usr/lib/python3.7/distutils/command/install.py", line 589, in run
        self.run_command('build')
      File "/usr/lib/python3.7/distutils/cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "/usr/lib/python3.7/distutils/dist.py", line 985, in run_command
        cmd_obj.run()
      File "/usr/lib/python3.7/distutils/command/build.py", line 135, in run
        self.run_command(cmd_name)
      File "/usr/lib/python3.7/distutils/cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "/usr/lib/python3.7/distutils/dist.py", line 985, in run_command
        cmd_obj.run()
      File "/tmp/pip-install-fm04txvn/rhino3dm/setup.py", line 36, in run
        ", ".join(e.name for e in self.extensions))
    RuntimeError: CMake must be installed to build the following extensions: rhino3dm/_rhino3dm
    ----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python3.7 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-fm04txvn/rhino3dm/setup.py'"'"'; __file__='"'"'/tmp/pip-install-fm04txvn/rhino3dm/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-v5ca8dv9/install-record.txt --single-version-externally-managed --compile Check the logs for full command output.


Python: scripts should support python build target

Ironically, the python scripts in the scripts folder - bootstrap.py, setup.py, and build.py - do not yet support Python. This is because of the special need to generate the wheel for pip that is tied to the "other" setup.py script in the root folder of this repository. The setup.py script in the root folder is the "installer" for pypy.

One way we could better support the python target by wrapping them in the scripts would be to generate the (root) setup.py script from the scripts/setup.py script.

Use with Python 3.8.3

I am trying to use rhino3dm with FreeCAD. The version of python that FreeCAD uses is 3.8.3

If I try import rhino3dm it does not seem to recognise the module

`>>> import rhino3dm
Traceback (most recent call last):
File "", line 1, in
File "/Applications/FreeCAD_0.19.app/Contents/Resources/lib/python3.8/rhino3dm/init.py", line 5, in
from ._rhino3dm import *
ModuleNotFoundError: No module named 'rhino3dm._rhino3dm'

print(sys.version)
3.8.3 | packaged by conda-forge | (default, Jun 1 2020, 17:26:49)
[Clang 9.0.1 ]

Mesh vertex colours into Rhino3dm.js

I may be missing something but i can't find a way to get access to the mesh vertex colours in javascript? i.e. the Mesh.VertexColors collection?

Create Rhino3dm.iOS.csproj

Rhino3dm.iOS.csproj needs to be reworked to reference the librhino3dmio_native.a library we are building from script/build -p ios

Support for React

Attempting to initialize rhino3dm.js in a React App results in WASM compile fail.

(On Chrome 78.0.3904.97, React 16.11.0, Rhino3dm 0.8.1)

CompileError: WebAssembly.instantiate(): expected magic word 00 61 73 6d, found 3c 21 44 4f @+0

Is there a way around this?

Publish nuget package(s)

We should replace the Rhino3dmIO packages with a new Rhino3dm package built from this repo. The "desktop" package should support both .NET Framework and Core.

CMake support for all builds

gyp is working, but not keeping up with updates build tools. It is also fragile and not well documented.

We should switch to CMake for rhino3dm builds.

currently, gyp is called from this script:
/rhino/src4/DotNetSDK/rhinocommon/dotnet/Rhino3dmIO/script/setup

No constructor for `ViewInfo` in Python module

Thanks for the great work on this module, much appreciated.

Whilst using rhino3dm to generate a 3dm file containing a new geometry, I couldn't find a way to set the view the document should open with. The Views and NamedViews attributes of the file object are empty lists and I can't create a new ViewInfo object because there is no constructor method in the class.

Am I missing something or is the feature not implemented yet?

TypeScript type declarations

I'm using the rhino3dm.js library in a TypeScript project. It would be amazing if McNeel could generate TypeScript type declarations for this library, either bundled with the package or on DefinitelyTyped.

I've written some simple declarations for the File3dm class (included below), but something official would be much better, especially because the API docs are not always clear about the parameter/return types for methods.

// rhino3dm.d.ts
declare namespace RhinoAPI {
  // See https://mcneel.github.io/rhino3dm/javascript/api/File3dm.html
  class File3dm {
    applicationDetails: string;
    applicationName: string;
    applicationUrl: string;
    createdBy: string;
    lastEditedBy: string;
    revision: number;
    startSectionComments: string;

    dimstyles(): File3dmDimStyleTable;
    instanceDefinitions(): unknown;
    layers(): File3dmLayerTable;
    materials(): unknown;
    objects(): File3dmObjectTable;
    settings(): File3dmSettings;

    static fromByteArray(array: Uint8Array): File3dm;
  }

  // https://developer.rhino3d.com/api/RhinoCommon/html/T_Rhino_FileIO_CommonComponentTable_1.htm
  interface CommonComponentTable<T> {
    count(): number;
    clear(): void;
    delete(item: T): void;
    findId(id: Guid): T;
  }

  interface File3dmCommonComponentTable<T> extends CommonComponentTable<T> {
    add(item: T): void;
  }

  interface File3dmLayerTable extends File3dmCommonComponentTable<Layer> {
    findName(name: string, parentId: Guid): Layer | null;
    findIndex(i: number): Layer;
  }

  interface File3dmDimStyleTable extends File3dmCommonComponentTable<DimensionStyle> {
    findIndex(index: number): DimensionStyle;
    get(): DimensionStyle;
  }

  interface File3dmObjectTable {
    count: number;
    get(i: number): File3dmObject;
  }

  class Layer {
    id: Guid;
    name: string;
    parentLayerId: Guid;
  }

  class File3dmObject {
    attributes(): ObjectAttributes;
    geometry(): unknown;
  }

  interface ObjectAttributes {
    layerIndex: number;
  }

  class DimensionStyle {
    // (lots of properties here)
  }

  interface File3dmSettings {
    modelAbsoluteTolerance: number;
    modelAngleToleranceDegrees: number;
    modelAngleToleranceRadians: number;
    modelBasePoint: [number, number, number];
    modelRelativeTolerance: number;
    modelUnitSystem: number;
    modelUrl: string;
    pageAbsoluteTolerance: number;
    pageAngleToleranceDegrees: number;
    pageAngleToleranceRadians: number;
    pageRelativeTolerance: number;
    pageUnitSystem: number;
    renderSettings(): unknown;
  }

  type Guid = string;

  interface API {
    File3dm: typeof File3dm;
  }
}

declare module 'rhino3dm' {
  function loadRhino3dm(): RhinoAPI.API;
  export = loadRhino3dm;
}

bootstrap.py --platform js throws error on Emscripten check on WLS

python bootstrap.py --platform js throws an error when checking for Emscripten on Windows Linux Subsystem (but NOT on Ubuntu proper).

Traceback (from both Python 2 and 3):

Traceback (most recent call last):
   File "bootstrap.py", line 1049, in <module>
      main()
   File "bootstrap.py", line 1023, in main
      check_handler(target_platform, build_tools)
   File "bootstrap.py", line 787, in check_handler
      check_emscripten(build_tools["emscripten"])
   File "bootstrap.py", line 384, in check_emscripten
      print_error_message(err)
   File "bootstrap.py", line 80, in print_error_message
      print(bcolors.BOLD + bcolors.FAIL + error_prefix.upper() + bcolors.ENDC + bcolors.FAIL + error_message +
TypeError: must be str, not bytes

Unity Android Support

Support for Unity3D Android builds.

Using Rhino3dmIO in Unity works for testing and running things in editor, but I am currently facing issues when trying to build out an apk for android with Rhino3dmIO.Android. The error log trail leads me to believe it might be an issue with Mono.Android support in Rhino3dmIO.Android preventing a build with il2cpp backend.

If Rhino3dm.Net can be a substitute that helps address this issue, that would be great.

Create Rhino3dm.Android.csproj

Rhino3dm.Android.csproj needs to be reworked to reference the librhino3dmio_native.so library we are building from script/build -p android

build.py --platform js success check may be faulty

I recently failed to build the javascript library using:

python scripts/build.py --platform js -o -v

because there was a build error. However, the script reported success (and the error was suppressed). I suspect the check for success is looking for a file and it is finding an older build and reporting success when it should not. This can be tested by artificially introducing a build error in the code.

JavaScript: Adding a layer and geometry to a doc results in invalid .3dm file

In JavaScript I'm unable to create a document, add a layer and add an object (geometry) to that layer. The resulting file throws a "... is not a Rhino m_archive" error when opened in Rhino.

The following change to the sketch2d sample reproduces the error.

--- a/docs/javascript/samples/sketch2d/app.js
+++ b/docs/javascript/samples/sketch2d/app.js
@@ -35,6 +35,13 @@ function download3dm() {
   }
 
   let doc = new _rhino3dm.File3dm();
+
+  // create a custom layer
+  let layer = new _rhino3dm.Layer();
+  layer.name = 'example';
+  layer.color = { r: 248, g: 131, b: 121, a: 255 };
+  doc.layers().add(layer);
+
   for(let i=0; i<_model.curves.length;i++) {
     doc.objects().add(_model.curves[i], null);
   }

This python script works just fine...

import rhino3dm
import os

model = rhino3dm.File3dm()

layer = rhino3dm.Layer()
layer.Color = (255, 0, 0, 127)
layer.Name = 'example'

model.Layers.Add(layer)

model.Objects.AddPoint(0, 0, 0)

desktop = '/Users/will/Desktop'
filename = 'py_layer_test.3dm'
path = os.path.join(desktop, filename)

model.Write(path, 6)

print(path)

How to generate new nurbs curve when move the control point of the start and end control point

In CAD software , I interpolate a nurbs curve , now I want to move the control point of the start and end point , it means move the control point of the start and end control point ? Then how to generate a new nurbs curfve after move the start and end point of the nurbs curve, could return interpolate points of the new nurbs curve.
Could provide some c++、java or python code to realize this function?

WSL does not support snap: only use apt-get

WSL does not support snap to get packages. We should only recommend what is supplied by sudo apt-get package manager. For example, the python 2 version on WSL should be 2.7.15; not 2.7.17.

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.