rotate a GTS surface

Asked by jacopo

hi, i import a gts surface. I'm able to translate it but i'm not able to rotate. i would like to rotate this surface about 90 degrees around x axes, and then about 180 degrees around y axis. I tryied with this code only for the first rotation (x axes), but it doesn't work. I used rotation engine but i have the following error:

Traceback (most recent call last):
  File "/usr/bin/yade", line 182, in runScript
    execfile(script,globals())
  File "creazione.py", line 31, in <module>
    zeroPoint=[0,0,0]),
TypeError: No registered converter was able to produce a C++ rvalue of type std::vector<int, std::allocator<int> > from this Python object of type gts.Surface

this is the code: is really simply till now and i used the trunk example:

###################################################
###################################################

from yade import pack,qt
import gts, locale

locale.setlocale(locale.LC_ALL, 'en_US.UTF-8')

s1=gts.read(open('aereo.gts'))
s2=gts.Surface(); s2.translate(0,0,100)
O.bodies.append(pack.gtsSurface2Facets(s1,color=(0,1,0))+pack.gtsSurface2Facets(s2,color=(1,0,0)))

O.bodies.append(pack.gtsSurface2Facets(s2,color=(0,0,1)))

rotvel=100
O.engines=[

RotationEngine(
ids=s2,
angularVelocity=rotvel,
rotationAxis=[1,0,0],
rotateAroundZero=True,
label='srotation',
zeroPoint=(0,0,0)),
]

i know that using this way i'll not be able to stop it when the surface rotated exacly of 90 degree, but i want to go by step. Before, i want to be able to start this rotation, then i'll see how can i stop it. I saw some questions on Lounchpad that could help me. If you think exist an easier way, please tell me.

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
Jérôme Duriez (jduriez) said :
#1

Hi,

I think the error you provided does not match with the code you provided : there is no zeroPoint=[0,0,0] (mentioned by the error) in the code but a zeroPoint=(0,0,0).

Could you please check ?

Revision history for this message
jacopo (varrialeee) said :
#2

Yes you re right, IT S Becouse i tryied Also with (0,0,0) And i pasted IT, i was trying in different way, But The ERROR Is still The same. Could be that Is wrong The Logic of The code?

Revision history for this message
jacopo (varrialeee) said :
#3

Yes you re right, IT S Becouse i tryied Also with (0,0,0) And i pasted IT, i was trying in different way, But The ERROR Is still The same. Could be that Is wrong The Logic of The code?

Revision history for this message
Jérôme Duriez (jduriez) said :
#4

As suggested by the TypeError above, the problem is RotationEngine.ids should be a list of integers = bodies ids (see the doc [*]), not some GTS surface object, which is what s2 is.

You have to pass a correct list of ids, not s2, to this attribute.

On a general note, I think people would maybe spend more time giving answers if you spend more time preparing your questions ;-)

E.g. even though the [0,0,0] vs (0,0,0) may have no consequence here, not posting what you tried, or vice-versa, still is typically a very good way wasting everyone's time on this forum.

[*] https://yade-dem.org/doc/yade.wrapper.html#yade.wrapper.RotationEngine.ids

Revision history for this message
jacopo (varrialeee) said :
#5

Ok sorry for The mistake i made.
Then, isn 't possibile move a gts surface? Becouse i have a nastran file ( that i converted in stl And Also gts) , But with both conversion i m not able To let IT move. In trunk examples i didn t find anything helpfull with this goal. How can i do?
________________________________
Da: <email address hidden> <email address hidden> per conto di Jérôme Duriez <email address hidden>
Inviato: lunedì 6 agosto 2018 16:02:39
A: Jacopo Varriale
Oggetto: Re: [Question #671373]: rotate a GTS surface

Your question #671373 on Yade changed:
https://answers.launchpad.net/yade/+question/671373

    Status: Open => Answered

Jérôme Duriez proposed the following answer:
As suggested by the TypeError above, the problem is RotationEngine.ids
should be a list of integers = bodies ids (see the doc [*]), not some
GTS surface object, which is what s2 is.

You have to pass a correct list of ids, not s2, to this attribute.

On a general note, I think people would maybe spend more time giving answers if you spend more time preparing your questions ;-)

E.g. even though the [0,0,0] vs (0,0,0) may have no consequence here,
not posting what you tried, or vice-versa, still is typically a very
good way wasting everyone's time on this forum.

[*] https://yade-
dem.org/doc/yade.wrapper.html#yade.wrapper.RotationEngine.ids

--
If this answers your question, please go to the following page to let us
know that it is solved:
https://answers.launchpad.net/yade/+question/671373/+confirm?answer_id=3

If you still need help, you can reply to this email or go to the
following page to enter your feedback:
https://answers.launchpad.net/yade/+question/671373

You received this question notification because you asked the question.

Revision history for this message
Jérôme Duriez (jduriez) said :
#6

In DEM in general (resp. YADE in particular), the only things that move are the Discrete Elements (resp. the YADE bodies).

You thus have to know which YADE bodies (their ids) correspond to this surface object that you describe at some point with a gts surface.

Basically these ids are just the return value of O.bodies.append() when you call it [*].

Two serious notes though:

- it seems to me you import twice this s2 gts surface: you create twice identical YADE bodies (located at the same positions) corresponding to this surface with your two calls to O.bodies.append

- O.engines = [RotationEngine()] (and just that) can not define a meaningful YADE simulation.

Maybe you did not go through significant sections of the doc (User's manual in particular) yet. If yes, I'd suggest making it before trying to addressing your whole problem of plane crash.

[*] https://yade-dem.org/doc/yade.wrapper.html#yade.wrapper.BodyContainer.append

Can you help with this problem?

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

To post a message you must log in.