dzufferey / almond-x3dom-model-viewer

A simple 3D viewer that can be used with Almond (Scala Jupyter notebook)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

almond-x3dom-model-viewer

Version 0.2.3

A simple 3D viewer that can be used with Almond (Scala Jupyter notebook).

I have a bunch of projects around 3D modeling, printing, and milling for which I like to use Jupyter notebooks. I wanted to have a 3D viewer for these projects with the following requirements:

  • only scala
  • can be used though a Maven artifact: just add an extra library dependency to your build file, no extra installation requires.

X3DOM is used for the rendering. This is not the best but it is quite simple to use.

The projects for which I made this viewer:

  • scadla: a scala library for constructive solid geometry
  • libgcode: a scala library to create and manipulate G-code

Usage

First, you need to install Jupyter and Almond. This project currently uses Scala 2.13 but should also work with Scala 2.12.

To use it there is two options.

  1. Local version
  • clone this repository
  • run sbt publishLocal
  • add the following import in your notebook:
    import $ivy.`com.github.dzufferey::almond-x3dom-model-viewer:0.2.3`
    
  1. Remote version
  • add the address of the maven repo for the artifact:
    import coursierapi._
    interp.repositories() ++= Seq(MavenRepository.of("https://jitpack.io"))
    
  • in a following cell you can add the import:
    import $ivy.`com.github.dzufferey::almond-x3dom-model-viewer:0.2.3`
    

Then you can look in the example notebook to learn how to call the viewer.

ToDo

  • orthographic and normal projection
    • navigation/zoom with orthographic projection
    • preserve position when switching between the style of projections
    • shortcuts to pick front/back, left/right, top/bottom views
  • view
    • pick the initial zoom level/grid size according to object displayed
    • adapt the size of grid/axis according to the current view
    • different granularity of ticks for axis/grid, e.g., small every unit and bigger every 10 units
  • light
    • directional/head light as option

About

A simple 3D viewer that can be used with Almond (Scala Jupyter notebook)

License:Apache License 2.0


Languages

Language:Scala 84.4%Language:Jupyter Notebook 15.6%