FreeCAD & Lisp
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
-
- Posts: 5
- Joined: Wed Jun 05, 2013 2:25 pm
FreeCAD & Lisp
I am looking to transfer my lisp routines to FreeCAD, how easy or hard is this? I am new to Python but am actively learning.
-
- Posts: 395
- Joined: Fri Oct 07, 2011 8:58 pm
- Location: Beaverton,Oregon, USA
- Contact:
Re: FreeCAD & Lisp
Python is a very user friendly language. If you learn FreeCAD and it's python bindings, and you have a good grasp on what you want to do with the geometry in your application, you will enjoy it. I think the python bindings in FreeCAD are more powerful than autolisp routines in Autocad/Bricscad because of their connection to the geometry, application, and gui.
-
- Posts: 5
- Joined: Wed Jun 05, 2013 2:25 pm
Re: FreeCAD & Lisp
I'm concerned about macros, tho. It's true that Python doesn't support macros? Most of my Lisp routines are used to automate tasks, and I want to make sure Python can handle this.
-
- Posts: 5
- Joined: Wed Jun 05, 2013 2:25 pm
Re: FreeCAD & Lisp
Not CAD macros but code macros like for true and false statements, automation etc. It looks like Python is the way to go though, I should learn it.
Re: FreeCAD & Lisp
Oh, I forgot that Lisp is a ancient programming language (1958). You meant a kind of preprocessor!
No modern language has such a thing or need it. In python you do it with functions...
No modern language has such a thing or need it. In python you do it with functions...
Stop whining - start coding!
-
- Posts: 5
- Joined: Wed Jun 05, 2013 2:25 pm
Re: FreeCAD & Lisp
Cool thanks.
Re: FreeCAD & Lisp
Actually, Clojure is a very modern language, and it most definitely has macros (it is a lisp, lisp is a type of or family of languages), which is one of the more prominent features of the language over other functional or more generally general purpose languages. It allows for a more declarative type of programming, which I think would be suitable for CAD modelling. Not here to ignite any language flame wars, python was/is the best choice for FreeCAD, but maybe I will do Clojure frontend for it some day, if I ever get anywhere with my clojure based programmable CAM solution prototype.
Also, for those no familiar with lisp macros, they are often used for similar purposes as the metaprogramming facilities of python. One usecase (my programmable CAM idea) for macros are internal Domain Specific Languages aka DSLs, which are so common in the lisp way of thinking that they aren't even called DSL too often, since its just a natural way of constructing intuitive APIs.
Also, for those no familiar with lisp macros, they are often used for similar purposes as the metaprogramming facilities of python. One usecase (my programmable CAM idea) for macros are internal Domain Specific Languages aka DSLs, which are so common in the lisp way of thinking that they aren't even called DSL too often, since its just a natural way of constructing intuitive APIs.
Re: FreeCAD & Lisp
Ok, lets flame
Looking back at 30 years of programming I have a definite strong opinion about that.
1. I tried and hate functional programming. Nice exercise for the brain, but useless for big projects. The only on I was remotely interested in, was Erlang
2. I tried and hate meta-programing. Most libraries using meta-progrming with C++ templates are terrible uncooperative and complicated (e.g. OpenMesh or some of the boost libraries I validated for FreeCAD)
3. Internal DSLs are a bad idea, although we use in FreeCAD a DSL for our python binding generator. But thats a generative approach which generate C++ code you can compile and debug. Thats the right way to do a DSLs.
C++ is the only true programing language! You can unleash undreamed speed in working directly on the memory, registers or raw OS interface. At the same time you have all the high level constructs to master REALLY big projects.
--- end of flame ---
But thankfully every programmers generation has to decide on its own
Looking back at 30 years of programming I have a definite strong opinion about that.
1. I tried and hate functional programming. Nice exercise for the brain, but useless for big projects. The only on I was remotely interested in, was Erlang
2. I tried and hate meta-programing. Most libraries using meta-progrming with C++ templates are terrible uncooperative and complicated (e.g. OpenMesh or some of the boost libraries I validated for FreeCAD)
3. Internal DSLs are a bad idea, although we use in FreeCAD a DSL for our python binding generator. But thats a generative approach which generate C++ code you can compile and debug. Thats the right way to do a DSLs.
C++ is the only true programing language! You can unleash undreamed speed in working directly on the memory, registers or raw OS interface. At the same time you have all the high level constructs to master REALLY big projects.
--- end of flame ---
But thankfully every programmers generation has to decide on its own
Stop whining - start coding!
-
- Posts: 5
- Joined: Wed Jun 05, 2013 2:25 pm
Re: FreeCAD & Lisp
Interesting thanks for the "macro" view on all this. Certainly it will help.