Re: [Pythoncad-developer] Added command line support
CAD Application entire developed in Python
Status: Beta
Brought to you by:
matteoboscolo
From: Matteo B. <mat...@bo...> - 2010-04-02 06:49:28
|
Hi Gertwin, I sow your command line and it working well .. no bugs found .. Could we implement a Multi text viewer where pythoncad put the output If the command succeed say .. "o boy .. well done :-)" > The idea is that every module can register commands that it can handle. I like this idea, but I wold like that the interpret stay under kernel (pycadapplication) I had made some modification at the pythoncad structure .. now the main api file is not pycadkernel but pycadapplication ... I made this change to support the new command class .. This class have not the some functionality of your and is not intend to replace you class .. it's a generic api file in witch all the gui interface are interfaced .. This class will provide hight level functionality to perform drawing operation. for now I have implemented only the getCommand method .. this method give to you the command object so you can fill it with the needed value and perform the applyCommand method to apply the command.. The following line will sow to you an exsample. cObject=pyCadApplication.getCommand("segment") for iv in cObject: #<<-- Loop for all the needed value try: raise iv(None) #<<-- Raise the exception of the needed value except ExcPoint: #<<-- if it's a point came here cObject[iv]=self.imputPoint() #<<--This is my io text imput But could be a function that ask to the user to pick a point except ExcLenght: cObject[iv]=self.inputMsg("Insert A Distance/Radius") except ExcAngle: cObject[iv]=self.inputMsg("Insert An angle") except: print "Bad error !!" raise else: cObject.applyCommand() #<<-- applay the command if all the data are right. you can find a working test if you run the test_kernel.py I intend to provide all the drawing command with this method .. Let me know what you are thinking about it.. I think that your function Parser should be part of the pycadapplication and not part of the interface ..so let me know if you fill the some At this stage there is a lot of code written ..so for my point of view we have to make a class diagram and start to discuss at the new class structure ..so our work can be more profitable. Regards, Matteo On Wed, 2010-03-31 at 23:26 +0200, Gertwin Groen wrote: > Hi Matteo, > > I have just pushed my latest version to git. > It has preliminary support for a command line interface with a very > very simple command interpreter. > > The idea is that every module can register commands that it can handle. > Also I changed the menu structure, it also works by sending commands > to the command interpreter. > > For now the program understands command like (case insensitive): > OPEN > REBUILD_IX > QUIT > REGEN > REDRAW > ZOOMA > > I think this is better than the R37 version because command line and > menu was handled different. > If you have some comments on this, please let me know. > > I did not test it much, so be prepared for bugs. > > Regards, > Gertwin > |