Programming
Afralisp 2.0
Submitted by rkmcswain on Fri, 04/16/2010 - 07:16If you have been around AutoCAD for a while and have done any Autolisp or VBA programming, you have probably run across a great Autolisp and VBA site with tutorials and code examples named AfraLisp. About 4 years ago, the Afralisp website, created by and formerly maintained by Kenny Ramage was taken over by David Watson, who also runs http://www.CadTutor.net.

David has just completed Afralisp v2.0, a total rework of the website. Everything has been reorganized, and the whole site has a fresh look. Stop by and take a look, and leave some feedback. Read more »
Accessing Civil 3D objects with autolisp
Submitted by rkmcswain on Thu, 12/17/2009 - 13:42I have been working with the Civil 3D 2010 API in visual lisp recently, and I thought I would share an example of working with an alignment object. This example has plenty of comments, but basically it shows you how to find a point near the alignment based on a station and offset. Then it does the opposite and shows you how to determine the station and offset, given a point. For clarity, I have left out most of the error checking. Read more »
Exploring the autolisp SSGET function - part 2
Submitted by rkmcswain on Wed, 08/20/2008 - 22:00Ok, getting back to the last (ssget) call in part 1...
(ssget "_W"
(list 5.0 5.0)(list 8.0 8.0)
'((0 . "CIRCLE")(-4 . "<")(40 . 1.0))
)
Read more »Exploring the autolisp SSGET function - part 1
Submitted by rkmcswain on Wed, 08/20/2008 - 07:30If you have written routines with Autolisp, then you have probably used the (ssget) function to select entities on the screen, either automatically or by prompting the user.
(ssget) is a powerful function that can do more than you probably realize. Let's look at a simple example.
(ssget '((0 . "TEXT")))
Read more »S::STARTUP Function
Submitted by rkmcswain on Mon, 08/18/2008 - 21:10In the previous post about Startup Lisp Functions, the special (S::STARTUP) function was mentioned. Startup lisp code is loaded before the drawing is initialized, but you cannot call the (COMMAND) function until after the drawing is initialized. The solution is to place your (COMMAND) calls inside the (S::STARTUP) function. Read more »
Startup Lisp Functions
Submitted by rkmcswain on Mon, 08/11/2008 - 14:01If you have lisp routines that you want to make available in each drawing session, forget the "Startup Suite" and load them using the "acaddoc.lsp" file. "acaddoc.lsp" is not included with AutoCAD, you create it yourself. But it is nothing more than a plain lisp file, except that the first one found at drawing startup (just put it in your support file search path), is loaded automatically each time a drawing is opened. Read more »
Reading a TXT file using LISP
Submitted by rkmcswain on Sun, 07/13/2008 - 20:24Here is a simple example of how to read a TXT file into lisp and then do something with the contents. In this example, the TXT file contains coordinates, and the code will draw either points or lines.
One thing to keep in mind. Most times when you open a file for read or write, you should open the file, perform the entire operation, then close the file. Keep the code to a minimum while the file is open. This way if you run into an unhandled error, the file isn't stuck open, and in the case of shared files, you are not locking the file for an extended amount if time. Read more »
Free Autolisp Resources
Submitted by rkmcswain on Thu, 01/24/2008 - 18:42Here are some free Autolisp resources including tutorials and sample code:
Command vs. entmake vs. vla-add
Submitted by rkmcswain on Fri, 12/14/2007 - 08:14If you program with autolisp, you have probably used the command function at some point, probably to construct drawing entities. There is certainly nothing wrong with that. However, if you are working on a large program that constructs a lot of drawing entities, you may have noticed that the command function runs pretty slow.
I put together some tests to compare the (command) function to two other methods of entity creation, (entmake) and (vla-add...). The test constructs 1,999 line entities using various methods.
Selection highlighting in AutoCAD
Submitted by rkmcswain on Wed, 12/12/2007 - 13:37Starting in AutoCAD 2006, you can specify a highlight color and opacity to your selection areas as illustrated by the green area shown in the example below.

Below is a description of these options and how to change them.

If you want to go through the OPTIONS dialog, open it up and switch to the Selection tab. Click on the Visual Effect Settings button. Everything you need to control is there on the right half of this dialog, shown above. Read more »
All content is copyright © CAD Panacea 2008-2010 unless otherwise noted.
All content of CAD Panacea is solely my own personal thoughts and opinions and do not represent my employer or any others.
All comments posted to this blog are the sole responsibility of the person making the comment.
Google, as a third party vendor, uses cookies to serve ads on this site. Google's use of their cookies enables it to serve ads to users based on their visit to your sites and other sites on the Internet. You may opt out of the use of these cookies by visiting the Google ad and content network privacy policy.




Recent comments
1 week 1 day ago
2 weeks 20 hours ago
2 weeks 1 day ago
2 weeks 2 days ago
2 weeks 2 days ago
2 weeks 3 days ago
2 weeks 4 days ago
2 weeks 5 days ago
2 weeks 5 days ago
2 weeks 6 days ago