← Back to team overview

yade-users team mailing list archive

Re: [Question #279256]: Yade documnetation

 

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

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


> my reference Documentation link:
> https://yade-dem.org/doc/Yade.pdf


thanks


>
>
> there are some more ambiguities:


> about question 1- : there are some functions in Class references(ch 8)
> that are repeated in Yade modules (ch9); although they are not the same but
> i can not understand the difference for a better selecting when coding:
>       class yade.wrapper.Sphere((object)arg1) (p.156)
>        yade.utils.sphere(center, radius, dynamic=None, fixed=False,
>  wire=False, color=None, highlight= False, material=-1, mask=1)  (p. 464)
>

be careful, that all commands are case sensitive, so sphere and Sphere are
completely different things :-) Sphere is a class inherited from Shape.
utils.sphere(...) is auxiliary function to create Body, whose shape is
Sphere:

#########
s = sphere((0,0,0),1)
print s
print s.shape
#########

Even if the name would be the same, the different "namespace" (yade.wrapper
or yade.utils) means, that it is different thing. you can try

#######
utils.Sphere = utils.sphere
print utils.Sphere
print yade.wrapper.Sphere
#######


> again such classes could be found about 'tetra'. what is the difference
> between s1 (an instance of  yade.wrapper.Sphere) and s2(an instance of
> yade.utils.sphere)
>
> 2- i found this example on page 6:
> Yade [96]: s=utils.sphere(center=[0,0,0],radius=1)
> ...
> Yade [99]: s.shape.radius
> ...
> as i have searched there is no 'radius' method for 'shape' class (p 151).
> how above command is correct?
>

In the example, "s" is instance of Body. Body has attributes e.g. state,
shape etc. s.shape can be any shape, but if it is created by utils.sphere
functions, s.shape is Sphere, and it has radius (you can find Sphere in
class reference). Also see my above comments

cheers
Jan

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