TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: ML on March 05, 2007, 10:49:16 AM
-
Does anyone happen to know how to cleanly and simply convert LISP routines into Visual LISP without re wriiting all the code?
Is there a clean coversion method?
Also, it would be great if I could convert LISP to VBA but I don't think that is possible; may be someone can proove me wrong?
Thank you
Mark
-
There is no more convertion tool between Kant philosophy and Pascals than between Autolisp and Vlisp. :roll:
You need to know them both in order to re-write a code.
Unless you use ENT... functions, Autolisp sends commands to AutoCAD while Vlisp transforms entities through their properties.
The grammar is not the same.
-
*click*
I found this one in my doc's. Although its a conversion from lisp -> c it might help.
(defun convert2C (/ fname nfile fn nf char)
(cond ((setq fname (getfiled "Convert file" "" "lsp" 0))
(setq nfile (strcat (vl-filename-directory fname)
"\\"
(vl-filename-base fname)
".cpp"))
(cond ((and (setq nf (open nfile "w"))
(setq fn (open fname "r"))
)
(while (setq char (read-char fn))
(cond ((= char 10)
(princ (chr char) nf)
)
(T (princ "C" nf))
)
)
(princ (strcat "\nNew file: " nfile))
(close nf)
(close fn)
))
)
)
(princ)
)
*Se8en: sits back to watch the show*
-
Thanks man; well it was worth a try :-)
-
Thanks Seven
I will take a look
Mark :?
-
........ how to cleanly and simply convert LISP routines into Visual LISP without re wriiting all the code?
Is there a clean coversion method?
Mark, what do you see that needs converting ?
-
Just to clarify something ..
Do you mean convert AutoLisp or one of the mainline Lisp dialects ??
You do know that Autolisp code written before VisualLisp inception will still run in VisualLisp ? yes ?
-
Mark, there isn't too much to converting from one language to another and as Kerry is inquiring, if the code works, there's no need to convert from autolisp to visualisp. In many cases we've run test earlier on in the beginnings of this forum where we found that some of the autolisp functions worked better than their newer counterparts.
I get the impression that you are still of the mindset that lisp is nothing more than a scripting language and doesn't even have an if/then/else function. Well, if it ever didn't have it, it has had it for a long time.
-
Hey Kerry
I didn't know that, that is interesting. Actually I prefer program in VBA because it is basically what got me into programming and I saw the obvious benefits of VBA over LISP, however, it is also obvious to me that there seems to be so much more coding to necessary in VBA to get the same results you would get from LISP. Having said that, my boss has done amazing things with LISP, thing I never knew were possible with LISP but I just thought it would be cool if we could modernize his routines a bit by using VLISP.
I am not sure what I need to do to run an asci file LISP routine in VLISP but may be you could give me a brief explanation? I would really appreciate it
Mark
-
... saw the obvious benefits of VBA over LISP....
Really ?
... I am not sure what I need to do to run an asci file LISP routine in VLISP but may be you could give me a brief explanation? I would really appreciate it
Type APPLOAD at the command line.
-
Kerry
You sound surprised about VBA :lol:
They both serve a valuble purpose however VBA is built into all Microsoft products which is major benefit right there. I don't know very much about LISP but can you get ACAD to work with Excel using LISP? Also can you access type libraries of other programs using LISP?
Mark
-
don't get into a pissing contest you can't win.
did you get the lisp loaded ?
-
Yeah you're right; who really cares. As long as the results are the same.
No I didn't try it yet but my boss said you can run you can copy an older LISP routine into VLISP no problem.
May be I will try it tomorrow. The extent of my LISP usag is maybe a few commandsin a menu macro; that is a definite benefit with LISP.
-
I don't know very much about LISP but can you get ACAD to work with Excel using LISP? Also can you access type libraries of other programs using LISP?
No, you can't use lisp from Excel....but you CAN use lisp to work within Excel FROM Acad.
Yes, you can access most any ActiveX library wth lisp. I have lisp routines I wrote back in AcadR9 that I still use today in R2007.
-
VisualLisp has an IDE (Just like VBA has an IDE) Its called the VLIDE. I think that is what he means; You cant ``copy an older LISP routine into VLISP'' (That just doesn't make sense.) but you can copy--open--a lisp in the VLIDE (which isnt ``VLISP'').
Dont worry, we will have you Lisp-ing soon enough. (We can get the terms down later).
-
*bump*
How'd you go ??
-
Can someone explain the difference between autolisp and vlisp. I thought they were both the same.
-
AutoLISP is the AutoCAD incarnation of the lisp language developed as an intelligence language for robotics. It has been around for as long as I can remember.. I have been using AutoCAD since R10 ...
Vlisp aka Visual Lisp, is a recent addition to the lisp language structure for AutoCAD. Visual lisp has the added advantage of being able to include the type libraries of other programs and being able to interact seamlessly with programs that have type libraries. The Vlisp commands you will find hidden in AutoCAD (since R2000) are essentially the VBA commands exposed to the lisp environment, plus a few extras for good measure. Programmers often refer to the interfaces as ActiveX or COM. The neat thing is that just about anything you can code in VBA, you can code in Vlisp and operate on the programming using concepts such as objects, properties and methods.
For programming that does not support VBA, you may still be able to interact with them by importing functions exposed in their dlls. This can be a very tricky proposition, but it works beautifully once you understand the structure of the objects, methods, and properties.
I hope this gives you a little insight into the differences and if we can help, feel free to ask.
-
............. The Vlisp commands you will find hidden in AutoCAD (since R2000) are essentially the VBA commands exposed to the lisp environment, plus a few extras for good measure.
.. actually, not VBA commands ..
VisualLisp has access to the methods properties and events exposed from the COM model through the ActiveX Automation interface, as does VB and VBA.
-
This picccy may help ...
-
............. The Vlisp commands you will find hidden in AutoCAD (since R2000) are essentially the VBA commands exposed to the lisp environment, plus a few extras for good measure.
.. actually, not VBA commands ..
VisualLisp has access to the methods properties and events exposed from the COM model through the ActiveX Automation interface, as does VB and VBA.
I prefered not to obfuscate. It may be easier for the virtual noob to understand that the vlisp commands are "essentially" the same as VBA commands, except they are exposed to lisp than to tell them that some as of yet undiscovered (to them) COM interface is the same in both instances. I know that when I first started learning vlisp, I had the hardest time understanding it until I understood the correlation between VBA and VLisp (i.e. the COM interface exposed to each environment).
Just trying to be helpul ...
-
... I prefered not to obfuscate. ....
.. and I do ?
:lmao:
-
... I prefered not to obfuscate. ....
.. and I do ?
:lmao:
evidently
-
ob·fus·cate [ob-fuh-skeyt, ob-fuhs-keyt]
–verb (used with object), -cat·ed, -cat·ing.
1. to confuse, bewilder, or stupefy.
2. to make obscure or unclear: to obfuscate a problem with extraneous information.
3. to darken.
-
Keith I understand what obfuscate means.
Your post will leave anyone who reads it with the impression that VisualLisp functions are based on VB or are VB command wrapped to make them accessable.
This is blatently incorrect, and the situation that you defend your post by assuming that the original poster is incapable of understanding the facts, and then attempting to ridicule me leaves me amazed.
-
Keith I understand what obfuscate means.
Your post will leave anyone who reads it with the impression that VisualLisp functions are based on VB or are VB command wrapped to make them accessable.
This is blatently incorrect, and the situation that you defend your post by assuming that the original poster is incapable of understanding the facts, and then attempting to ridicule me leaves me amazed.
I fail to see where I have ridiculed you or posted blatent incorrect information. I have already stated that the information you posted was correct and that I posted the information I did, in the way I did, so as to not confuse the situation.
Yes, perhaps I did assume that the poster would not understand the COM/ActiveX Automation .. and likely they don't and it only served to create more questions than it resolved .. I didn't state they were the same thing .. I meant that they operated in basically the same way .. i.e. things you can do in VBA (modify properties and invoke methods), you can do in VLisp as well. The reader is likely to understand that a whole lot easier. It was not meant as a commentary on how the programming language is implemented.
-
So your assertion that I was attempting to obfuscate the situation was another of your belittling jokes. ?
-
So your assertion that I was attempting to obfuscate the situation was another of your belittling jokes. ?
Sorry .. I don't see it. Maybe your post prior to that was meant as a belittling joke .. I dunno .. Like I said .. I don't see it ..