With regard to last week's post on modifying the PDF sheet display, I've taken another approach and come up with the following lisp code that will allow you to import some or all of the sheets of a multi-sheet PDF all at once. I realize that the built-in PDFATTACH command allows you to place multiple sheets at once, but you can't see the sheets as you place them. This lisp code is also more of a "how-to" for use in larger routines perhaps - and because such, this is raw lisp code with no error checking. Feel free to dress it up and append the header.
Load the lisp file and then type in the command PMP. Select a multi-sheet PDF file, and then enter the number of sheets you want to insert (this should be equal or less than the total number of sheets in the PDF). At this point you can start picking the lower left corner for each sheet until you reach the end. Read more about Placing multi-sheet PDFs into AutoCAD, semi-automatically
When you attach a multi-page PDF file as a reference in AutoCAD, you can choose which sheet to display (see below).
But what if you want to change that reference to a different sheet in the PDF file, later on? There is nothing in the Ribbon to do this, and "Page Number" is a read-only property in the Properties Palette. You could detach the reference and add it again with the new sheet number, but the following lisp function is quicker.
The lisp function below allows you to pick the PDF Underlay object on the screen, and then enter a new sheet number. The image on the screen is updated as soon as the command completes. Make sure you choose a valid sheet. If the PDF file contains 9 sheets and you enter 10, then the PDF reference will disappear.Read more about Changing sheet to display in PDF Underlay
Don't be shy, there are tips from reminders about commands to complex autolisp routines, and everything in between (yes, there is even some VBA code). If you are looking for a routine, you can also find almost 10 years of previously published code at http://cadtips.cadalyst.com. What if you are having problems with some existing code? Drop into the one of the many forums out there, including Augi, CadTutor, and of course the Hot Tip Harry forum at Cadalyst, and ask some of the pros.
If 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.
Here is one way to generate a list of polyline vertices using lisp. This function requires one argument, a polyline entity. The polyline can be the old style POLYLINE entity (2D or 3D), or it can be an LWPOLYLINE entity.
I 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 about Accessing Civil 3D objects with autolisp
I didn't have my own example of this, and after checking out the DXF reference, it looked a bit more complicated than other entities, so I set out in search of some sample code that worked.... which led me to a post by "CarlB" over in the CADTutor forums that he had posted a few years ago. This worked great until I added in the scale factor and changed the pattern from SOLID to ANSI31. After a few iterations of trial and error, I managed to make it do what I wanted.
As it turns out, using (entmake) is about 10 times faster than using the (command) function in this case.
EDIT: I failed to mention that the example posted at the link above is for hatching a simple boundary defined by four lines. If you have arcs or other entities involved, the code will be a bit different. Read more about Entmake HATCH entity
I know this is a controversial topic, so let me clear the air right up front. This article is NOT a 'how-to' for decrypting or decompiling FAS files.
This topic seems to come up every now and then. Sometimes on the Autodesk newsgroups (where it's promptly deleted) or maybe on an unmoderated forum such as alt.cad.autocad. Either someone has "lost the .lsp file", and needs to decrypt the only thing left, the FAS file -or- someone is just openly looking for a way to get into someone else's protected FAS file. More reason to back up your source code, even print it out and store the hardcopy. Retyping is bad, but much better than the alternative. Read more about Decrypt FAS Files?