< Back to IRCAM Forum

ModaLisp mesh files

Dear Forum,
I am having trouble trying to import a mesh file to create a finite element in ModaLisp. I tried to used the tract.mesh from the vocals example and other files as well. The documentation on the topic is old including its syntax. Also, there is no documentation on what format should the content of .mesh be. By reading some articles one can guess that it is the same type of file that is used to visualize polygons in Medit.

(setq myMesh (make-mesh ‘read-from-file “Examples/instruments/vocalys/tract.mesh”))
Error: Undefined operator make-mesh

  • Can someone post a working example with a simple polygon ?
  • Is the documentation being updated ?

Thanks

Dear Cluster5,

First sorry to get back to you with such a delay!
You’re right when you say that the doc for finite elements is somehow outdated. This is a department that we want to improve over the coming months.

I am working right now on a simple Modalys 3D example for you, and will post it later today.

Thanks for your patience,
Robert P.

Dear All,

tract.Mesh file itself is okay to load.
Somehow the direction function is not working.
Copy that .mesh file to root of Modalys folder and read directly from there.

Best,

Jae hyun Ahn

Hi again Cluster5,

Here is a working example which exhibit the basic principles.

I hope this helps and don’t hesitate to get back to us if it doesn’t.

Cheers,
Robert


Create a “test.lisp” file with the following content:

  
;;;-*-Mode: Lisp; Package: MODALYS -*-  

;;; - - - - - - - - - - - - - - - - - - - - - -  
;;; 3D object example - - - - - - - - - - - - -  
;;; a simple aluminium rectangular plate  - - -  
;;; made of 4x5 10cm squares, 2mm thick - - - -  
;;; It is then hit by a hammer  - - - - - - - -  
;;; - - - - - - - - - - - - - - - - - - - - - -  

(new)  

