Re: [Yade-users] [Question #660999]: How to fill inside a gts file with spheres

2017-11-22 Thread Felipe
Question #660999 on Yade changed:
https://answers.launchpad.net/yade/+question/660999

Status: Answered => Open

Felipe is still having a problem:
Hello Jan,

Thanks for answering me so fast. By the way, i tried your comment above
and still not working. I may be not familiar with type of code and
that's why i did not get the same results than you.

Have you tried to simulate my script within your notes? If yes, could
you share me the full script that had worked?

Again, thanks for so fast to replying me.

Cheers,

Felipe

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.

___
Mailing list: https://launchpad.net/~yade-users
Post to : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp


Re: [Yade-users] [Question #660999]: How to fill inside a gts file with spheres

2017-11-22 Thread Jan Stránský
Question #660999 on Yade changed:
https://answers.launchpad.net/yade/+question/660999

Jan Stránský proposed the following answer:
Hi Felipe,

thanks for the gts file. The surface has wrong orientation. Just change
it by reversing order of edges of faces (i.e. switch 2nd and 3rd number
lines 1340-2007) and it works as expected.

 what I used to switch the numbers:
#
with open("felipe.gts") as f:
   lines = f.readlines()
flag = 0
for i,l in enumerate(lines):
   ls = l.split()
   if flag == 0 and len(ls)==2:
  flag = 1
   if flag == 1 and len(ls)==3:
  flag = 2
   if flag != 2:
  continue
   lines[i] = "{} {} {}\n".format(ls[0],ls[2],ls[1])
with open("felipe2.gts","w") as f:
   f.writelines(lines)
##

cheers
Jan

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.

___
Mailing list: https://launchpad.net/~yade-users
Post to : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp


Re: [Yade-users] [Question #660999]: How to fill inside a gts file with spheres

2017-11-22 Thread Jan Stránský
Question #660999 on Yade changed:
https://answers.launchpad.net/yade/+question/660999

Status: Open => Answered

Jan Stránský proposed the following answer:
Hi Felipe,

thanks for the gts file. The surface has wrong orientation. Just change
it by reversing order of edges of faces (i.e. switch 2nd and 3rd number
lines 1340-2007) and it works as expected.

 what I used to switch the numbers:
#
with open("felipe.gts") as f:
   lines = f.readlines()
flag = 0
for i,l in enumerate(lines):
   ls = l.split()
   if flag == 0 and len(ls)==2:
  flag = 1
   if flag == 1 and len(ls)==3:
  flag = 2
   if flag != 2:
  continue
   lines[i] = "{} {} {}\n".format(ls[0],ls[2],ls[1])
with open("felipe2.gts","w") as f:
   f.writelines(lines)
##

cheers
Jan

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.

___
Mailing list: https://launchpad.net/~yade-users
Post to : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp


Re: [Yade-users] [Question #660999]: How to fill inside a gts file with spheres

2017-11-22 Thread Felipe
Question #660999 on Yade changed:
https://answers.launchpad.net/yade/+question/660999

Felipe posted a new comment:
Hello Jan,

Please, see the link below. As soon as you got the answer for this
question, let me know because i am looking for the correct yade script
to do it.

https://www.dropbox.com/sh/ttqmryfp5gugsla/AAB7rkWKb2Pyb0fXGvWAe5wfa?dl=0

Thanks.

Felipe Thadeu

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.

___
Mailing list: https://launchpad.net/~yade-users
Post to : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp


Re: [Yade-users] [Question #660999]: How to fill inside a gts file with spheres

2017-11-22 Thread Felipe
Question #660999 on Yade changed:
https://answers.launchpad.net/yade/+question/660999

Status: Needs information => Open

Felipe gave more information on the question:
Hello Jan,

Please, see the link below. As soon as you got the answer for this
question, let me know because i am looking for the correct yade script
to do it.

https://www.dropbox.com/sh/ttqmryfp5gugsla/AAB7rkWKb2Pyb0fXGvWAe5wfa?dl=0

Thanks.

Felipe Thadeu

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.

___
Mailing list: https://launchpad.net/~yade-users
Post to : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp


Re: [Yade-users] [Question #661017]: call a class from yade

2017-11-22 Thread Jan Stránský
Question #661017 on Yade changed:
https://answers.launchpad.net/yade/+question/661017

Jan Stránský proposed the following answer:
Hello,

> ImportError: No module named myclass

it means that your main script ("another file") does not know where to look for 
myclass.py . What is location of myclass.py and the main script?
You can also try
###
import sys
sys.path.append('.')
###
before from myclass import simul

cheers
Jan

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.

___
Mailing list: https://launchpad.net/~yade-users
Post to : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp


Re: [Yade-users] [Question #661017]: call a class from yade

2017-11-22 Thread Deepak
Question #661017 on Yade changed:
https://answers.launchpad.net/yade/+question/661017

Status: Open => Answered

Deepak proposed the following answer:
Hi,

If I understand correctly, you intend to run yade under a ''pure python''
environment?  If that's the case you could have a look at these notes in
[1].  You might also want to look at how to instantiate an instance of your
class (having __init()__ method)[2].

An example of python script importing yade as a module is here [3] (this
script is based on one of the example scripts) [4]

[1]
https://yade-dem.org/doc/user.html#importing-yade-in-other-python-applications
[2]https://docs.python.org/2/tutorial/classes.html
[3]https://pastebin.com/J5FsRWQe
[4]
https://github.com/yade/trunk/blob/e4e757f2e98a620e3177b7a36a1d10f69f6a6a28/examples/concrete/triax.py


On Wed, Nov 22, 2017 at 6:08 PM, JOHN 
wrote:

> New question #661017 on Yade:
> https://answers.launchpad.net/yade/+question/661017
>
> Good evening,
> What i am trying to do is bundle the yade simulation in  a class which
> works
>
> from yade.pack import *
> from yade import ymport
> import math
> class simul():
> def run(self):
> O.bodies.append([
> sphere((0,0,4),1),
> sphere(center=(0,0,0),radius=.5,fixed=True)
> ])
>
> O.engines=[
> ForceResetter(),
> InsertionSortCollider([Bo1_Sphere_Aabb()]),
> InteractionLoop(
> [Ig2_Sphere_Sphere_ScGeom()],
> [Ip2_FrictMat_FrictMat_FrictPhys()],
> [Law2_ScGeom_FrictPhys_CundallStrack()]
> ),
> NewtonIntegrator(gravity=(0,0,-9.81),damping=0.1),
> ]
> O.dt=.5e-4*PWaveTimeStep()
>
>
>
> #simulation=simul()
> #simulation.run()
>
>
>
>
> and call it from another file
>
>
>
>
>
> import math
> import operator
> import gts
> from yade.pack import *
> from yade import ymport
>
>
> from myclass import simul
> simulation=simul()
> simulation.run()
>
>
>
> i get this
>
> yade run.py
>
> Welcome to Yade 1.20.0
> TCP python prompt on localhost:9000, auth cookie `ucsdsy'
> XMLRPC info provider on http://localhost:21000
> Running script run.py
> Traceback (most recent call last):
>   File "/usr/bin/yade", line 182, in runScript
> execfile(script,globals())
>   File "run.py", line 10, in 
> from myclass import simul
> ImportError: No module named myclass
> [[ ^L clears screen, ^U kills line. F12 controller, F11 3d view (use h-key
> for showing help), F10 both, F9 generator, F8 plot. ]]
> [0;34mYade [[1;34m1[0;34m]: [0m
>
>
> Thank you for the help
> (PS, amazing community)
>
>
>
> --
> You received this question notification because your team yade-users is
> an answer contact for Yade.
>
> ___
> Mailing list: https://launchpad.net/~yade-users
> Post to : yade-users@lists.launchpad.net
> Unsubscribe : https://launchpad.net/~yade-users
> More help   : https://help.launchpad.net/ListHelp
>

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.

___
Mailing list: https://launchpad.net/~yade-users
Post to : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp


[Yade-users] [Question #661017]: call a class from yade

2017-11-22 Thread JOHN
New question #661017 on Yade:
https://answers.launchpad.net/yade/+question/661017

Good evening,
What i am trying to do is bundle the yade simulation in  a class which works

from yade.pack import *
from yade import ymport
import math
class simul():
def run(self):
O.bodies.append([
sphere((0,0,4),1),
sphere(center=(0,0,0),radius=.5,fixed=True)
])

O.engines=[
ForceResetter(),
InsertionSortCollider([Bo1_Sphere_Aabb()]),
InteractionLoop(
[Ig2_Sphere_Sphere_ScGeom()],
[Ip2_FrictMat_FrictMat_FrictPhys()],
[Law2_ScGeom_FrictPhys_CundallStrack()]  
),
NewtonIntegrator(gravity=(0,0,-9.81),damping=0.1),
]
O.dt=.5e-4*PWaveTimeStep()



#simulation=simul()
#simulation.run()




and call it from another file





import math
import operator
import gts
from yade.pack import *
from yade import ymport


from myclass import simul
simulation=simul()
simulation.run()



i get this

yade run.py

Welcome to Yade 1.20.0 
TCP python prompt on localhost:9000, auth cookie `ucsdsy'
XMLRPC info provider on http://localhost:21000
Running script run.py
Traceback (most recent call last):
  File "/usr/bin/yade", line 182, in runScript
execfile(script,globals())
  File "run.py", line 10, in 
from myclass import simul
ImportError: No module named myclass
[[ ^L clears screen, ^U kills line. F12 controller, F11 3d view (use h-key for 
showing help), F10 both, F9 generator, F8 plot. ]]
[0;34mYade [[1;34m1[0;34m]: [0m


Thank you for the help
(PS, amazing community)



-- 
You received this question notification because your team yade-users is
an answer contact for Yade.

___
Mailing list: https://launchpad.net/~yade-users
Post to : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp


Re: [Yade-users] [Question #660999]: How to fill inside a gts file with spheres

2017-11-22 Thread Luis Barbosa
Question #660999 on Yade changed:
https://answers.launchpad.net/yade/+question/660999

Luis Barbosa posted a new comment:
Hi Felipe,

Why are you using dim0=aabb[1][0]-aabb[0][0]; radius=dimk0/40?
Perhaps this substraction is telling to remove particles inside the body, don't 
you think?

Cheers,
Luis

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.

___
Mailing list: https://launchpad.net/~yade-users
Post to : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp


Re: [Yade-users] [Question #660999]: How to fill inside a gts file with spheres

2017-11-22 Thread Jan Stránský
Question #660999 on Yade changed:
https://answers.launchpad.net/yade/+question/660999

Status: Open => Needs information

Jan Stránský requested more information:
Hi Felipe,

> Hope i have provided all information

yes, thanks, the info provided is very good. Please add one more detail, the 
specific filename.gts such that we can try it ourselves (Launchpad does not 
allow attachments to questions, please put it somewhere to the internet, e.g. 
dropbox, and put a link here)
thanks
Jan

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.

___
Mailing list: https://launchpad.net/~yade-users
Post to : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp