← Back to team overview

yade-users team mailing list archive

[Question #680907]: Yade Class not find in a user defined python class

 

New question #680907 on Yade:
https://answers.launchpad.net/yade/+question/680907

I want to write a data-post class for the result from yade. In my class i used the Sphere class. But when i invoke my class in yade console, the Sphere class is not recognised.  I have looked up the information about Importing Yade in other Python applications. It says as following,  
    $ cd /path/where/you/want/yadeimport
    $ ln -s /path/to/yade/executable/yade-trunk yadeimport.py 
But when i do the second step, the error comes as "operation is not supported". 
Here is my code, 

for my class file named “yadedatapost.py”  
import numpy as np 
import os 
from yadeimport import *

class yadeDataPost:
    def __init__(self):
        pass 
def erase_outbox_sphere(self):
        for eb in O.bodies:
            if isinstance(eb.shape, Sphere):
                    O.bodies.erase(eb.id)


Then i start yade from terminal, input the following code, 
import sys 
sys.path.append('/mnt/hgfs/virpc/backup')
from yadedatapost import yadeDataPost 

dp1 = yadeDataPost()
dp1.erase_outbox_sphere() 

The error comes, No Sphere defined.  I know the critical step of creating a symbolic link is missing. 
Thanks. 

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