Author Topic: Learning the new Lisp ways  (Read 13067 times)

0 Members and 1 Guest are viewing this topic.

Craig

  • Guest
Learning the new Lisp ways
« on: November 18, 2003, 04:51:32 PM »
Aiight guys, I am about to tackle the task of learning the new VLisp and will be asking bunches of questions. What I want to know to start is where can I find the property values for the line below.
(vlax-get-property doc 'FullName)

'Fullname
'Modelspace
'Color
etc.. Where can I find a list of these values that can be called for?

Remember, this is just the start

daron

  • Guest
Learning the new Lisp ways
« Reply #1 on: November 18, 2003, 04:57:06 PM »
In the help file, there is a reference called "ActiveX and VBA Reference". In there you will find what you are looking for, but you'll need to use (vlax-get-acad-object), which you'll find under v of the Autolisp reference. If you're in the vlide and you inspect (vlax-get-acad-object), you'll get a list popup with all the properties of the acad database, which is what that is. You can double click on properties in the popup and see what's nested. You use (vla-get-activedocument (vlax-get-acad-object)) to access the drawings object model. Hope that helps you start.

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
Learning the new Lisp ways
« Reply #2 on: November 18, 2003, 05:04:22 PM »
check this out.
Code: [Select]

(setq doc (vla-get-activedocument (vlax-get-acad-object)))
(vlax-dump-object doc)
TheSwamp.org  (serving the CAD community since 2003)

JohnK

  • Administrator
  • Seagull
  • Posts: 10633
Learning the new Lisp ways
« Reply #3 on: November 19, 2003, 08:58:52 AM »
Here ya go Craig, Ill give you a compariative study to do also. Study these lisps and they should get you started down the right path in the help files. The first one is easy (You alreay know how to do that. but I have to put it in the post just cause...) The second is the equiliviant of the first. Study each "vl" expression untill you know them like the back of your hand and you will understand better.

(Thats important! Study each "vl" expression and you will have a god start to the Vl-stuff.)

Code: [Select]
(defun c:AMove ()
  (setvar "cmdecho" 0)
  (setq ent (entsel)
        pt1 (getpoint "\nEnter first point: ")
        pt2 (getpoint "\nEnter second point: "))
  (command "_.move" ent "" pt1 pt2)
  (setvar "cmdecho" 1)
(princ)
)

(defun c:vl-Move ()
  (vl-load-com)
  (setq ent (entsel)
        entname (car ent)
        entobj (vlax-ename->vla-object entname)
        pt1 (getpoint "\nEnter first point: ")
        pt1obj (vlax-3d-point pt1)
        pt2 (getpoint "\nEnter second point: ")
        pt2obj (vlax-3d-point pt2))
  (vla-move entobj pt1obj pt2obj)
 (vlax-release-object entobj)
(princ)
)
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Learning the new Lisp ways
« Reply #4 on: November 19, 2003, 09:41:29 AM »
.. or it could be wtitten like this, with no variables :--
Code: [Select]

(vl-load-com)



(defun c:xxx-Move ()
  (vla-move (vlax-ename->vla-object (car (entsel)))
            (vlax-3d-point (getpoint "\nEnter first point: "))
            (vlax-3d-point (getpoint "\nEnter second point: "))
  )
  (princ)
)
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

JohnK

  • Administrator
  • Seagull
  • Posts: 10633
Learning the new Lisp ways
« Reply #5 on: November 19, 2003, 10:04:36 AM »
I know that, You know that, and he knows that. Thats fine and dandy, but that isnt the point. I used "Proper" format for a reason.
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

Craig

  • Guest
Learning the new Lisp ways
« Reply #6 on: November 19, 2003, 10:15:06 AM »
Hey, thanks John. This will really help me get started. When I'm typing this new program out I still out of habit put in autolisp code that I've been doing for years. Gotta get out of that habit.

JohnK

  • Administrator
  • Seagull
  • Posts: 10633
Learning the new Lisp ways
« Reply #7 on: November 19, 2003, 10:32:52 AM »
No problem. Yeah, that will go away when you change your mode of thinking a bit towards the "Object/Properties" instead of "Ent/Associations".
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

JohnK

  • Administrator
  • Seagull
  • Posts: 10633
Learning the new Lisp ways
« Reply #8 on: November 19, 2003, 10:41:40 AM »
Oh, side note: I found it hard to go back; A little while ago, i was on this kick of creating functions that would do things the "old way". (Watch this craig, Daron and Stig are gonna go at it again. {Daron called Autolisp "old" once and i could almost see stig's eyes open wide in confusion} ...lmao) I was checking to see if there was a circle in a block and see the circ's props with assoc code. That got a bit tricky; I couldnt remeber anything. lol
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

daron

  • Guest
Learning the new Lisp ways
« Reply #9 on: November 19, 2003, 10:51:51 AM »
Nah, I don't think we'll go at it again. I admit defeat. He put me in my place. Reading his site'll do that. As far as it being old, it is. Isn't lisp the second oldest language? I don't even know what the oldest language is. From the tests we've driven on this site, my eyes have been opened to considering what will work quickest when I have to code for speed. Some "old" functions are still superior to the new activeX. Even VBA seems to be slower than lisp. Heh!

JohnK

  • Administrator
  • Seagull
  • Posts: 10633
Learning the new Lisp ways
« Reply #10 on: November 19, 2003, 10:57:11 AM »
Bawahahaha!

I think it is fortran.

Daron, why is ActiveX is slower then lisp? (why do you think it is the way it is.)
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

SMadsen

  • Guest
Learning the new Lisp ways
« Reply #11 on: November 19, 2003, 10:58:16 AM »
:shock:

I know there ain't line numbers in BASIC anymore .. BUT!

daron

  • Guest
Learning the new Lisp ways
« Reply #12 on: November 19, 2003, 10:58:31 AM »
That's what I was thinking, but 'm not sure. Is fortran a dead language?

JohnK

  • Administrator
  • Seagull
  • Posts: 10633
Learning the new Lisp ways
« Reply #13 on: November 19, 2003, 11:00:06 AM »
I have a fortran compiler. Its still used.
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

SMadsen

  • Guest
Learning the new Lisp ways
« Reply #14 on: November 19, 2003, 11:00:15 AM »
There are many languages older than LISP - just think of how Ada got it's name! LISP is merely the second oldest language still in use.

daron

  • Guest
Learning the new Lisp ways
« Reply #15 on: November 19, 2003, 11:02:41 AM »
Quote from: Se7en
Daron, why is ActiveX is slower then lisp? (why do you think it is the way it is.)


Because it was written in the 80's by Bill and Company? Bunch o' pot smokers.

daron

  • Guest
Learning the new Lisp ways
« Reply #16 on: November 19, 2003, 11:03:54 AM »
Quote from: SMadsen
There are many languages older than LISP - just think of how Ada got it's name! LISP is merely the second oldest language still in use.


Ah! That I didn't know. What's Ada?

JohnK

  • Administrator
  • Seagull
  • Posts: 10633
Learning the new Lisp ways
« Reply #17 on: November 19, 2003, 11:05:19 AM »
Quote from: Daron
Because it was written in the 80's by Bill and Company? Bunch o' pot smokers.
Nope. Why is AutoLisp faster then ActiveX in AutoCAD?
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

Craig

  • Guest
Learning the new Lisp ways
« Reply #18 on: November 19, 2003, 11:06:43 AM »
I think Fortran is one of the oldest. You guys remember QBasic? :lol:

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
Learning the new Lisp ways
« Reply #19 on: November 19, 2003, 11:08:12 AM »
ActiveX ain't that old, maybe 4 years ago.

>Bunch o' pot smokers
Yea, a bunch of VERY wealthy pot smokers. You can say what you want about Mr. Gates and his Windows OS, but you don't get that rich by being stupid.
TheSwamp.org  (serving the CAD community since 2003)

SMadsen

  • Guest
Learning the new Lisp ways
« Reply #20 on: November 19, 2003, 11:14:42 AM »
Ada is a high level language (chosen as standard by your DoD in '79).

The name comes from Ada Lovelace (one of Lord Byron's oopses) who got fascinated by Babbage's algebra machines and set up a "language" .. or at least some methods .. to program them.

That was in 1830's or there about

daron

  • Guest
Learning the new Lisp ways
« Reply #21 on: November 19, 2003, 05:20:03 PM »
Craig and anybody else wanting to get started with Vlisp, there are a few great sites as well a few easy to follow tutorials like this one, written by Mark himself. So, if you have a moment to spare, you might have a look in the Teach Me forum. It's the place for turorials.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Learning the new Lisp ways
« Reply #22 on: November 19, 2003, 05:59:33 PM »
I can still remember turning in those damn punch cards for Fortran class at USF.
But i did love Apple Basic and 6502 machine language, my cassette was the only
permanent memory for my Apple until I got my first floppy drive.

Ahhhh the good old days.

Who ever said that was nuts.

CAB (almost as old as t-bear)
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.