AutoCAD Visual LISP / AutoLISP :: Script On Multiple Files
Feb 7, 2012
I have a lisp routine that gathers all xrefs from the current drawing and creates a script that opens each xref, runs specific commands then saves/closes each drawing. Once all commands have been ran in each xref I would like the script to reload all xrefs in the original drawing that the script was called from. I have a reload-all lisp that is already loaded in all of my drawings but for some reason when this command is called at the end of the script it will not run.
Is there a way to have the script continue to run in the original drawing that it was called from? Or maybe even pass control back to the lisp that created/called the script? Its seems to me that the easiest thing would be to have the script continue to run after it has gone through all of the specified drawings but this is not working.
i am wondering if it is possible to alter a specific attribute in cca 250 files? I have this template which has like 50-70 attributes,but not all of them are used. I have to change only one attribute in all of the files. For instance, i have an attribute with a specisfic tag, but the content of it is ie MARK, i want to change MARK to PETER, without having to open,click,retype,save,close every file. Is it possible to automatize it somehow? maybe lisp, batch or even VB?
Is there a way to have a Lisp Routine open multiple script files?
I have 10 types of scripts, that are specific to the type of file they open (as shown below). which simply open a file, purge/audit, save and close.
open "Q:PROJECTS321700Field ManagementCoordinationElectricalSleeving613321700_ES-613-Lev01.dwg"audit y-purge all * n-purge R * naudit yqsavecloseopen "Q:PROJECTS321700Field ManagementCoordinationElectricalSleeving613321700_ES-613-Lev02.dwg"audit y-purge all * n-purge R * naudit yqsaveclose The file above was named ES-613.
I would like to create a Lisp Routine that opens this script, *Some how closes the file*, and then opens another script.
I can run the ACC fine on multiple DWG files with a basic set of commands in the script file. But, when I try to load an AutoLISP/Visual LISP file and run it from inside the script file, it doesn't work. How to run a LISP file using the ACC?
how to extract the attribute value of a particular block in multiple drawings to an excel file.
Eg... there are nearly 800 drawings where I need to list down the description and Drawing number which is mentioned in the title block name "Title". The Drawing Number and the description is done in same attribute block. extract the data into an excel file or txt file. All the drawings are saved in one location.
I'm creating a drawing set that has over 100 sheets with varying amounts of viewports on each sheet (from one to four). Each sheet is its own file, so there is only one layout per file. For each section of the drawing set, the viewports will have the same layer state.
Is there were a way to update the layerstate of each viewport through a batch LISP routine? This would save me DAYS in opening each file, importing the layer state, and restoring it for each viewport. It seems straight forward, but I have no idea where to start with batch routines.
Lisp (or a native way) to lengthen multiple polylines or lines at once to the same length by entering that length? I found the following lisp routine which extends a line an entered amount, but it has to be on a specific layer, and I want to enter the finished length, not how much to extend it.
(defun c:blen (/ lSet tmp doMode objLst actDoc) ;; *lDel global variable remembered during session (or *lDel (setq *lDel 2.0)) ; default value (princ " >>> Select lines to extend/reduce <<< ") (if (setq lSet [code].........
I have been using to copy multiple objects from x-refs. The problem I'm having is that when I have the user input prompts in a macro i can screw up the command if i accidentally miss picking my selection set. I'm new to LISP and having trouble with selection sets and selection filtering.
On another note: I'm trying to rename layers copied this way to remove the "$0$" and using the rename command swapping $0$* with * works, however in the -rename command it does not.
I'm using a Lisp which searches a certain folder and then updates all blocks, which are nested in that folder.
My issue is, that I'd like to use more than one folder on different path, where the LISP can search for this files. Is there a way to use multiple search path?
The code I'm using now to search for the blocks is: (setq dir "I:\AutoCAD Blöcke\Template\Support")
I need to divide thousands of lines into half, but AutoCAD divide command can only allow you to select one line at a time.Is there any way we can divide multiple lines at once.
I'm currently working on a project that requires that I eTransmit a large quantity of files, which is becoming very time consuming. I need writing a script that will allow me to etransmit all of the files at once.
My requirements:
- All .dwgs must be saved as individual .zip files with all references included. - .zip file must have same name as associated .dwg (basically just swap extensions).
My problem is that I want to have AutoCAD return the filename sans extension and filepath when I'm prompted to input the filename for the .zip file. How can I do this? I've been looking up options using VBA, but with limited success given.
This time I'm wrestling with getting the values from multiple blocks. The blocks all have the same name but at least the attributes have names this time. Each block have exactly 4 attributes, like: att1 (a number representing chronological order), att2 (some data), att3 (the actual date as a string of when the data was added), att4 (some more data)
I need to get and store the attribute's values. I was hoping to make a selectionset of the blocks and step through using the chronological order number.
At this point I have tried several combinations of foreach and ssget "x" (list (cons 2 MYBLOCK)), but I keep getting errors that I'm sure are telling me that I'm not passing the correct information to the function for iterating through. I'm banging my head.
I ment midpoint instead of center.Is it possible to select several different line entities and have them each rotated around its midpoint, or end point, so afterwards all have the same direction specified by a number or specified by direction of another entity?I wish command matchprop had that rotation option in its Settings.
I have some general knowledge in lisp coding. But I can't seem to figure this one out (even to get started). What I want to do is make a lisp that:
- selects a line
then
- select any amount of text (any type)
then
- moves all the text to that selected line without rotating the text
if a line is perfectly horizontal then move the text of the y axis.
if the line is vertical then move the text of the x axis.
or there can be a prompt asking the user to chose the angle or axis in which the text will move (say if they want to move the text to a slanted line, you can choose to move the text on an angle, while keeping the same format and not rotating the text, or you can ask the user if they want to move it only vertically or horizontally)
I would really like the code to integrate into my autocad.
I know how to retrieve the entity information from the block, but can't figure out how to write the loop statement to loop, look for first attribute, assign to a variable, goto next attribute, assign to different variable, etc., etc...
In my research, most programs I've seen it execute the loop, assign to a variable, then print/put that data somewhere, loop again and utilize the same variable to print/put the next data somewhere.
I would like each attribute within a block to be assigned a separate variable.
I am trying to write a piece of a program that gets the layers from a drawing, and checks each one against a list of layers. If the layer is not a member of any of the lists it asks the user which layer list to add it to. This is what I have so far, but every time I try to run it I get a bad argument error.
Depending on the user's choice the layer gets written to an external file where the layer lists get their layers from in the beginning and then adds the layer to the relevant list to use later in the program.
Lisp program, by selecting on screen multiple block attribute and to change those selected (by picking) attributes to colour 252.
At the moment, I'm using a custom macro : ^C^C-ATTEDIT C;252;;
But if I've got a lot of attributes to change, it takes awhile to complete.
I know about BATTMAN but I do not want to change the block entities in that way. The reason I want to change the attributes to colour 252 is because here at this company we do existing drawing in colour 252 and any new equipment on its proper layer colours.
Any lisp routine on how to change "Drawing Properties" (fields via Mtext) on multiple single drawing files?
There are several instances where we would need to take a project to create another one and simply change the title block description.
As of now, we are opening each drawing (there could be hundreds) and modifiying the drawing properties on each drawing to change the customer name and other project descriptions.
These are not attributes, but fields. I've researched alot on here and couldnt find anything.
I have a lisp routine that uploads all the blocks contained within a specific folder and inserts or redefines all blocks of the same name within the current drawing.
My problem is that when I run the routine I prompts me that it can't fine the folder? I created a folder called "blocks" and is located straight onto my C:..........but it still doesn't work.
;FUNCTION TO UPDATE ALL BLOCKS WITHIN A DRAWING ;FROM A SPECIFIC DIRECTORY
I have this code that I wrote years ago that I want to update to select two types of civil3d objects and show them selected with grips on the screen. This function works fine
but if I add the extra object like this which I assume is the wrong syntax i only get the second type of objects. Need correct syntax I should be using for selecting more than one object in an ssget statement.
I have a drawing which contains about 100 "areas". These areas are closed polylines. I would like to get a total area of all these polylines.
I have tried using AutoCAD 2002's AREA command, but I am only able to select one item at a time, (AREA, Add, Object). This is fine for calculating a few areas. It gives me a running total of each item that I select.
Using the LIST command works OK for a few items, but you still have to wade through all the other information to get the area info for each item.
Is there a way to select crossing ALL the areas that I have, and have it return a total?
Any routine to re-size viewports in multiple layouts? We have to re-size viewports as they were created a little too small and are now spread across almost 1000 drawings in 18 dwg.