Git Product home page Git Product logo

meshplot's People

Contributors

jiangzhongshi avatar karldd avatar mlamarre avatar mworchel avatar skoch9 avatar teseoch 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

meshplot's Issues

Unable to install using conda

Hello, I'm trying to install meshplot using conda and it fails as below. However, it did work on my other machine a few weeks ago.

$ conda install meshplot
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.

PackagesNotFoundError: The following packages are not available from current channels:

  - meshplot

Current channels:

  - https://repo.anaconda.com/pkgs/main/linux-64
  - https://repo.anaconda.com/pkgs/main/noarch
  - https://repo.anaconda.com/pkgs/r/linux-64
  - https://repo.anaconda.com/pkgs/r/noarch

To search for alternate channels that may provide the conda package you're
looking for, navigate to

    https://anaconda.org

and use the search bar at the top of the page.

Unable to mkserve meshplot example with current latest anaconda version

I'm trying to run this example to view a 3D model in a webpage and I'm getting this error:

(base) C:\MyFolder\Documentation\3D_WebViewer_DOC\meshplot>mkdocs serve
INFO - DeprecationWarning: Jupyter is migrating its paths to use standard platformdirs
given by the platformdirs library. To remove this warning and
see the appropriate new directories, set the environment variable
JUPYTER_PLATFORM_DIRS=1 and then run jupyter --paths.
The use of platformdirs will be the default in jupyter_core v6
File "C:\Anaconda3\lib\site-packages\jupyter_core\utils_init_.py", line 89, in deprecation
warnings.warn(message, DeprecationWarning, stacklevel=stacklevel + 1)
File "C:\Anaconda3\lib\site-packages\jupyter_client\connect.py", line 27, in
from jupyter_core.paths import jupyter_data_dir
INFO - DeprecationWarning: Support for bleach <5 will be removed in a future version of nbconvert
File "C:\Anaconda3\lib\site-packages\nbconvert\filters\strings.py", line 23, in
from nbconvert.preprocessors.sanitize import _get_default_css_sanitizer
File "C:\Anaconda3\lib\site-packages\nbconvert\preprocessors\sanitize.py", line 30, in
warnings.warn(
INFO - Building documentation...
INFO - DeprecationWarning: 5.x style template file passed 'C:\Anaconda3\lib\site-packages\mknotebooks\templates\custom_markdown.tpl'.
Use --template-name for the template directory with a index..j2 file and/or --template-file to denote a different
template.
File "C:\Anaconda3\lib\site-packages\traitlets\traitlets.py", line 1560, in _notify_observers
c(event)
File "C:\Anaconda3\lib\site-packages\nbconvert\exporters\templateexporter.py", line 239, in _template_file_changed
warnings.warn(
INFO - DeprecationWarning: Passing unrecognized arguments to
super(HTMLExporter).init(template_path=['C:\Anaconda3\lib\site-packages\mknotebooks\templates',
'C:\Users\mikes\AppData\Roaming\jupyter\nbconvert\templates\base',
'C:\Users\mikes\AppData\Roaming\Python\share\jupyter\nbconvert\templates\base',
'C:\Anaconda3\share\jupyter\nbconvert\templates\base', 'C:\ProgramData\jupyter\nbconvert\templates\base']).
object.init() takes exactly one argument (the instance to initialize)
This is deprecated in traitlets 4.2.This error will be raised in a future release of traitlets.
File "C:\Anaconda3\lib\site-packages\traitlets\config\configurable.py", line 86, in init
super().init(**kwargs)
File "C:\Anaconda3\lib\site-packages\traitlets\traitlets.py", line 1373, in init
warn(
INFO - Cleaning site directory
INFO - DeprecationWarning: relax_add_props kwargs of validate has been deprecated for security
reasons, and will be removed soon.

                Please explicitly use the `n_changes, new_notebook = nbformat.validator.normalize(old_notebook, ...)` if you wish to
                normalise your notebook. `normalize` is available since nbformat 5.5.0


          File "C:\Anaconda3\lib\site-packages\nbformat\validator.py", line 381, in _dep_warn
            warnings.warn(
          File "C:\Anaconda3\lib\site-packages\nbconvert\exporters\exporter.py", line 321, in
            nbformat.validate(nbc, relax_add_props=True)

INFO - DeprecationWarning: There is no current event loop
File "C:\Anaconda3\lib\site-packages\nbclient\util.py", line 47, in just_run
loop = asyncio.get_event_loop()
File "C:\Anaconda3\lib\asyncio\events.py", line 666, in get_event_loop
warnings.warn('There is no current event loop',
INFO - RuntimeWarning: Proactor event loop does not implement add_reader family of methods required for zmq. Registering an
additional selector thread for add_reader support via tornado. Use
asyncio.set_event_loop_policy(WindowsSelectorEventLoopPolicy()) to avoid this warning.
File "C:\Anaconda3\lib\site-packages\zmq\asyncio.py", line 58, in _get_selector_windows
warnings.warn(
File "C:\Anaconda3\lib\site-packages\zmq_future.py", line 679, in
self._get_loop()
INFO - DeprecationWarning: relax_add_props kwargs of validate has been deprecated for security
reasons, and will be removed soon.

                Please explicitly use the `n_changes, new_notebook = nbformat.validator.normalize(old_notebook, ...)` if you wish to
                normalise your notebook. `normalize` is available since nbformat 5.5.0


          File "C:\Anaconda3\lib\site-packages\nbformat\validator.py", line 381, in _dep_warn
            warnings.warn(
          File "C:\Anaconda3\lib\site-packages\nbconvert\exporters\exporter.py", line 321, in
            nbformat.validate(nbc, relax_add_props=True)

WARNING - Path 'css\ansi-colours.css' uses OS-specific separator ''. That will be unsupported in a future release. Please change it to
'/'.
WARNING - Path 'css\jupyter-cells.css' uses OS-specific separator ''. That will be unsupported in a future release. Please change it to
'/'.
WARNING - Path 'css\pandas-dataframe.css' uses OS-specific separator ''. That will be unsupported in a future release. Please change it
to '/'.
Traceback (most recent call last):
File "C:\Anaconda3\lib\runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Anaconda3\lib\runpy.py", line 86, in run_code
exec(code, run_globals)
File "C:\Anaconda3\Scripts\mkdocs.exe_main
.py", line 7, in
File "C:\Anaconda3\lib\site-packages\click\core.py", line 1128, in call
return self.main(*args, **kwargs)
File "C:\Anaconda3\lib\site-packages\click\core.py", line 1053, in main
rv = self.invoke(ctx)
File "C:\Anaconda3\lib\site-packages\click\core.py", line 1659, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "C:\Anaconda3\lib\site-packages\click\core.py", line 1395, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "C:\Anaconda3\lib\site-packages\click\core.py", line 754, in invoke
return _callback(*args, **kwargs)
File "C:\Anaconda3\lib\site-packages\mkdocs_main
.py", line 234, in serve_command
serve.serve(dev_addr=dev_addr, livereload=livereload, watch=watch, **kwargs)
File "C:\Anaconda3\lib\site-packages\mkdocs\commands\serve.py", line 83, in serve
builder(config)
File "C:\Anaconda3\lib\site-packages\mkdocs\commands\serve.py", line 76, in builder
build(config, live_server=live_server, dirty=dirty)
File "C:\Anaconda3\lib\site-packages\mkdocs\commands\build.py", line 320, in build
_build_theme_template(template, env, files, config, nav)
File "C:\Anaconda3\lib\site-packages\mkdocs\commands\build.py", line 118, in _build_theme_template
output = _build_template(template_name, template, files, config, nav)
File "C:\Anaconda3\lib\site-packages\mkdocs\commands\build.py", line 97, in build_template
output = template.render(context)
File "C:\Anaconda3\lib\site-packages\jinja2\environment.py", line 1301, in render
self.environment.handle_exception()
File "C:\Anaconda3\lib\site-packages\jinja2\environment.py", line 936, in handle_exception
raise rewrite_traceback_stack(source=source)
File "C:\Anaconda3\lib\site-packages\material\404.html", line 4, in top-level template code
{% extends "main.html" %}
File "C:\Anaconda3\lib\site-packages\material\main.html", line 4, in top-level template code
{% extends "base.html" %}
File "C:\Anaconda3\lib\site-packages\material\base.html", line 134, in top-level template code
{% block header %}
File "C:\Anaconda3\lib\site-packages\material\base.html", line 135, in block 'header'
{% include "partials/header.html" %}
File "C:\Anaconda3\lib\site-packages\material\partials\header.html", line 13, in top-level template code
{% include "partials/logo.html" %}
File "C:\Anaconda3\lib\site-packages\material\partials\logo.html", line 5, in top-level template code
logo
File "C:\Anaconda3\lib\site-packages\mkdocs\utils\filters.py", line 14, in url_filter
return normalize_url(value, page=context['page'], base=context['base_url'])
File "C:\Anaconda3\lib\site-packages\mkdocs\utils_init
.py", line 300, in normalize_url
path, is_abs = _get_norm_url(path)
TypeError: unhashable type: 'dict'

Are the libraries set of this example still relevant?

TraitError of a PerspectiveCamera instance

I did a reinstall of conda again, and meshplot keeps throwing errors. (I tried both Python 3.7 and 3.8)

The code snippet I run is simply:

import meshplot
import numpy as np
meshplot.plot(np.array([[0,0,0],[1,0,0],[0,1,0.]]), np.array([[0,1,2]]))
TraitError: The 'matrix' trait of a PerspectiveCamera instance contains a CFloat of a Matrix4 which expected a float, not the NoneType None.

The error log from Jupyterlab is the following

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
~/miniconda3/lib/python3.8/site-packages/traitlets/traitlets.py in validate(self, obj, value)
   2092         try:
-> 2093             value = float(value)
   2094         except Exception:

TypeError: float() argument must be a string or a number, not 'NoneType'

During handling of the above exception, another exception occurred:

TraitError                                Traceback (most recent call last)
~/miniconda3/lib/python3.8/site-packages/ipywidgets/widgets/widget.py in _handle_msg(self, msg)
    674                 if 'buffer_paths' in data:
    675                     _put_buffers(state, data['buffer_paths'], msg['buffers'])
--> 676                 self.set_state(state)
    677 
    678         # Handle a state request.

~/miniconda3/lib/python3.8/site-packages/ipywidgets/widgets/widget.py in set_state(self, sync_data)
    543                     from_json = self.trait_metadata(name, 'from_json',
    544                                                     self._trait_from_json)
--> 545                     self.set_trait(name, from_json(sync_data[name], self))
    546 
    547     def send(self, content, buffers=None):

~/miniconda3/lib/python3.8/site-packages/traitlets/traitlets.py in set_trait(self, name, value)
   1434                                 (cls.__name__, name))
   1435         else:
-> 1436             getattr(cls, name).set(self, value)
   1437 
   1438     @classmethod

~/miniconda3/lib/python3.8/site-packages/traitlets/traitlets.py in set(self, obj, value)
    576 
    577     def set(self, obj, value):
--> 578         new_value = self._validate(obj, value)
    579         try:
    580             old_value = obj._trait_values[self.name]

~/miniconda3/lib/python3.8/site-packages/traitlets/traitlets.py in _validate(self, obj, value)
    608             return value
    609         if hasattr(self, 'validate'):
--> 610             value = self.validate(obj, value)
    611         if obj._cross_validation_lock is False:
    612             value = self._cross_validate(obj, value)

~/miniconda3/lib/python3.8/site-packages/traitlets/traitlets.py in validate(self, obj, value)
   2470             return value
   2471 
-> 2472         value = self.validate_elements(obj, value)
   2473 
   2474         return value

~/miniconda3/lib/python3.8/site-packages/traitlets/traitlets.py in validate_elements(self, obj, value)
   2709                 v = t._validate(obj, v)
   2710             except TraitError as error:
-> 2711                 self.error(obj, v, error)
   2712             else:
   2713                 validated.append(v)

~/miniconda3/lib/python3.8/site-packages/traitlets/traitlets.py in error(self, obj, value, error, info)
    674                         "expected %s, not %s." % (self.name, chain,
    675                         error.args[1], describe("the", error.args[0])),)
--> 676             raise error
    677         else:
    678             # this trait caused an error

~/miniconda3/lib/python3.8/site-packages/traitlets/traitlets.py in validate_elements(self, obj, value)
   2707         for t, v in zip(self._traits, value):
   2708             try:
-> 2709                 v = t._validate(obj, v)
   2710             except TraitError as error:
   2711                 self.error(obj, v, error)

~/miniconda3/lib/python3.8/site-packages/traitlets/traitlets.py in _validate(self, obj, value)
    608             return value
    609         if hasattr(self, 'validate'):
--> 610             value = self.validate(obj, value)
    611         if obj._cross_validation_lock is False:
    612             value = self._cross_validate(obj, value)

~/miniconda3/lib/python3.8/site-packages/traitlets/traitlets.py in validate(self, obj, value)
   2093             value = float(value)
   2094         except Exception:
-> 2095             self.error(obj, value)
   2096         return _validate_bounds(self, obj, value)
   2097 

~/miniconda3/lib/python3.8/site-packages/traitlets/traitlets.py in error(self, obj, value, error, info)
    679             if self.name is None:
    680                 # this is not the root trait
--> 681                 raise TraitError(value, info or self.info(), self)
    682             else:
    683                 # this is the root trait

offline mode: save as html not working

Hi,

I tried on several machines (Linux & MacOS) with several different versions of the packages (jupyter/pythreejs/etc), in offline mode, the "save as html" function seems not working at this moment (the html saved is fully white). What could be the problem?

Some error messages in the generated .html:

  • Failed to load resource: net::ERR_FILE_NOT_FOUND, jupyter-threejs.js:1
  • Error serializing widget state attribute: camera
  • embed-amd.js:16 DOMException: Failed to execute 'structuredClone' on 'Window': # could not be cloned.
  • etc.

Thanks!

Save screenshots for plotting results

Hi meshplot,

Thank you for this amazing package. I find it a very useful tool to visualize results.

I have one question: Is there any method to capture the screenshots for a 2d plane? To be specific, I just want to transfer the uv plane to a PNG image. Thank you!

Error: "Failed to load model class 'RendererModel' from module 'jupyter-threejs'"

Hi,

I was trying to use the Jupyter Notebook tutorial in the examples. However I can't draw any graphics, no matter what I try, I always get the error "Failed to load model class 'RendererModel' from module 'jupyter-threejs'". I tried changing browsers, but that didn't solve the problem. I would like to know if there is a way to solve this problem?

Thank you in advance!

Failed to load model class 'RendererModel' from module 'jupyter-threejs'
Error: Script error for "jupyter-threejs"
http://requirejs.org/docs/errors.html#scripterror
at makeError (http://localhost:8888/static/components/requirejs/require.js?v=d37b48bb2137faa0ab98157e240c084dd5b1b5e74911723aa1d1f04c928c2a03dedf922d049e4815f7e5a369faa2e6b6a1000aae958b>7953b5cc60411154f593:168:17)
at HTMLScriptElement.onScriptError (http://localhost:8888/static/components/requirejs/require.js?v=d37b48bb2137faa0ab98157e240c084dd5b1b5e74911723aa1d1f04c928c2a03dedf922d049e4815f7e5a369faa2e6b6a1000aae958b7953b5cc60411154f593:1735:36)

image

Render type "OFFLINE" is not easily visualized

Heya.

Very useful library :)

The jupyter visualization is perfect, but I'm not a fan of using notebooks :). It would be convenient if the "OFFLINE" render mode opened a window rendering the HTML instead of just saving it to some local directory.

Has this functionality been explored or is this possible in lib today? Could default to open in the default browser or render in an "iframe" created by Tkinter. If this functionality is favoured I'd love to discuss here and I can help implement it if needed.

~ tom

Colorbar

Is it possible to get a colorbar while using meshplot?

meshplot.plot function not displaying mesh

When I call meshplot.plot function, instead of the mesh being displayed, I get just the following text displayed.
Renderer(camera=PerspectiveCamera(children=(DirectionalLight(color='white', intensity=0.6, position=(-0.016860โ€ฆ
A screenshot of demonstrating this issue:

image

I am running jupyter lab version 1.1.4

I am not sure what other information regarding my system setup would be helpful. If needed, I will be glad to provide it.

Unable to use meshplot on VSCode and Python 3.9

Hello,

As the title says, I'm unable to plot on a notebook using VSCode alongside Python 3.9. Specifically, I get the error(s) attached below.

image

When I click on the image, I get the following traceback (not sure if it is one though)

 at ph.loadClass (https://file+.vscode-resource.vscode-cdn.net/home/ramana/.vscode/extensions/ms-toolsai.jupyter-renderers-1.0.15/out/node_modules/%40vscode/jupyter-ipywidgets8/dist/ipywidgets.js:2:4099813)
    at ph.loadClass (https://file+.vscode-resource.vscode-cdn.net/home/ramana/.vscode/extensions/ms-toolsai.jupyter-renderers-1.0.15/out/node_modules/%40vscode/jupyter-ipywidgets8/dist/ipywidgets.js:2:4403287)
    at ph.loadModelClass (https://file+.vscode-resource.vscode-cdn.net/home/ramana/.vscode/extensions/ms-toolsai.jupyter-renderers-1.0.15/out/node_modules/%40vscode/jupyter-ipywidgets8/dist/ipywidgets.js:2:4097773)
    at ph._make_model (https://file+.vscode-resource.vscode-cdn.net/home/ramana/.vscode/extensions/ms-toolsai.jupyter-renderers-1.0.15/out/node_modules/%40vscode/jupyter-ipywidgets8/dist/ipywidgets.js:2:4094616)
    at ph.new_model (https://file+.vscode-resource.vscode-cdn.net/home/ramana/.vscode/extensions/ms-toolsai.jupyter-renderers-1.0.15/out/node_modules/%40vscode/jupyter-ipywidgets8/dist/ipywidgets.js:2:4092246)
    at ph.handle_comm_open (https://file+.vscode-resource.vscode-cdn.net/home/ramana/.vscode/extensions/ms-toolsai.jupyter-renderers-1.0.15/out/node_modules/%40vscode/jupyter-ipywidgets8/dist/ipywidgets.js:2:4091039)
    at https://file+.vscode-resource.vscode-cdn.net/home/ramana/.vscode/extensions/ms-toolsai.jupyter-renderers-1.0.15/out/node_modules/%40vscode/jupyter-ipywidgets8/dist/ipywidgets.js:2:4402511
    at g._handleCommOpen (https://file+.vscode-resource.vscode-cdn.net/home/ramana/.vscode/extensions/ms-toolsai.jupyter-2023.4.1011241018-linux-x64/out/webviews/webview-side/ipywidgetsKernel/ipywidgetsKernel.js:2:36493)
    at async g._handleMessage (https://file+.vscode-resource.vscode-cdn.net/home/ramana/.vscode/extensions/ms-toolsai.jupyter-2023.4.1011241018-linux-x64/out/webviews/webview-side/ipywidgetsKernel/ipywidgetsKernel.js:2:38387)

The closest to mine is #38. I tried out all suggestions from the comments, but no avail.

Would like to explicitly set view orientation

Congrats on a nice graphics library. I would like to disable mouse controls and explicitly set the object/view orientation via a quaternion or rotation matrix. I couldn't find that capability in the documentation or code. Would it be possible to have an example added?

Indices are mixed in `update_object` when coloring is `FaceColors`

Please see this issue in lib-igl.

In update_object, even if the same vertices are passed as an argument, the mesh is broken as the face indices are lost. The quick fix in the aforementioned issue is not a real fix as it loses the face-coloring function -- as the tutorial focuses on the geometry, it is a special workaround.

Quick fix line:

Actual line that breaks the mesh:

obj["geometry"].attributes["position"].array = v

`AttributeError: 'LineSegmentsGeometry' object has no attribute 'attributes'`

Hi,

The following code in OFFLINE mode raises an error AttributeError: 'LineSegmentsGeometry' object has no attribute 'attributes', though in JUPYTER one it renders good but with the same error.

import meshplot as mp
import numpy as np

mp.offline()  # comment in JUPYTER mode

v = np.array([
    [0, 0, 0],
    [1, 0, 0],
    [1, 1, 1],
    [2, 1, 0],
], dtype="float32")

f = np.array([
    [0, 1, 2],
    [1, 3, 2],
])

p = mp.plot(v, f, filename="example_1")
p.add_lines(v, v + 0.1)
p.save("example_2")

Jupyter free version

It would be nice to have the same viewer on an html generated file without the notebook.

A little bit like plotly

JupyterLab 3.x "Model not found" error

Heads up for the dev: I am trying out MeshPlot examples in latest JupyterLab 3.0, but unfortunately getting following error message:

Error displaying widget: model not found

All packages are installed correctly and jupyter lab extensions including pythreejs are enabled.

Observing 2 points instead of 1 when using add_points function

I observe 2 points in my scene after running the following line

plto.add_points(np.array([0.0,0.0,1.0]), shading={"point_size": 0.5, "point_color": "green"})
image

I have tried performing the same line without the CAD model I imported. I still observe 2 points instead of 1.

image

Normalisation doesn't seem to work

Seems to me that the 'normalize' option for the shading doesn't work.
After having a look at the helper functions in utils.py (lines 5-10) the problems seems to be here:

def get_colors(inp, colormap="viridis", normalize=True, vmin=None, vmax=None):
colormap = plt.cm.get_cmap(colormap)
if normalize:
vmin=np.min(inp)
vmax=np.max(inp)

I think that should be change in:

def get_colors(inp, colormap="viridis", normalize=True, vmin=None, vmax=None):
colormap = plt.cm.get_cmap(colormap)
if not normalize:
vmin=np.min(inp)
vmax=np.max(inp)

MeshViewer rendertype == "Website"

Hi!
This viewer works great when I tried it for jupyter notebook! I'd like to do more complex stuff in a different IDE like pycharm where I can debug more efficiently, and I can't get it to work. Doing some digging, I see I can either render it offline, on a website, or in jupyter. Is there any documentation for getting it to run on a webstie I could look at? How would that work? Could I have my code in pycharm, click, run, and an html file would be generated?
Thanks
Otman

Jupyter plot error

Hi,
I was trying to use the Jupyter Notebook tutorial you provide in the examples folder.
The data.npz file is correctly loaded, but the execution of the mp.ploy(v,f) command end with the following error ValueError: Out of range float values are not JSON compliant, raised when the OrbitControls are created by the Viewer.
I also report the whole stack trace below.
How can this error be solved?
Thank you in advance!

ValueError Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_6436/3157376963.py in
----> 1 mp.plot(v, f)
~\miniconda3\envs\meshplot\lib\site-packages\meshplot\plot.py in plot(v, f, c, uv, n, shading, plot, return_plot, filename, texture_data)
79 def plot(v, f=None, c=None, uv=None, n=None, shading={}, plot=None, return_plot=True, filename="", texture_data=None):#, return_id=False):
80 if not plot:
---> 81 view = Viewer(shading)
82 else:
83 view = plot
~\miniconda3\envs\meshplot\lib\site-packages\meshplot\Viewer.py in init(self, settings)
16 self._cam = p3s.PerspectiveCamera(position=[0, 0, 1], lookAt=[0, 0, 0], fov=self.__s["fov"],
17 aspect=self.__s["width"]/self.__s["height"], children=[self._light])
---> 18 self._orbit = p3s.OrbitControls(controlling=self._cam)
19 self._scene = p3s.Scene(children=[self._cam, self._light2], background=self.__s["background"])#"#4c4c80"
20 self._renderer = p3s.Renderer(camera=self._cam, scene = self._scene, controls=[self._orbit],
~\miniconda3\envs\meshplot\lib\site-packages\pythreejs\controls\OrbitControls_autogen.py in init(self, controlling, **kwargs)
27 def init(self, controlling=None, **kwargs):
28 kwargs['controlling'] = controlling
---> 29 super(OrbitControls, self).init(**kwargs)
30
31 _model_name = Unicode('OrbitControlsModel').tag(sync=True)
~\miniconda3\envs\meshplot\lib\site-packages\pythreejs\controls\Controls_autogen.py in init(self, **kwargs)
28
29 def init(self, **kwargs):
---> 30 super(Controls, self).init(**kwargs)
31
32 _model_name = Unicode('ControlsModel').tag(sync=True)
~\miniconda3\envs\meshplot\lib\site-packages\pythreejs_base\Three.py in init(self, **kwargs)
15
16 def init(self, **kwargs):
---> 17 super(ThreeWidget, self).init(**kwargs)
18 self.on_msg(self._on_potential_ret_val)
19
~\miniconda3\envs\meshplot\lib\site-packages\ipywidgets\widgets\widget.py in init(self, **kwargs)
413
414 Widget._call_widget_constructed(self)
--> 415 self.open()
416
417 def del(self):
~\miniconda3\envs\meshplot\lib\site-packages\ipywidgets\widgets\widget.py in open(self)
436 args['comm_id'] = self._model_id
437
--> 438 self.comm = Comm(**args)
439
440 @observe('comm')
~\miniconda3\envs\meshplot\lib\site-packages\ipykernel\comm\comm.py in init(self, target_name, data, metadata, buffers, **kwargs)
55 if self.primary:
56 # I am primary, open my peer.
---> 57 self.open(data=data, metadata=metadata, buffers=buffers)
58 else:
59 self._closed = False
~\miniconda3\envs\meshplot\lib\site-packages\ipykernel\comm\comm.py in open(self, data, metadata, buffers)
89 comm_manager.register_comm(self)
90 try:
---> 91 self._publish_msg('comm_open',
92 data=data, metadata=metadata, buffers=buffers,
93 target_name=self.target_name,
~\miniconda3\envs\meshplot\lib\site-packages\ipykernel\comm\comm.py in publish_msg(self, msg_type, data, metadata, buffers, **keys)
64 metadata = {} if metadata is None else metadata
65 content = json_clean(dict(data=data, comm_id=self.comm_id, **keys))
---> 66 self.kernel.session.send(self.kernel.iopub_socket, msg_type,
67 content,
68 metadata=json_clean(metadata),
~\miniconda3\envs\meshplot\lib\site-packages\jupyter_client\session.py in send(self, stream, msg_or_type, content, parent, ident, buffers, track, header, metadata)
828 if self.adapt_version:
829 msg = adapt(msg, self.adapt_version)
--> 830 to_send = self.serialize(msg, ident)
831 to_send.extend(buffers)
832 longest = max([len(s) for s in to_send])
~\miniconda3\envs\meshplot\lib\site-packages\jupyter_client\session.py in serialize(self, msg, ident)
702 content = self.none
703 elif isinstance(content, dict):
--> 704 content = self.pack(content)
705 elif isinstance(content, bytes):
706 # content is already packed, as in a relayed message
~\miniconda3\envs\meshplot\lib\site-packages\jupyter_client\session.py in json_packer(obj)
93
94 def json_packer(obj):
---> 95 return jsonapi.dumps(
96 obj,
97 default=json_default,
~\miniconda3\envs\meshplot\lib\site-packages\zmq\utils\jsonapi.py in dumps(o, **kwargs)
23 Keyword arguments are passed along to :py:func:json.dumps.
24 """
---> 25 return json.dumps(o, **kwargs).encode("utf8")
26
27
~\miniconda3\envs\meshplot\lib\json_init
.py in dumps(obj, skipkeys, ensure_ascii, check_circular, allow_nan, cls, indent, separators, default, sort_keys, **kw)
232 if cls is None:
233 cls = JSONEncoder
--> 234 return cls(
235 skipkeys=skipkeys, ensure_ascii=ensure_ascii,
236 check_circular=check_circular, allow_nan=allow_nan, indent=indent,
~\miniconda3\envs\meshplot\lib\json\encoder.py in encode(self, o)
197 # exceptions aren't as detailed. The list call should be roughly
198 # equivalent to the PySequence_Fast that ''.join() would do.
--> 199 chunks = self.iterencode(o, _one_shot=True)
200 if not isinstance(chunks, (list, tuple)):
201 chunks = list(chunks)
~\miniconda3\envs\meshplot\lib\json\encoder.py in iterencode(self, o, _one_shot)
255 self.key_separator, self.item_separator, self.sort_keys,
256 self.skipkeys, _one_shot)
--> 257 return _iterencode(o, 0)
258
259 def _make_iterencode(markers, _default, _encoder, _indent, _floatstr,
ValueError: Out of range float values are not JSON compliant

Adding transparency/opacity/alpha

Hi meshplot,
Have really benefited a lot from this library so thank you.
I'd like to visualise a mesh that is partially transparent. Is this option available already?

Happy to contribute something but I'm not sure where to start - at a complete guess I figure

material = p3s.MeshStandardMaterial(map=tex, reflectivity=sh["reflectivity"], side=sh["side"],
which (I think) instantiates the mesh from pythreejs. Looks like the pythreejs MeshStandardMaterial does have an option alphaMap to handle transparency.

Thanks!
Lewis

render directions

Hi,

Thanks for the great library.

Is there a way to show the xyz directions, as in the image attached?

Thank you!

image

pip installation

Hi,

Thanks for the great library.

I don't know if I'm wrong, but now the library is only installable via conda. Is there a plan to add pip support.

Thank you in advance.

Running in Google Colab

I'm trying to use meshplot in a Google Colab notebook, however when I use mp.plot instead of displaying the mesh all I get is:

<meshplot.Viewer.Viewer at 0x7f9ec04dfc88>

Is there any known way to get meshplot working in Colab?

Is there any way to advance time in offline website viewer, and keep it in one plot

Hi, I'm currently interested in having a mesh, and deforming it with time. The examples I've seen (using libigl with meshplot) , seem to not show the mesh object changing with time, but instead show snapshots of the mesh taken at a specific time.

What I'd like to do is have a mesh at the start of the simulation, run the simulation, and be able to see it deform in real time in the viewer. I can't seem to find any functionality for it in the source code, does it exist? Can you think of a workaround I could do instead?
Thanks

Change the default

possiblity to change the default settings.

EG:
I want to "always" plot without wireframe.

ambiguous color setup for a single tetrahedron

For a single tet, #f = #v = 4, how can I set up vertex color for a single tetrahedron?

The color setup rule is not valid for a single tet:

The key parameter c represents the vertex or face colors and can be one of the following:
A #v by 1 vector with one function value per vertex, which gets normalized and converted into vertex color values using the viridis colormap.
A #v by 3 vector with RGB color values per vertex. The color values should be in the range 0.0-1.0.
A single color value for all vertices in the form of a numpy array [R, G, B] in the range 0.0-1.0.
A #f by 1 vector with one function value per face, which gets normalized and converted into face color values using the viridis colormap.
A #f by 3 vector with RGB color values per face. The color values should be in the range 0.0-1.0.

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.