ITISFoundation / osparc-issues

🐼 issue-only repo for the osparc project
3 stars 5 forks source link

Review tutorial (applications) #1462

Closed elisabettai closed 5 months ago

elisabettai commented 5 months ago

Tutorial: Introduction To CAD Modeling On o²S²PARC

In this tutorial you will learn how to view, edit and publish new versions of CAD models on the o²S²PARC Platform. We will first learn the basics and then explore a one more advanced use-case: the projection of an electrode onto a 3D nerve model.

Prerequisites

Getting Started

🚧 Before starting, be sure to be logged in o²S²PARC (by visiting https://osparc.io/). If you are not logged in, you will see an error message prompting you to log in.

Once you are logged in, you can start the CAD Modeling Service (Figure 1):

  1. Go to https://osparc.io/ and click on the "SERVICES" tab
  2. Type "CAD" in the search bar
  3. Click on the "CAD modeling" service
  4. Click on "Open" in the Service Details window

In this way, you create a new o²S²PARC Study containing one Interactive Service.

img Figure 1: start the CAD modeling Service on o²S²PARC (TODO: update screenshot with final version)

Importing An Existing CAD File

Once the CAD modeling Service is up and running, you can import a CAD file from your computer (see Figure 2):

  1. Click on the burger menu in the Service UI (top right corner)
  2. Select "File browser..."
  3. Click on the button "Upload file"
  4. Browse your local file system to find the file and select it (double click on it)
  5. You will see the file in the Service "File browser "
  6. Close the Service "File browser" (click on the :heavy_multiplication_x: button)
  7. In the Service UI, click on the "Imp/Export" button (top row in the UI), then on "Import"
  8. Select a file. Note: if you don't see the file, click on "All Supported Formats" and then Select "All Files (*)"
  9. If the operation was successful, you will see the model in the 3D view and the model elements on the left ("Modeling Tree"). If you don't see the model, click on "LOGGER" (bottom of the window) to check for errors

You are now ready to interact with the model, e.g. zooming on the 3D view, explore the model entities in the modeling tree, creating meshes of the entities, etc...

img Figure 2: import a local CAD file in the CAD modeling Service

Modifying A Geometry

Depending on the properties of the CAD file, the geometry can be constituted by sub-elements. The sub-elements can be expanded in the modeling tree and depending on their type, you can perform some operations on them.

When you click on an element in the modeling tree, it will be highlighted and also selected in the 3D view (Figure 3).

In the example below (Figure 3), we see that the "Implant Model" has five different elements, each one constituted by an elementary 2D geometry of the type "Rectangle".

To modify an elementary 2D geometry:

  1. Click on the element in the modeling tree
  2. A corresponding property window will appear below
  3. Edit any of the properties by clicking on it (e.g. "SizeX")
  4. Type a new value in the field
  5. On you keyboard, press "Enter" to confirm (or click anywhere in the window)

img Figure 3: main elements and operations in the modeling view

Saving The Study

If you want to keep your changes, you first need to save the model geometry and then the o²S²PARC Study. All the files that are in the workspace folder will be uploaded to the o²S²PARC cloud storage (and downloaded when you open the Study again).

We also recommend to change the name of your Study, so it will be easier to find it later. To rename it, just click on the editable study name field on the top of the window (Figure 3). The default name "CAD modeling" comes from the name of the Service that you used to create the Study.

To save your changes:

  1. Click on the burger button (Figure 3)
  2. Click on Save As...
  3. Enter a file name (the .smash file extension stores all the information regarding your model)
  4. Click on OK, this will save the model geometry
  5. In the upper part of the window, click on the "Dashboard" button and confirm
  6. The o²S²PARC Study will be saved and you will be back to the Dashboard

Once the saving operation has completed, you will be able to access your Study again or share it with your collaborators.

Advanced use-case: The Surface Projection Tool

The CAD Modeling Service offers advanced functionality for realistic modeling of nerves and neural interfaces, among others. In this section, we will use existing models of a nerve and an electrode and we will project the electrode around the nerve (a cuff electrode). You will also learn general concepts about tools and how to use them.

With the following steps, you can search for the desired tool using the search bar, find about its requirements and apply them (Figure 4).

  1. On the top part of the window, click on the search tool ("magnifying lens" icon)
  2. Type the name of the tool (e.g. "projection")
  3. Click on the search result on the left to display the tool documentation
  4. You will notice that the "Surface Projection" tool is grayed out, since its requirements are not met

To use the Surface Projection tool, you need a surface mesh of the entities (the electrode and nerve surfaces in this case) and then (Figure 4):

  1. In the Modeling Tree on the left, select the Electrode Surface (the meshed entity you want to project)
  2. While pressing "Shift" on your keyboard, select the Nerve Surface (the target meshed entity)
  3. You now have the two required elements to use the "Surface Projection" tool
  4. If you now search for the "Surface Projection" tool as above (point 4), it will now be active
  5. Select the tool and exit the search window (press "Esc" on your keyboard)
  6. In the 3D window, on the bottom, you will found instructions on how to use the tool
  7. Optionally, you can rotate the electrode. A preview of the final result will be shown
  8. Click on the button "Project" to apply the transformation and wait

img

Figure 4: find and use the Surface Projection tool to project a cuff electrode onto a nerve model

Once the task has completed, a new element will appear in the Modeling Tree and in the 3D view corresponding to the projected electrode (Figure 5).

img Figure 5: cuff electrode projected onto the nerve model

More information

If you would like to explore more functionality for CAD modeling and advanced electromagnetic simulations, please take a look the full cloud software release.

elisabettai commented 5 months ago

Anto's suggestions:

elisabettai commented 5 months ago

Video showing how to create surface meshes: s4l_mesh_electrode

And video for the projection tool with the same electrode showed in the first part. s4l_project_ok_2_ezgif_compressed