Is anyone here familiar with jquery? Jquery is a javascript api that makes web dev much easier. There is a python equivalent: pyquery I think.
The reason I mention it here is, it might be a useful way to construct a cad api in a way that allows much flexibility while preserving 3gl capability and dynamic features In essence, the basic idea with jquery is that there is a basic object interface that has a number of common properties and behaviors. Most of the time the jquery object composes anothe core object, like a dom node. The power comes from the idea that most behviors of a jquery object return other jquery objects rather than primatives, so it is possoible to create extremely compact but expressive scripts. Here is an example of how such an api might look when translated to cad terms: c = $(Circle(...)) Cv = $(curve(...)) (Note these are wrappers, not the underlying circle and curve objects-- the $ function creates and returns the adapter, and by convention all behaviors also return adapters ) c.moveTostart(cv).extrude(cv).translate(1,2,3).rotate(90).eachFace ( { Do some processing here }) The idea is that the wrapper objects returned by each operation allow chaining in this way, and provide adapters to common functions so that things like translate always work. Note that the wrapper provides iteration over relevant collections so that anonymous functions can be used to make looping code easier. This is how the api gets rid of the horrible repetitve topexp looping code. It is possible of course to do more detailed stuff by getting the object the wrapper points to. This is normally done with a getObject or similar method. I really like this style of api, because there is much flexibility in the composition. On 12/22/10, Thomas Paviot <tpav...@gmail.com> wrote: > Hello Julien, > > I was not aware of your project, although I try to stay up-to-date with > pythonocc related project. Internet is still a forest where google can get > lost. > > Your pycado is a really interesting project. I don't know exactly what are > your final objectives with it, but the beginnings seem promising. I will > test it as soon as possible. > > Your approach of developing a scripting engine can be classified in the > "Macro-Parametric solutions" category. As far as I understand your code, you > developed a kind of scripting language aiming at map the feature tree > available in most CAD softwares. That's indeed something we discussed here a > few days ago, and it looks like there is here a few fans of such a > technology. > > However, I'm still not convinced by this approach. In my opinion, developing > a scripting engine (with a parser, lexer etc.) with limited features on top > of a dynamic programming language like python is a kind of inconsistency. It > makes me think about something I'd call BASIC for CAD (I love BASIC, I > learnt programming with this language!-but it was a long time ago). > Furthermore, I do think that the modeling of 3D shapes is something much > more complex than a simple temporal sequence of basic operations (you might > call them "features"). Anyway, it's only my current opinion, and I could > fall in love with your project and change my mind. > > Whatever the technical solution you chose to perform CAD operations > (scripting or not), I'm more interested in the semantics you defined for CAD > data handling/creation/etc. At some point, it's a topic on which we could > collaborate (we've been here discussing the development of a high level API > for pythonOCC for a long time). > > Best Regards, > > Thomas > > 2010/12/22 julien blanchard <julien...@yahoo.fr> > >> Hello, >> >> I have just read the thread of Dave Cowden and I think that a project >> we're >> working on might interest someone. >> >> We have started the pycado >> project http://julienbld.github.com/pycado/ which seems quite similar to >> what >> you're looking for and to http://openscad.org/. >> It is based upon pythonocc and still in an early stage but it is working >> whith a >> restricted number of features. >> >> You'll find more information into the web page and feel free to download >> the sources and ask us anything about the project. >> >> We are now two developers and started the project on spring 2010 but we >> have not >> been active for the last months due to lack of time. We would be >> very insteresting in continuing the development with other people or to >> merge >> with a similar project. >> >> Julien Blanchard. >> >> >> >> >> _______________________________________________ >> Pythonocc-users mailing list >> Pythonocc-users@gna.org >> https://mail.gna.org/listinfo/pythonocc-users >> > -- Sent from my mobile device _______________________________________________ Pythonocc-users mailing list Pythonocc-users@gna.org https://mail.gna.org/listinfo/pythonocc-users