Page 1 of 2

how can i draw

Posted: 08 Jun 2023, 11:06
by qwerty
Hello,

I have a CSV file with force data and I want to be able to draw a circle on the ground that will be "at the foot" of an object and I want the circle to grow and decrease according to the value of the force. Is it possible to do that ?
I'm using the python API.

Thanks in advance

Re: how can i draw

Posted: 08 Jun 2023, 13:11
by fferri
Yes, with sim.addDrawingObject and sim.addDrawingObjectItem

Re: how can i draw

Posted: 08 Jun 2023, 14:15
by qwerty
thank you for your reply.
Is it possible to have an example ?

Re: how can i draw

Posted: 09 Jun 2023, 13:38
by qwerty
Every time I try to put this function in my code I get this error :

AttributeError: module 'sim' has no attribute 'addDrawingObject'

Re: how can i draw

Posted: 12 Jun 2023, 07:59
by fferri
It is highly recommended to use the ZeroMQ remote API, since it is much easier and flexible. Additionally, you'll have access to many more API functions, than with the legacy remote API.

Re: how can i draw

Posted: 12 Jun 2023, 08:10
by fferri
For what you want to draw, you can use sim.drawing_discpts (to draw discs) combined with sim.drawing_itemsizes which takes one additional number (in sim.addDrawingObjectItem) to specify the item size:

Code: Select all

dwo=sim.addDrawingObject(sim.drawing_discpts|sim.drawing_itemsizes,0.1,0,-1,1000,{1,0,0})
--                            pos:          quat:       size:
sim.addDrawingObjectItem(dwo,{0.5,  0,0,    0,0,0,1,    0.2})
sim.addDrawingObjectItem(dwo,{  0,0.5,0,    0,0,0,1,    0.1})
sim.addDrawingObjectItem(dwo,{0.5,0.5,0,    0,0,0,1,    0.05})

Re: how can i draw

Posted: 12 Jun 2023, 09:18
by qwerty
Thank you for your help.
I have another question.
With this API can I still use my previous codes made with the other API or do I have to readapt my code?
Thank you in advance for your answer

Re: how can i draw

Posted: 12 Jun 2023, 09:23
by fferri
The ZMQ Remote API is a 1:1 equivalent of the (lua) Regular API.
If you used the Regular API (e.g. in model scripts), it works in the same way.
If you used the legacy Remote API you might need to make minor adjustments.

Re: how can i draw

Posted: 12 Jun 2023, 09:53
by qwerty
very good and I have another question.
Can I attach this obet create to another object for example I would like the circle to be created at the foot of a cane ?

Re: how can i draw

Posted: 12 Jun 2023, 12:44
by fferri
Yes (by passing the foot handle to the parentObjectHandle param).