Jump to content

Recommended Posts

Posted
Also, take note of the edited post above - that apropos window is handy.

 

Now thats interesting. I tried several prefixs and the ones not listed in the AutoLISP Reference section would go straight to its corresponding ActiveX and VBA Reference.

 

That is real helpful.

Thanks Lee

  • Replies 33
  • Created
  • Last Reply

Top Posters In This Topic

  • The Buzzard

    15

  • Lee Mac

    11

  • rkmcswain

    3

  • Se7en

    2

Top Posters In This Topic

Posted Images

Posted

Visual Lisp on the other hand is like doing a cross-word puzzle with a blind fold on with the help section thats available.

 

Just asking, but do you have any experience with VBA?

If not, maybe that is why it comes more naturally for others...?

 

Forget about the actual lisp code for a while and study the "ActiveX and VBA Reference > Object Model". Once you "get it" - you will "get it" -- if that makes sense....

 

Everything (except the top level application) has a parent, and you generally have to work your way down the tree. To find the LINETYPE OF A LAYER for example, you start at the application, then the document, then the layers container, then the layer itself, then query the properties of that layer.

 

Another example... To draw a CIRCLE, you start with the application, then the drawing (or document), then you can only create entities in a BLOCK, MODELSPACE, or PAPERSPACE, so you have to choose one of these containers, then you can create the CIRCLE.

 

The actual lisp code will make more sense once you understand what it is you are trying to do in that particular line of code.

 

Also - create variables for things like the application, current document, and the container (MS, PS, or block) that you are working on - rather than accessing these items over and over in the same routine.

 

I apologize if it seems like "talking down" to you if you already understand this. That was not the intent. Good luck.

Posted

Great tips and examples McSwain, I might add this if I may:

 

Take a look at this Buzzard, if you get a chance - it explains more of what rkMcSwain was talking about:

 

ex.png

Posted
Just asking, but do you have any experience with VBA?

If not, maybe that is why it comes more naturally for others...?

 

Forget about the actual lisp code for a while and study the "ActiveX and VBA Reference > Object Model". Once you "get it" - you will "get it" -- if that makes sense....

 

Everything (except the top level application) has a parent, and you generally have to work your way down the tree. To find the LINETYPE OF A LAYER for example, you start at the application, then the document, then the layers container, then the layer itself, then query the properties of that layer.

 

Another example... To draw a CIRCLE, you start with the application, then the drawing (or document), then you can only create entities in a BLOCK, MODELSPACE, or PAPERSPACE, so you have to choose one of these containers, then you can create the CIRCLE.

 

The actual lisp code will make more sense once you understand what it is you are trying to do in that particular line of code.

 

Also - create variables for things like the application, current document, and the container (MS, PS, or block) that you are working on - rather than accessing these items over and over in the same routine.

 

I apologize if it seems like "talking down" to you if you already understand this. That was not the intent. Good luck.

 

 

I appreciate a thorough explanation. No need to apologize. It just seems to be a completely different way to learn coding than what I am acustom to. Also when it takes so long to get the full understanding of it, It can become frustrating since I got a better grasp for regular lisp than compared to this. I know it will come in time, But I have so much of other things I want to learn with regard to regular lisp that there seems no room for to fit VL in. When you cannot devote the time for it then it gets more difficult to retain what you have already learned.

 

But Thank You for the explainations.

Posted
Great tips and examples McSwain, I might add this if I may:

 

Take a look at this Buzzard, if you get a chance - it explains more of what rkMcSwain was talking about:

 

 

[ATTACH]13341[/ATTACH]

 

I will check out all this stuff, But I will need to get myself some better reference material to use also.

 

Thanks

Posted
I will check out all this stuff, But I will need to get myself some better reference material to use also.

 

No probs Buzzard.

 

When you say better reference material, have you look at the references already in the help files?

 

For example:

 

 

ex.png

Posted
No probs Buzzard.

 

When you say better reference material, have you look at the references already in the help files?

 

For example:

 

 

[ATTACH]13342[/ATTACH]

 

Most of what I have is the developer help section. A bit on the dry side, But it always got me thru regular lisp. I need materials other than this that will explain things in a way that I can relate to. I just have a full plate at the moment, But plan to visit a book store.

Posted

Mr Lee, I need to discuss about lisp personally. Do you have an email address, if you dont mind?

Thank you

 

m4rdy

Posted
Maybe this will help... look at the Visual LISP Developer's Bible

http://www.steinvb.net/vldb/

 

Thanks for the share Ipseifert,

A very good read and lots of information.

Posted

Sorry i couldnt find it.

 

Dave Stein is/was (hes not doing autocad anymore) just an awesome guy. He was funny, nice and uber smart. A very good book.

Posted

Buzzard,

 

I realise that there is not much "specific" information on all the property and method functions.

 

But perhaps it would be easier to ease you into VL by looking into the list functions, such as vl-remove-if, vl-remove-if-not, vl-member-if, etc..

 

These are not too much of a step up from the regular AutoLISP functions, and you should be able to get to terms with them relatively quickly, after a few examples. These functions are also documented in the VLIDE help.

 

Also, as I said, look into the curve functions. I couldn't live without these functions, and they also are not hard to grasp and are documented well.

 

As a quick example,

 

Say for instance we want to find the Start and End Points of a line.

 

Lets say ent is our entity name for the line.

 

In AutoLISP:

 

(setq spt (cdr (assoc 10 (entget ent))))
(setq ept (cdr (assoc 11 (entget ent))))

 

In VL:

 

(setq spt (vlax-curve-getStartPoint ent))
(setq ept (vlax-curve-getEndPoint ent))

 

But start and End points are just the tip of the iceberg with these functions.

 

I find the vlax-curve-getClosestPointto a particularly useful function.

 

If you supply it an entity and a point, it will return the closest point on the entity to the supplied point.

 

Definitely worth a look.

 

Lee

Posted
Buzzard,

 

I realise that there is not much "specific" information on all the property and method functions.

 

But perhaps it would be easier to ease you into VL by looking into the list functions, such as vl-remove-if, vl-remove-if-not, vl-member-if, etc..

 

These are not too much of a step up from the regular AutoLISP functions, and you should be able to get to terms with them relatively quickly, after a few examples. These functions are also documented in the VLIDE help.

 

Also, as I said, look into the curve functions. I couldn't live without these functions, and they also are not hard to grasp and are documented well.

 

As a quick example,

 

Say for instance we want to find the Start and End Points of a line.

 

Lets say ent is our entity name for the line.

 

In AutoLISP:

 

(setq spt (cdr (assoc 10 (entget ent))))
(setq ept (cdr (assoc 11 (entget ent))))

 

In VL:

 

(setq spt (vlax-curve-getStartPoint ent))
(setq ept (vlax-curve-getEndPoint ent))

 

But start and End points are just the tip of the iceberg with these functions.

 

I find the vlax-curve-getClosestPointto a particularly useful function.

 

If you supply it an entity and a point, it will return the closest point on the entity to the supplied point.

 

Definitely worth a look.

 

Lee

 

Thanks Lee,

 

At the moment I am bouncing between a couple of threads looking for some help. I have already reviewed briefly some of the information on this thread. Some of it I can grasp and the rest I really need to disect. I have put off writing complete codes for the moment. I think the best place to start VL would be small functions already written in lisp used in some of my completed programs involving layer, save variables and things of that nature. I just have to make the time for it. I have made notations of the postings in this thread and others for future reference.

 

Thanks,

The Buzzard

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...