Welcome to the forums. Please post in English or French.

You are not logged in.

#1 2019-10-24 13:41:23

GPSalachs
Member
Registered: 2018-03-10
Posts: 257

[SOLVED]How can i export nodes or node coordinates?

Hello all,

i would like to ask if it is possible to export in a python script inside the .comm file the nodes or nodes coordinates.
Where should i search for this particular operation?Through the documentation i might have missed something, are there
any suggestions?

Thank you.

Last edited by GPSalachs (2019-12-04 09:36:33)

Offline

#2 2019-10-28 08:06:45

konyaro
Member
From: Genève
Registered: 2016-04-02
Posts: 270

Re: [SOLVED]How can i export nodes or node coordinates?

Hello,
you can access the nodes coordinates with the following commands:

DEBUT(PAR_LOT='NON')
from Utilitai import partition

mesh0 = LIRE_MAILLAGE(FORMAT='MED',
                      UNITE=2)

mesh0=DEFI_GROUP(reuse=mesh0,
                 MAILLAGE=mesh0,
                 CREA_GROUP_MA=_F(NOM='tout', TOUT='OUI',),);    
                 
mesh1 = partition.MAIL_PY()
mesh1.FromAster('mesh0')
el_no = mesh1.gma.get('tout')

for el in el_no: 
    for node in mesh1.co[el]:    
        print('Node number: {!s}, coordinates: {!s}'.format(node, mesh1.cn[node]))
    
FIN()

Konyaro

Related topics:
- https://code-aster.org/forum2/viewtopic.php?id=23914
- Jean-Pierre's book: §18.4

Last edited by konyaro (2019-11-05 16:06:19)


失敗は成功のもと (L'échec est la base de la réussite)

Offline

#3 2019-11-05 12:20:21

GPSalachs
Member
Registered: 2018-03-10
Posts: 257

Re: [SOLVED]How can i export nodes or node coordinates?

Thank you very much for the code and the reference provided.
I have read and still reading  Jean Pierre's book but in a bible like that things are missed.
A question if i may. Since it is possible to extract node coordinates, is it also possible to extract the connecting lines coordinates too?

Thank you in advance!

Offline

#4 2019-12-14 05:50:15

konyaro
Member
From: Genève
Registered: 2016-04-02
Posts: 270

Re: [SOLVED]How can i export nodes or node coordinates?

Hello,
I don't think there are some direct information about the connecting lines. I printed print(dir(mesh1)) but found nothing relevant.

Konyaro


失敗は成功のもと (L'échec est la base de la réussite)

Offline

#5 2022-04-15 13:09:20

jeanpierreaubry
Guru
From: nantes (france)
Registered: 2009-03-12
Posts: 3,918

Re: [SOLVED]How can i export nodes or node coordinates?

hello konyaro and GPSalachs

unfortunately this throws the following message
from version 15 on

ModuleNotFoundError: No module named 'Utilitai'

i am still struggling to find out what could be the right alternative with today's version
in my opinion this is a major regression as i used that feature quite a lot do define loads and many other things

jean pierre aubry


consider reading my book
freely available here https://framabook.org/beginning-with-code_aster/

Offline

#6 2022-05-04 17:23:46

Matt141
Member
Registered: 2022-04-07
Posts: 22

Re: [SOLVED]How can i export nodes or node coordinates?

MAIL=LIRE_MAILLAGE(FORMAT='MED',);
xyz = np.asarray(MAIL.sdj.COORDO.VALE.get())
Nc = int(len(xyz)/3)
xyz = xyz.reshape((Nc, 3))

Offline