Author Topic: VLisp or VBA what's your thoughts?  (Read 2854 times)

0 Members and 1 Guest are viewing this topic.

sestes

  • Guest
VLisp or VBA what's your thoughts?
« on: June 07, 2004, 12:45:08 PM »
Alright this is a question that has been going through my head for a while.  I am not new to AutoCAD, I have 12 years experience (no collage classes) and I work in the 2D world of CAD (never had a need to go 3D).  I would very much like to further my knowledge and skills with AutoCAD through programming.  I've just recently found these forums and I am thankful I can finally get some input from people who understand where I'm coming from. I have to say this one is my favorite forums and I can see there are a lot of talented people here.  Now I don’t want to start a war or anything, but which programming language would you recommend I learn?  There is a software programmer at my work who swears by VB and thinks I should start their.  But he doesn't understand AutoCAD so he has an unbalanced opinion.  I am a beginner in this area.  The only experience I have is Script files, my own menus, and the occasional lisp routine that I cut and paste into vlisp editor.  I would appreciate a good book reference too.  Thanks.   :)

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
VLisp or VBA what's your thoughts?
« Reply #1 on: June 07, 2004, 12:56:02 PM »
I would say start with autolisp because you can do some great stuff quickly, plus once you've learned lisp it's much easier to move on too other languages, I know that for a fact! I'm learning C++ now and my general programming knowledge as come in quite handy.

as far as books goes I like AutoLISP programming princples and techniques by Rod Rawls and Mark Hagen. Or you might send an e-mail to SMadsen. <- plug

http://www.smadsen.com
TheSwamp.org  (serving the CAD community since 2003)

hendie

  • Guest
VLisp or VBA what's your thoughts?
« Reply #2 on: June 07, 2004, 12:59:19 PM »
I would say, try both Lisp and VBA and see which one you find easier.
I started in Lisp ('cos it was easier) and then started dabbling in VBA when I needed something with a dialogue box ! (I just can't get into DCL)
some things are easier in Lisp, some in VBA ~ it's always handy to have some knowledge in both... don't restrict yourself by concentrating on one language.

JohnK

  • Administrator
  • Seagull
  • Posts: 10659
VLisp or VBA what's your thoughts?
« Reply #3 on: June 07, 2004, 01:03:54 PM »
First question: Do you fell like you will ever want to move outside AutoCAD? (program other things; windows, Excell, Word, etc.)

If you say yes i say you can start with VB(A) but i think you should soon move on to C++. (I started my C++ learning a little bit ago and it blowes VB(A) out of the water!!) --BTW, one thing that bothers me when talking with "Computer science" majors in school is when they say crap like "You can do somuch with VB you'll never need another language"  When someone says this to you, slap them in the frickin mouth cause they are blowing smoke up... *nevermind!* --   As far as languages go you can learn alot from both. (If your buddy says you cant learn anything from lisp and im just talking crap, then you tell (s)he to drop on by.)

