Import txt format to YADE

Asked by Faqih Maarif

Dear All,

I have created a 2D-mesoscale model in concrete (aggregate, cement, void) and converting to the txt format. My question is how to import txt format to YADE?.
I was read from YADE FAQs related with this topic, but the link cannot open.

Could anyone give me some advice?
Thankyou

Regards,
Faqih

Question information

Language:
English Edit question
Status:
Solved
For:
Yade Edit question
Assignee:
No assignee Edit question
Solved by:
Wang Yu
Solved:
Last query:
Last reply:
Revision history for this message
Jan Stránský (honzik) said :
#1

Hello,

> converting to the txt format.

what is "txt format"? Do you have a short example / snippet?
What does "converting" mean (using some yade function? which? using your function?...?)?

> I was read from YADE FAQs related with this topic, but the link cannot open.

please provide the link to the FAQs and/or the link unable to open

cheers
Jan

Revision history for this message
Jérôme Duriez (jduriez) said :
#2

This [*] function reads some text file to create spherical bodies. If this is not the kind of text import you would like, please clarify (much -- which link ?) your question.

Note also that YADE is Python and, as such, all Python manipulation of text files are possible, eg [**].

[*] https://yade-dem.org/doc/yade.ymport.html#yade.ymport.text
[**] https://docs.python.org/3/tutorial/inputoutput.html#reading-and-writing-files

Revision history for this message
Faqih Maarif (faqih07) said :
#3

Dear Jan,
Thank you for your answer,

First, I tried modeling from the original image (using AutoCAD). Besides, I export points from AutoCAD to a .txt file. I want to convert from a .txt file using the YADE function to create a concrete cube-specimen(100x100mm). Is it possible?

Sorry for the unclear question before, I mean "converting" is the YADE function.
I do not know to upload .txt files here, the sample files as written below.

This is a code that I can't open.
[1] https://github.com/yade/trunk/tree/master/examples

Regards,
Faqih
---------------------------
Area Center X Center Y Center Z Diameter
0.0000 113.4991 44.0120 0.0000 0.0009
0.0000 113.5276 44.0125 0.0000 0.0010
0.0000 113.3772 44.0157 0.0000 0.0010
--------------------------

Revision history for this message
Faqih Maarif (faqih07) said :
#4

Dear Jerome,

Thank you very much for your answer.
I will try to do it.

The link as written :
[1] https://github.com/yade/trunk/tree/master/examples

Best Regards,
Faqih

Revision history for this message
Best Wang Yu (wangyu93) said :
#5

Hello,
In my recent simulation I used ymport.textExt('xxx.txt',format='x_y_z_r_attrs',attrs=attrs) to import particles information successfully. To do that, your 'file.txt' should follow the format(x_y_z_r_attrs).

For more detailed information you can read the 'ymport' section of the documentation.

I hope that helps.

Revision history for this message
Jan Stránský (honzik) said :
#6

Hello,

please consider that we have no knowledge of what you are doing..

> First, I tried modeling from the original image (using AutoCAD).

what is "the original image"?

> I export points from AutoCAD to a .txt file.

what are "points"?

> I want to convert from a .txt file using the YADE function to create a concrete cube-specimen(100x100mm).

what is "a .txt file"? "THE txt file?
what is "the YADE function"? "A Yade function?

> Is it possible?

most likely yes, just please describe your problem such that it is clear what should be possible..

> Sorry for the unclear question before

sorry, but you did not improve it much..

> I do not know to upload .txt files here

uploading file is not possible here. You can either copy-paste full content or (like in this case) a "representative part" of it

> This is a code that I can't open.
> [1] https://github.com/yade/trunk/tree/master/examples

please be more specific. This is a directory full of example scripts and other sub-directories full of example scripts..

> Area Center X Center Y Center Z Diameter
> 0.0000 113.4991 44.0120 0.0000 0.0009

What do the numbers mean? centers and diameter of spheres you want to import?

cheers
Jan

Revision history for this message
Jérôme Duriez (jduriez) said :
#7

About https://github.com/yade/trunk/tree/master/examples, this is because YADE source is no longer on github.com but now on gitlab.com => see https://gitlab.com/yade-dev/trunk/-/tree/master/examples

If you would be kind enough to tell us from where you stumbled upon this URL, maybe we could correct these wrong tracks ;-)

Revision history for this message
Faqih Maarif (faqih07) said :
#8

Thanks Wang Yu, that solved my question.

Revision history for this message
Faqih Maarif (faqih07) said :
#9

Dear Wang Yu,
Thank you for your answer.

Regards,
Faqih

Revision history for this message
Faqih Maarif (faqih07) said :
#10

Dear Jerome,
Thank you very much for help.
I am already solve the problem.

Regards,
Faqih

Revision history for this message
Faqih Maarif (faqih07) said :
#11

Hello Jan,

>what is "the original image"?
I forgot to say that the original image is x-ray tomography.

>what is "a .txt file"? "THE txt file?
Yes, correct, I mean the txt file.

>what is "the YADE function"? "A Yade function?
I will explain in another question.

>uploading file is not possible here. You can either copy-paste full content or (like in this case) a "representative part" of it.
Ok, I will create it to be a simple way.

> please be more specific. This is a directory full of example scripts and other sub-directories full of example scripts..
I got it from:
[1] https://answers.launchpad.net/yade/+question/265744

>What do the numbers mean? Centers and diameter of spheres you want to import?
Yes, I would like to import based on the data above. I already solve the problem.

Regards,
Faqih