Web interface (AJAX?) to MGEDBRL-CAD
Status: ClosedTime to complete: 72 hrs Mentors: SeanTags: ajax, php, ruby, java, lisp, scheme, python

BRL-CAD has a geometry editor application called MGED that will run in a graphical or text console mode (mged -c)

Your task is to do some exploratory research.  Make it so that we can go to a web page and interact with a remote instance of MGED. Don't worry about making it pretty, we're looking for proof-of-concept.

You can do this task in any language you like, but you need to set up a temporary demo somewhere that we can get to.  Provide the URL and your source file(s).

CAUTION: Keep it protected or run it in a VM or otherwise "sandboxed" environment, however, because MGED does allow shell command execution and we wouldn't want some random individual causing problems. :)

 

Uploaded Work
File name/URLFile sizeDate submitted
http://crit.brlcad.org/~gciskriptkid/cmd/n/aJanuary 03 2013 17:32 UTC
http://crit.brlcad.org/~gciskriptkid/cmd/n/aJanuary 05 2013 12:09 UTC
Comments
Richard Tynanon December 15 2012 00:52 UTCQuestion

Is this suppose to be a graphical or commandline instance of mged? Also, can we use other opensource software to implement this?

Sean on December 15 2012 05:49 UTCabsolutely

It can be either and yes, you can use any open source and any language you want.  it's more about doing some research on the feasibility.  Proof-of-concept.  It it works great, we could create dozens of additional tasks to keep working on it. ;)


 

Richard Tynanon December 16 2012 02:11 UTCTask Claimed

I would like to work on this task.

Sean on December 16 2012 05:02 UTCTask Assigned

This task has been assigned to Richard Tynan. You have 72 hours to complete this task, good luck!

Richard Tynanon December 19 2012 04:08 UTCClaim Removed

The claim on this task has been removed, someone else can claim it now.

Gauravjeet Singhon December 19 2012 15:26 UTCTask Claimed

I would like to work on this task.

Gauravjeet Singhon December 19 2012 15:26 UTCClaim Removed

The claim on this task has been removed, someone else can claim it now.

Tanuj Guhaon December 24 2012 06:08 UTCTask Claimed

I would like to work on this task.

Sean on December 24 2012 08:47 UTCTask Assigned

This task has been assigned to Tanuj Guha. You have 72 hours to complete this task, good luck!

Melange on December 27 2012 08:47 UTCInitial Deadline passed

Melange has detected that the initial deadline has passed and it has set the task status to ActionNeeded. The student has 24 hours to submit the work before the task is reopened and sent back to the pool for other students to claim.

Melange on December 28 2012 08:47 UTCTask Reopened

Melange has detected that the final deadline has passed and it has reopened the task.

Skriptkidon January 2 2013 15:52 UTCTask Claimed

I would like to work on this task.

Harmanpreet Singh on January 2 2013 15:55 UTCTask Assigned

This task has been assigned to Skriptkid. You have 72 hours to complete this task, good luck!

Skriptkidon January 2 2013 16:01 UTCSaaS

Are we looking at Software as a Service?

Skriptkidon January 2 2013 16:40 UTCOr...

Maybe I haven't understood this right. What exactly am I supposed to do? By web interface to Mged, do you mean that I have to create an interface to interact with Mged from a browser? The user types in mged commands into the browser, which is parsed by Mged on a certain computer and an output is given out accordingly?

Sean on January 3 2013 05:57 UTCYep

What you asked sounds correct.  Should be fun! :)


 

Skriptkidon January 3 2013 16:48 UTCexec?

Okay, I'm thinking of using the 'exec' or a similar function, which executes terminal commands, in PHP for this, along with AJAX. But mged takes all input when it is being run, and not as command line arguments. Any suggestions or ideas on how commands can be sent to it?(I'm looking around, of course.)

Skriptkidon January 3 2013 17:34 UTCFirst Step

A very basic CLI-Ajax interface I've managed to come up with. No bells and whistles or niceties. So the next thing is to figure out the mged-PHP interaction.

Skriptkidon January 3 2013 17:34 UTCReady for review

The work on this task is ready to be reviewed.

Sean on January 3 2013 17:58 UTCmged

mged can take commands in a whole variety of ways including one-at-a-time but it's best to establish a back-end "session" with mged so that you don't have to keep re-invoking it.  That way you can stream back responses/output too for commands like "rt" that take a while.

Sean on January 3 2013 17:58 UTCTask Needs More Work

One of the mentors has sent this task back for more work. Talk to the mentor(s) assigned to this task to satisfy the requirements needed to complete this task, submit your work again and mark the task as complete once you re-submit your work.

Skriptkidon January 4 2013 18:18 UTCProblem, Solution

Okay, here's thr problme with Ajax + PHP: Every time AJAX sends data to PHP, the PHP script is opened and after the programmed operations are done, the script ends. So every time an mged command is sent through AJAX, the PHP script is closed and respawned, taking down the MGED instance that was opened and thus making all further commands useless. Sadly, there's no way to keep the script alive.


My idea of a workaround for this: Create two PHP scripts, one that takes the AJAX input and the other which is always running on command line(spawned by the first script.) These two are connected by sockets. So PHP-1 takes commands through AJAX and relays it to the -ever-alive PHP-2, which then executes then, since it's able to keep MGED instance alive.


Go ahead with this model?

Skriptkidon January 5 2013 12:09 UTCInput

I tried that, but did not work. I'm able to take commands and pass them to the command line, but once MGED is started, I'm unable to pass any input to it through STDIN. I've uploaded what I've done so far.

Skriptkidon January 5 2013 12:09 UTCReady for review

The work on this task is ready to be reviewed.

Melange on January 5 2013 15:55 UTCNo more Work can be submitted

Melange has detected that the deadline has passed and no more work can be submitted. The submitted work should be reviewed.

Skriptkidon January 5 2013 15:56 UTCExtension

Need an extension. Still working on this.

Skriptkidon January 5 2013 16:27 UTCNew files

Uploaded some new files to the server. Uses piping. But sockets need to be enabled in PHP for it to work. Could that be done? Also, the file "sock.php" needs to be run before testing. It's in public_html/cmd. "php -f sock.php"

Sean on January 5 2013 16:50 UTCTask Closed

Congratulations, this task has been completed successfully.

Sean on January 5 2013 16:51 UTCprogress

It's reasonable progress given the expected level of effort for a GCI task so we can call this bit of research complete and create a follow-on task for the next step.  We'll look into the php sockets option you mentioned.

Skriptkidon January 5 2013 17:08 UTCInfo

Found a bit of info that might be useful later. This might be of some help: http://pexpect.sourceforge.net/pexpect.html