But seriously now (I'll quit fooling arround), its all what your comfortable with. Go to Afralisp and take a tutorial in both languages and see which one you understand better.

Note: I am a lisper by nature, --I started with Lisp, moved on to VB(A) and quickly jumped back to Lisp. Now im learning C++.  

I hate VB(A) so if you were to as me how i would go about my "education" if i were to do it all over again, i would jump right to C++.
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

sestes

  • Guest
VLisp or VBA what's your thoughts?
« Reply #4 on: June 07, 2004, 01:08:30 PM »
Quote from: hendie
don't restrict yourself by concentrating on one language.
Thats great advice.  I was thinking about jumping into Vlisp to start.  Simply because it came with Autocad, so I have it on my pc to play around with.

sestes

  • Guest
VLisp or VBA what's your thoughts?
« Reply #5 on: June 07, 2004, 01:16:27 PM »
Quote from: Se7en
First question: Do you fell like you will ever want to move outside AutoCAD? (program other things; windows, Excell, Word, etc.)


I honestly don’t know.  When I think about what I want to accomplish, (short term) I think about Lisp routines that help me work faster.  Kind of tailored to what I do on a daily basis.

JohnK

  • Administrator
  • Seagull
  • Posts: 10659
VLisp or VBA what's your thoughts?
« Reply #6 on: June 07, 2004, 01:38:44 PM »
Oh lisp is _GREAT_ for fast tools.

Go talk to Stig about Lisp, he has some lessons i know you would get alot out of.
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

hendie

  • Guest
VLisp or VBA what's your thoughts?
« Reply #7 on: June 07, 2004, 01:55:32 PM »
Quote from: sestes
 I was thinking about jumping into Vlisp to start.  Simply because it came with Autocad, so I have it on my pc to play around with.

so does VBA, just hit ALT+F11 in any windows programme (Acad, Excel, Word etc)

Trev

  • Guest
VLisp or VBA what's your thoughts?
« Reply #8 on: June 07, 2004, 11:31:39 PM »
I started in AutoLisp, which is realtively simple as it is purely  acad, you can type in lisp funtions straight to the command prompt, which makes it easy to test. Lisp is however limited & thats where VisualLisp comes in. I haven't gone into Vlisp very much as I went into VBA. But in general what VBA can do so can Vlisp. VBA is certainly handy for dialog box run programs.
There are somethings which are easier in lisp than in VBA and visa versa. Basically if you can learn both thats very handy. Have a read through those tutorials as mentioned above & see which ones make sense the easiest & that will be your starter.

As Hendie & Se7en said if you do any work in Excel or Access and wish to use them with Acad then VBA is certainly something to look at, as you can run programs that will operate within each of them.
Things like scheduling or bill of materials etc.

sestes

  • Guest
VLisp or VBA what's your thoughts?
« Reply #9 on: June 08, 2004, 01:10:38 PM »
Thanks everyone for your responses and input.  I’m thinking I will start with Vlisp and follow the free tutorials.  It would be nice to be able to create a few lisp routines and make work a little more productive.  Down the road I should check out VBA and explore other possibilities to see which one works best for me and what I would like to accomplish.  At least this is my intention.  Thanks again.

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
VLisp or VBA what's your thoughts?
« Reply #10 on: June 08, 2004, 03:20:14 PM »
Quote from: sestes
Thanks everyone for your responses and input.  I’m thinking I will start with Vlisp and follow the free tutorials.

Well you know where to go when you need help, right!! :D

here's one to start with;
Code: [Select]

(defun c:dline (/ clay p1 p2)
 
  ;; set variable 'clay' = to current layer
  (setq clay (getvar 'clayer))
 
  ;; set and/or make current layer "mylayer"
  (command "_.layer" "m" "maylayer" "" "")

  ;; note:
  ;; double '"' equal <enter> key when
  ;; used with 'command'

  ;; now collect two points from user for line
  (setq p1 (getpoint "\nSelect Point #1: "))
  (setq p2 (getpoint p1 "\nSelect Point #2: "))

  ;; draw the line
  (command "_.line" p1 p2 "")

  ;; reset current layer
  (setvar 'clayer clay)
  )
TheSwamp.org  (serving the CAD community since 2003)

sestes

  • Guest
VLisp or VBA what's your thoughts?
« Reply #11 on: June 08, 2004, 06:05:17 PM »
Hey thanks, yeah Ive book marked your site.

Trev

  • Guest
VLisp or VBA what's your thoughts?
« Reply #12 on: June 08, 2004, 10:20:24 PM »
Quote from: sestes
It would be nice to be able to create a few lisp routines and make work a little more productive.

Easy. All you need to do is think of a drawing process that you do every day that may take you multiple steps to achieve.
Something like, Insert a block at appropriate dwg scale to be parallel to a line. Thats a very short and sweet routine, that can be used over & over again all day long (depending on your drafting discipline of course)

So for an example of doing a program like that. Think of the steps involved, (write down if necessary)

what is the block name
where is insertion point
what is the dwg scale
select line entity & calculate the angle
what layer do you want it on

then > set your layer, insert blockname inspoint dwgscale angle

Thats the basics of it.
Odds are there are many things you do whilst drawing that you arn't even aware that you could improve the steps, Now that your learning you will begin to see those repetative tasks you do and look to eliminate those repetative steps.

hendie

  • Guest
VLisp or VBA what's your thoughts?
« Reply #13 on: June 09, 2004, 03:15:03 AM »
once you decide on a nice introductory exercise ~ create it in Lisp and then go through the process again and create the exact same routine in VBA
it's a nice way to introduce you to the differences in the languages.