Read values via CLI interface

MakeHuman python API, python plugins, etc

Moderator: joepal

Read values via CLI interface

Postby b4rosz » Fri Oct 16, 2020 10:16 am

Hello all!

I have been trying to read the heightCm value via CLI, is there any ready-made solution?

I found in socket plugins (https://github.com/brueli/community-plu ... odifier.py) applyModifier method for setHeight applied - here it works and now I would like to read height in cm using socket CLI.

A good solution would be to use a ready-made method, but I can only use it in the build-in Mahekuman shell:
G.app.selectedHuman.getHeightCm()
>>136.58567428588867

Can this be triggered by socket CLI? I need to bring this value out.

Thank you for your help!
b4rosz
 
Posts: 1
Joined: Fri Oct 16, 2020 9:45 am

Re: Read values via CLI interface

Postby joepal » Fri Oct 23, 2020 1:44 pm

The socket plugin only exposes a few methods. If you want more information, you'd have to add another wrapper method.

Since you already know what call you want to make, that should not be rocket science. In https://github.com/makehumancommunity/c ... meshops.py add another method "getHeightCm" using the same pattern as the other methods. Without testing, something like:

Code: Select all
def getHeighCm(self,conn,jsonCall):
    jsonCall.data = G.app.selectedHuman.getHeightCm()


Add the method in the method array in the init method, using the same pattern as on line 23.
Joel Palmius (LinkedIn)
MakeHuman Infrastructure Manager
http://www.palmius.com/joel
joepal
 
Posts: 4589
Joined: Wed Jun 04, 2008 11:20 am


Return to Python scripts

Who is online

Users browsing this forum: No registered users and 1 guest