(setq plate (make-mesh 'read-from-file (make-pathname-in-directory-of-source-file "plate.mesh")))  

;; static 3D object view:  
;(view 'mesh plate)  

(setq alu-plate (make-object 'finite-element (mesh plate)  
                                                       (modes 40)  
                                                       ;(block hold)   
                                                       (young 7.4e10)   
                                                       (density 2790)  
                                                       (poisson 0.35)  
                                                       (freq-loss 0.1)  
                                                       (const-loss 0.1)))  

(compute-modes alu-plate)  

;; cinematic mode view example:  
;(view 'mode alu-plate 20 30 30)  

;; input (hammer) and output (ear):  
(setq alu-plate-in ( make-access alu-plate (const 5) 'normal ))   
(setq alu-plate-out ( make-access alu-plate (const 16) 'normal ))   
   
(setq my-hammer (make-object 'bi-two-mass))  

;;;  
;;; make strike connection  
;;;  

(setq hammer-ctrl (make-controller 'dynamic 1 0 (list 0.1)))  

(setq my-hammer-plk (make-access my-hammer (const 1) 'trans0))  

(make-connection 'strike alu-plate-in 0 my-hammer-plk .1 (const 0.01))  

;;;  
;;; make position connection to push hammer  
;;;  

(setq my-hammer-mov (make-access my-hammer (const 0) 'trans0))  

(make-connection 'position my-hammer-mov hammer-ctrl)  

;;;  
;;; make listening point on string  
;;;  

(make-point-output alu-plate-out)  

;;;  
;;; run the synthesis and play the sound  
;;;  

(setq list-dur (list 2 1 2 1 1 2 1 2))  
(setq speed-coef .2)  

(do ((i 0 (+ i 1))) ((= i (length list-dur)))  

	(set-breakpoint hammer-ctrl (list 0.01 -0.001))  
	(run 0.01)  
	(set-breakpoint hammer-ctrl (list 0.1 0.1))  
	(run (- (* (nth i list-dur) speed-coef) 0.01))  
)  

(run 10)  
(play)  

Also, create a file named “plate.mesh” in the same directory:

  
MeshVersionFormatted 1  
Dimension 3  
Vertices  
60  
         0          0          0 0  
         0          0      0.002 0  
         0        0.1          0 0  
         0        0.1      0.002 0  
         0        0.2          0 0  
         0        0.2      0.002 0  
         0        0.3          0 0  
         0        0.3      0.002 0  
         0        0.4          0 0  
         0        0.4      0.002 0  
       0.1          0          0 0  
       0.1          0      0.002 0  
       0.1        0.1          0 0  
       0.1        0.1      0.002 0  
       0.1        0.2          0 0  
       0.1        0.2      0.002 0  
       0.1        0.3          0 0  
       0.1        0.3      0.002 0  
       0.1        0.4          0 0  
       0.1        0.4      0.002 0  
       0.2          0          0 0  
       0.2          0      0.002 0  
       0.2        0.1          0 0  
       0.2        0.1      0.002 0  
       0.2        0.2          0 0  
       0.2        0.2      0.002 0  
       0.2        0.3          0 0  
       0.2        0.3      0.002 0  
       0.2        0.4          0 0  
       0.2        0.4      0.002 0  
       0.3          0          0 0  
       0.3          0      0.002 0  
       0.3        0.1          0 0  
       0.3        0.1      0.002 0  
       0.3        0.2          0 0  
       0.3        0.2      0.002 0  
       0.3        0.3          0 0  
       0.3        0.3      0.002 0  
       0.3        0.4          0 0  
       0.3        0.4      0.002 0  
       0.4          0          0 0  
       0.4          0      0.002 0  
       0.4        0.1          0 0  
       0.4        0.1      0.002 0  
       0.4        0.2          0 0  
       0.4        0.2      0.002 0  
       0.4        0.3          0 0  
       0.4        0.3      0.002 0  
       0.4        0.4          0 0  
       0.4        0.4      0.002 0  
       0.5          0          0 0  
       0.5          0      0.002 0  
       0.5        0.1          0 0  
       0.5        0.1      0.002 0  
       0.5        0.2          0 0  
       0.5        0.2      0.002 0  
       0.5        0.3          0 0  
       0.5        0.3      0.002 0  
       0.5        0.4          0 0  
       0.5        0.4      0.002 0  
Hexahedra  
20  
2 4 14 12 1 3 13 11 0  
4 6 16 14 3 5 15 13 0  
6 8 18 16 5 7 17 15 0  
8 10 20 18 7 9 19 17 0  
12 14 24 22 11 13 23 21 0  
14 16 26 24 13 15 25 23 0  
16 18 28 26 15 17 27 25 0  
18 20 30 28 17 19 29 27 0  
22 24 34 32 21 23 33 31 0  
24 26 36 34 23 25 35 33 0  
26 28 38 36 25 27 37 35 0  
28 30 40 38 27 29 39 37 0  
32 34 44 42 31 33 43 41 0  
34 36 46 44 33 35 45 43 0  
36 38 48 46 35 37 47 45 0  
38 40 50 48 37 39 49 47 0  
42 44 54 52 41 43 53 51 0  
44 46 56 54 43 45 55 53 0  
46 48 58 56 45 47 57 55 0  
48 50 60 58 47 49 59 57 0  
End  

Thank you so much Robert. This example works perfectly.
Is it possible to work with triangles instead of hexahedra ? If so, will the physical model respond the same way?

Thank you.

In theory, yes. But I do think it is way safer to deal with hexahedra for now.

Put on my list: check the code for triangles…

  • Robert

I’ve attached a mesh file with same specs* but using Quadrilaterals. Different results but the connection between faces is different. Nevertheless, it shouldn’t sound that different. (needs more modes of vibration)

  • 4x5, 10cm squares, 2mm thickness.
MeshVersionFormatted 1  
Dimension 3  
Vertices  
60  
-1.0 -1.0 0.0 0  
-0.6000000238418579 -1.0 0.0 0  
-0.19999998807907104 -1.0 0.0 0  
0.20000004768371582 -1.0 0.0 0  
0.6000000238418579 -1.0 0.0 0  
1.0 -1.0 0.0 0  
-1.0 -0.5 0.0 0  
-0.6000000238418579 -0.5 0.0 0  
-0.19999998807907104 -0.5 0.0 0  
0.20000004768371582 -0.5 0.0 0  
0.6000000238418579 -0.5 0.0 0  
1.0 -0.5 0.0 0  
-1.0 0.0 0.0 0  
-0.6000000238418579 0.0 0.0 0  
-0.19999998807907104 0.0 0.0 0  
0.20000004768371582 0.0 0.0 0  
0.6000000238418579 0.0 0.0 0  
1.0 0.0 0.0 0  
-1.0 0.5 0.0 0  
-0.6000000238418579 0.5 0.0 0  
-0.19999998807907104 0.5 0.0 0  
0.20000004768371582 0.5 0.0 0  
0.6000000238418579 0.5 0.0 0  
1.0 0.5 0.0 0  
-1.0 1.0 0.0 0  
-0.6000000238418579 1.0 0.0 0  
-0.19999998807907104 1.0 0.0 0  
0.20000004768371582 1.0 0.0 0  
0.6000000238418579 1.0 0.0 0  
1.0 1.0 0.0 0  
-1.0 -1.0 -0.0020000000949949026 0  
-0.6000000238418579 -1.0 -0.0020000000949949026 0  
-0.19999998807907104 -1.0 -0.0020000000949949026 0  
0.20000004768371582 -1.0 -0.0020000000949949026 0  
0.6000000238418579 -1.0 -0.0020000000949949026 0  
1.0 -1.0 -0.0020000000949949026 0  
-1.0 -0.5 -0.0020000000949949026 0  
-0.6000000238418579 -0.5 -0.0020000000949949026 0  
-0.19999998807907104 -0.5 -0.0020000000949949026 0  
0.20000004768371582 -0.5 -0.0020000000949949026 0  
0.6000000238418579 -0.5 -0.0020000000949949026 0  
1.0 -0.5 -0.0020000000949949026 0  
-1.0 0.0 -0.0020000000949949026 0  
-0.6000000238418579 0.0 -0.0020000000949949026 0  
-0.19999998807907104 0.0 -0.0020000000949949026 0  
0.20000004768371582 0.0 -0.0020000000949949026 0  
0.6000000238418579 0.0 -0.0020000000949949026 0  
1.0 0.0 -0.0020000000949949026 0  
-1.0 0.5 -0.0020000000949949026 0  
-0.6000000238418579 0.5 -0.0020000000949949026 0  
-0.19999998807907104 0.5 -0.0020000000949949026 0  
0.20000004768371582 0.5 -0.0020000000949949026 0  
0.6000000238418579 0.5 -0.0020000000949949026 0  
1.0 0.5 -0.0020000000949949026 0  
-1.0 1.0 -0.0020000000949949026 0  
-0.6000000238418579 1.0 -0.0020000000949949026 0  
-0.19999998807907104 1.0 -0.0020000000949949026 0  
0.20000004768371582 1.0 -0.0020000000949949026 0  
0.6000000238418579 1.0 -0.0020000000949949026 0  
1.0 1.0 -0.0020000000949949026 0  
Quadrilaterals  
40  
1 2 8 7 0  
2 3 9 8 0  
3 4 10 9 0  
4 5 11 10 0  
5 6 12 11 0  
7 8 14 13 0  
8 9 15 14 0  
9 10 16 15 0  
10 11 17 16 0  
11 12 18 17 0  
13 14 20 19 0  
14 15 21 20 0  
15 16 22 21 0  
16 17 23 22 0  
17 18 24 23 0  
19 20 26 25 0  
20 21 27 26 0  
21 22 28 27 0  
22 23 29 28 0  
23 24 30 29 0  
37 38 32 31 0  
38 39 33 32 0  
39 40 34 33 0  
40 41 35 34 0  
41 42 36 35 0  
43 44 38 37 0  
44 45 39 38 0  
45 46 40 39 0  
46 47 41 40 0  
47 48 42 41 0  
49 50 44 43 0  
50 51 45 44 0  
51 52 46 45 0  
52 53 47 46 0  
53 54 48 47 0  
55 56 50 49 0  
56 57 51 50 0  
57 58 52 51 0  
58 59 53 52 0  
59 60 54 53 0  
End  

Hi Cluster5,

It looks like your attachment didn’t get through…

Robert

For some reason the file is read and shows in the attachments’ section but does not upload. I edited the previous entry and pasted the data.
Thanks