← Back to team overview

yade-users team mailing list archive

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

 

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

    Status: Needs information => Answered

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

thanks for making everything much more clear :-)

solution 1:
###
...
    def erase_outbox_sphere(self, box):
        import yade # even used inside yade, yadedatapost.py module knows nothing about yade, you have to import it
        for eb in O.bodies:
            if isinstance(eb.shape, yade.Sphere): # now yade.Sphere does the trick
...
###

you need either "ln -s" trick or (using Ubuntu or Debian operating
system) "sudo apt install python-yade"

solution 2:
###
# yadedatapost.py
Sphere = None # a global module variable, initially set to something irrelevant
...

# yade
...
import yadedatapost
yadedatapost.Sphere = Sphere # before using, set the global module variable to the correct value
...
###

cheers
Jan

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