How to set a circle?

Asked by 孙灿

I want to use particles to form a circle, and these particles are combined along the circumference of the circle. How do I set it?

Question information

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

Hello,

once again, please read [1] and provide (much) more context and information.

Cheers
Jan

[1] https://www.yade-dem.org/wiki/Howtoask

Revision history for this message
孙灿 (suncan) said :
#2

In a two-dimensional context, I need to use particles to form a ring, as if it were a tire. The particle radius is 0.05, now I need to use these particles with a radius of 0.05 to form a circle with a radius of 1, note that only a circle with a radius of 1 is composed, and there are no particles inside this circle, just like the tire, the material makes up the outer part of the tire, but not inside.

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

It is already answered at your another question, [2], #12
Cheers
Jan

[2] https://answers.launchpad.net/yade/+question/700369

Revision history for this message
孙灿 (suncan) said :
#4

I saw another problem, but it wasn't solved very well and it turned out to not work.

Revision history for this message
孙灿 (suncan) said :
#5

The display result is: invalid syntax

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

>> It is already answered ...
> but it wasn't solved very well and it turned out to not work

What you asked is solved in [2], #12. I have just tried it again and got excellent ring of spherical particles.
If it is not what you want, then describe your problem better.

> The display result is: invalid syntax

solution: fix the invalid syntax

If you want a better answer, provide a better question.
In this case, provide the code causing the error ([1], point 3) and complete error ([1], point 2)

Cheers
Jan

[1] https://www.yade-dem.org/wiki/Howtoask
[2] https://answers.launchpad.net/yade/+question/700369

Revision history for this message
孙灿 (suncan) said :
#7

Can I use 0.bodies.append() for Generating ring. I think of facet.In addition,Can I use facetCylinder to generate a cylinder.

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

> Can I use 0.bodies.append() for Generating ring.

depends on the definition of "Generating" etc.

Definitely you do not use 0.anything, you would get "SyntaxError: invalid decimal literal". Use O (unicode u004f [3]) instead of 0 (unicode u0030 [4])

From my point of view, O.bodies.append is for adding already generated particles to simulation, not the command for generating. Although it could be accepted that adding to simulation is a part of generating.

> The particle radius is 0.05, now I need to use these particles with a radius of 0.05 to form a circle with a radius of 1
> I think of facet

Please be consistent

> I think of facet.In addition,Can I use facetCylinder to generate a cylinder.

Yes, using facetCylinder to create a cylinder made of facets is probably the best practice.

Cheers
Jan

[3] https://util.unicode.org/UnicodeJsps/character.jsp?a=0030
[4] https://util.unicode.org/UnicodeJsps/character.jsp?a=004f

Revision history for this message
孙灿 (suncan) said :
#9

> O.bodies.append is for adding already generated particles to simulation, not the command for generating. Although it could be accepted that adding to simulation is a part of generating.

I can see what you mean, but I find that I don't use O.bodies.append. In the run just now, I found that there was an error in my code, and this part of the code is as follows:

O.bodies.append(geom.facetCylinder(center(0,0,0),radius=1,height=2,orientation=Quaternion((0,1,0),segmentsNumber=10,wallMask=7)
sp = pack.SpherePack()
sp.makeCloud((0, 0, 0), (1, 1, 1), rMean=.05, rRelFuzz=0)
sp.toSimulation()

I think there's something wrong with my code.

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

> there's something wrong with my code

yes, as the error after running it suggest, there is SyntaxError: invalid syntax.
You have unbalanced brackets on the first line (different amount of left and right brackets), the interpreter then does not know how to interpret it.

What do you use for editing this python file? Any IDE or text editor for source codes should discover and emphasize this fact..

Cheers
Jan

Can you help with this problem?

Provide an answer of your own, or ask 孙灿 for more information if necessary.

To post a message you must log in.