# Trying to export lpy model into MTG or XYZ coordinates

**URL:** <https://fspm.discourse.group/t/trying-to-export-lpy-model-into-mtg-or-xyz-coordinates/234>\
**Category:** Openalea\
**Created:** [November 14, 2023, 3:29pm UTC](https://fspm.discourse.group/t/trying-to-export-lpy-model-into-mtg-or-xyz-coordinates/234 "2023-11-14T15:29:28Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Francesca](https://dub1.discourse-cdn.com/flex005/user_avatar/fspm.discourse.group/francesca/32/25_2.png) [@Francesca](https://fspm.discourse.group/u/Francesca)\
**Post date:** [November 14, 2023, 3:29pm UTC](https://fspm.discourse.group/t/trying-to-export-lpy-model-into-mtg-or-xyz-coordinates/234/1 "2023-11-14T15:29:28Z")

</div>

Hello,  
I would like to export my Lpy model into some format in which my arhitecture can be understood by other people not familiar with LPy I don’t know if the best format is MTG or if there is a way to extract the spatial coordinates of my architecture.  
I was aproaching the problem using the YOUTUBE lessons from prof @godin ( MC 15 LPy Application Programming Interface and LPy Tools library) and I discovered the LPy tools ( [Point\_sampler documentation — lpy\_tools 0.1.0 documentation (inria.fr)](https://mosaic.gitlabpages.inria.fr/lpy_tools/point_sampler.html#instruction-for-using-the-point-sampler-on-any-virtual-l-py-plant-model).

However I really can’t manage to install lpy\_tools  
I tired with:  
1)

```auto
conda install lpy_tools -c mosaic -c fredboudon -c conda-forge 

```

as suggested here: [MOSAIC / lpy\_tools · GitLab (inria.fr)](https://gitlab.inria.fr/mosaic/lpy_tools)

1. 

```auto
conda install -c mosaic lpy_tools

```

as suggested here: [Lpy Tools :: Anaconda.org](https://anaconda.org/mosaic/lpy_tools)

I don’t know what I can do.  
can somebody help me?

Thanks so much  
Francesca

---

<div class="post-metadata">

**Author:** ![pradal](https://avatars.discourse-cdn.com/v4/letter/p/ba8739/32.png) [@pradal](https://fspm.discourse.group/u/pradal)\
**Post date:** [November 15, 2023, 8:25am UTC](https://fspm.discourse.group/t/trying-to-export-lpy-model-into-mtg-or-xyz-coordinates/234/2 "2023-11-15T08:25:07Z")

</div>

Hi Francesca,  
Nice to read you.  
With Fred(@fredboudon ), we have developed a full mapping between lpy and MTG in both directions (LPy to MTG and MTG 2 LPy). You can read the doc here : [9. Lsystem and MTGs — openalea.mtg 2.1.2 documentation](https://mtg.readthedocs.io/en/latest/user/lpy2mtg.html)  
And there are several examples in the test repository ([github.com/openalea/mtg/test](http://github.com/openalea/mtg/test))

```auto
from openalea.lpy import *
from openalea.mtg.io import lpy2mtg, mtg2lpy, axialtree2mtg, mtg2axialtree

exported_symbols = ['A', 'B', 'C']

def export_to_mtg(lstring):
  parameters = {}
  scales = {}
  for m in exported_symbols:
    mod = ModuleClass.get(m)
    scales[m] = mod.scale
    parameters[m] = mod.parameterNames
  return axialtree2mtg(lstring,scales,None,parameters)

```

To install lpy and mtg from openalea

```auto
conda install openalea.lpy openalea.mtg -c openalea3 -c conda-forge

```

---

<div class="post-metadata">

**Author:** ![godin](https://avatars.discourse-cdn.com/v4/letter/g/439d5e/32.png) [@godin](https://fspm.discourse.group/u/godin)\
**Post date:** [November 16, 2023, 4:04pm UTC](https://fspm.discourse.group/t/trying-to-export-lpy-model-into-mtg-or-xyz-coordinates/234/3 "2023-11-16T16:04:02Z")

</div>

Hi Francesca,

You can export your l-scenes as standard obj file just by saving it using a .dot extension:

scene.save(f’out/my\_plant.obj’)

Best  
Ch.

> > ![](https://dub1.discourse-cdn.com/flex005/user_avatar/fspm.discourse.group/francesca/45/25_2.png "Francesca") | [Francesca](https://fspm.discourse.group/u/francesca)  
> > November 14 |
> > 
> > - | - |
> 
> Hello,  
> I would like to export my Lpy model into some format in which my arhitecture can be understood by other people not familiar with LPy I don’t know if the best format is MTG or if there is a way to extract the spatial coordinates of my architecture.  
> I was aproaching the problem using the YOUTUBE lessons from prof [@godin](https://fspm.discourse.group/u/godin) ( MC 15 LPy Application Programming Interface and LPy Tools library) and I discovered the LPy tools ( [Point\_sampler documentation — lpy\_tools 0.1.0 documentation (inria.fr)](https://mosaic.gitlabpages.inria.fr/lpy_tools/point_sampler.html#instruction-for-using-the-point-sampler-on-any-virtual-l-py-plant-model).
> 
> However I really can’t manage to install lpy\_tools  
> I tired with:  
> 1)
> 
> ```auto
> conda install lpy_tools -c mosaic -c fredboudon -c conda-forge 
> 
> ```
> 
> as suggested here: [MOSAIC / lpy\_tools · GitLab (inria.fr)](https://gitlab.inria.fr/mosaic/lpy_tools)
> 
> 1. 
> 
> ```auto
> conda install -c mosaic lpy_tools
> 
> ```
> 
> as suggested here: [Lpy Tools :: Anaconda.org](https://anaconda.org/mosaic/lpy_tools)
> 
> I don’t know what I can do.  
> can somebody help me?
> 
> Thanks so much  
> Francesca
> 
> * * *
> 
> [Visit Topic](https://fspm.discourse.group/t/trying-to-export-lpy-model-into-mtg-or-xyz-coordinates/234/1) or reply to this email to respond.
> 
> To unsubscribe from these emails, [click here](https://fspm.discourse.group/email/unsubscribe/b75d1a96099453436ba9e46e8e2c615d5673d327b6e7380aa372379f128b301f).

Christophe Godin

Inria team MOSAIC ([Mosaic – Mathematical Modeling of Developmental Biology](https://team.inria.fr/mosaic))  
UMR RDP (Reproduction et Développement des Plantes),  
Univ Lyon, ENS de Lyon, UCB Lyon 1, CNRS, INRA, Inria  
Ecole Normale Supérieure de Lyon  
46 allée d’Italie  
69364 Lyon Cedex 07, France

tel: +33 4 72 72 88 26  
assist: + 33 4 72 72 80 37  
email : [christophe.godin@inria.fr](mailto:christophe.godin@inria.fr)

RDP: [Laboratoire Reproduction et DÉveloppement des Plantes - Vive les plantes !](http://www.ens-lyon.fr/RDP)

---

<div class="post-metadata">

**Author:** ![Francesca](https://dub1.discourse-cdn.com/flex005/user_avatar/fspm.discourse.group/francesca/32/25_2.png) [@Francesca](https://fspm.discourse.group/u/Francesca)\
**Post date:** [November 24, 2023, 12:57pm UTC](https://fspm.discourse.group/t/trying-to-export-lpy-model-into-mtg-or-xyz-coordinates/234/4 "2023-11-24T12:57:13Z")

</div>

Thanks so much @godin I succeded in export it as .obj.  
However I did not succed in export the mtg file @pradal the “ModuleClass.get(m)” output “none” and the rest of the code is aborted

anyway I hope that .obj file it’s ok for my purposes. thanks so much everyone

cheers,

Francesca

---

<div class="post-metadata">

**Author:** ![Francesca](https://dub1.discourse-cdn.com/flex005/user_avatar/fspm.discourse.group/francesca/32/25_2.png) [@Francesca](https://fspm.discourse.group/u/Francesca)\
**Post date:** [December 12, 2023, 2:14pm UTC](https://fspm.discourse.group/t/trying-to-export-lpy-model-into-mtg-or-xyz-coordinates/234/5 "2023-12-12T14:14:12Z")

</div>

Good afternoon,  
i succeded in exporting my model in .obj format. I am wandering if there a way to import, in lpy, another obj object.

thanks so much  
Francesca

---

<div class="post-metadata">

**Author:** ![godin](https://avatars.discourse-cdn.com/v4/letter/g/439d5e/32.png) [@godin](https://fspm.discourse.group/u/godin)\
**Post date:** [December 13, 2023, 8:44am UTC](https://fspm.discourse.group/t/trying-to-export-lpy-model-into-mtg-or-xyz-coordinates/234/6 "2023-12-13T08:44:20Z")

</div>

Dear Francesca,  
I am not sure I understand well your question. Can you explain why do you need to import .obj files in L-py ?  
Best,

Ch.

> > ![](https://dub1.discourse-cdn.com/flex005/user_avatar/fspm.discourse.group/francesca/45/25_2.png "Francesca") | [Francesca](https://fspm.discourse.group/u/francesca)  
> > December 12 |
> > 
> > - | - |
> 
> Good afternoon,  
> i succeded in exporting my model in .obj format. I am wandering if there a way to import, in lpy, another obj object.
> 
> thanks so much  
> Francesca
> 
> * * *
> 
> [Visit Topic](https://fspm.discourse.group/t/trying-to-export-lpy-model-into-mtg-or-xyz-coordinates/234/5) or reply to this email to respond.
> 
> To unsubscribe from these emails, [click here](https://fspm.discourse.group/email/unsubscribe/c760c7bc717e2d5a57609e9c6171eb877abca30053fc678688eded5ec4b58469).

Christophe Godin

Inria team MOSAIC ([Mosaic – Mathematical Modeling of Developmental Biology](https://team.inria.fr/mosaic))  
UMR RDP (Reproduction et Développement des Plantes),  
Univ Lyon, ENS de Lyon, UCB Lyon 1, CNRS, INRA, Inria  
Ecole Normale Supérieure de Lyon  
46 allée d’Italie  
69364 Lyon Cedex 07, France

tel: +33 4 72 72 88 26  
assist: + 33 4 72 72 80 37  
email : [christophe.godin@inria.fr](mailto:christophe.godin@inria.fr)

RDP: [Laboratoire Reproduction et DÉveloppement des Plantes - Vive les plantes !](http://www.ens-lyon.fr/RDP)
