AutoCAD Visual LISP / AutoLISP :: Script To Go Through And Clean Up Bunch Of Drawings In Given Folder

Feb 7, 2013

I was wanting to create a script to go through and clean up a bunch of drawings in a given folder. I've written a lisp routine (cleanx) that works fine when you run it on a single drawing, but I'm having some trouble integrating it into a script. As it is currently, I'm experiencing several issues -

1) It prompts the user for an 'object' after finding 0 objects. It seems to be caused by the line,

(command "-layer" "u"    "*" "t"    "*" "on" "*" "" "")

in 'cleanx' based on the text window, but I'm not sure why it does that given that if I run cleanx directly it doesn't prompt me.

2) It ends with saying 'Really want to discard all changes to drawing?' which confused me as I use Qsave before I close, and then confused me further when I realized that the text window suggests that this prompt comes up after the 'open' command, and that if I type <Y> (exit without saving) then it asks me to select a file. Why doesn't it save, close and then open the next file automatically?

;;; Main program, command: batchjob;;; By Abdul Huck(defun c:cleanb (/ dwgs file dwgName scrFile folderName) (setq folderName (browsefolder "Select folder to perform batch job: ") ) (setq dwgs (vl-directory-files folderName "*.dwg")) (setq scrFile (open (strcat folderName "\batchJob.scr") "w")) (write-line "SDI 1" scrFile) (foreach file dwgs(setq [code].......

View 5 Replies


ADVERTISEMENT

AutoCAD Visual LISP / AutoLISP :: Opening Drawings With Default Visual Style Set To 2D Wireframe

Oct 7, 2013

Is there a way to programatically set a visual style before a drawing actually opens?

We have some huge models and people seem to forget to change their visual styles back to 2D wireframe before saving and exiting drawings.  Some models will crash on some workstations when trying to open in a rendered mode.

I found a lisp with a function that looked to set viewport visual styles.  But it does not seem to be supported anymore. --> (vla-put-VisualStyle vport 1)

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Rotating 600 Drawings

Jul 18, 2012

I have to go into approx 600 3D Models and rotate them all by 90.

I've just tried to search for a lisp that will do this to all of these files in one directory and can't find one. Something that will do this and save loads of time. I need to do this tonight so that these MEP files will all be ready for tomorrow morning.

View 1 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Add A Block To Numerous Drawings?

Nov 6, 2013

(setq plist (vl-directory-files (getvar "dwgprefix") "*.dwg" 1))
 (foreach ins1 plist
 (setvar "lispinit" 0)
 (command "open" ins1)
 (command "insert" "C:UsersasmoleyDesktopBSK100_BD" "0.875,0.28125")
 (command "save" ins1)
 );foreach
 (setq plist nil)

bad variable name in SETQ and malformed string on input errors.

View 1 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Move Tables In Drawings?

Jan 22, 2013

I have a lot of drawings with two tables in them, and they are all over the place.

I'm able to change the columns widths using the following

(setq PipeList (vlax-ename->vla-object (car (entsel))))
(vla-setcolumnwidth PipeList 0 0.25)
(vla-setcolumnwidth PipeList 1 0.25)
(vla-setcolumnwidth PipeList 2 2.0)
(vla-setcolumnwidth PipeList 3 1.5)
(vla-setcolumnwidth PipeList 4 1.625)
(vla-setcolumnwidth PipeList 5 1.0)
(vla-setcolumnwidth PipeList 6 1.75)

I'm wondering if I could modify the assoc 10 value to a specific point of '(8.5 10.3675 0.0).

View 3 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Creating Drawings From Excel

Dec 16, 2011

This probably isn't the correct discussion group but not sure where else to post this. 

My sales department wants to be able to create drawings based on entries in selected in their Excel qouting tool.  Basically, they want to configure a product in the field, and be able to show the customer the drawing with TrueView. (They don't have AutoCAD installed).

I would think the best I can do, is manipulate a .dxf file based on their selections but that may get very complicated.

View 2 Replies View Related

AutoCAD Visual LISP / AutoLISP :: How To Delete Linetype In Drawings

Nov 6, 2013

I have some drawing that contains PHANTOM2 linetype.

I can't delete this linetype from my drawings!

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Insert Block Into Several Drawings

Aug 2, 2013

Any way to insert a block onto many different drawings quickly? I have a title block I need to insert into about 100 drawings. It seems very tedious to open each drawing and insert 100 times.

View 3 Replies View Related

AutoCAD Visual LISP / AutoLISP :: List Of Drawings From One Drawing To Next

Dec 5, 2012

I have the following string of code, that I'll write in everyone's start-up suite. I'm able to retrieve a list of files I want to modify, for whatever reason.  (One example, when plotting drawings with layouts, sometimes the shadeplot setting is wireframe, and not classic hidden, though it's been set up in our templates).

The huge question is, can I get a list of drawings to a variable in one drawing, and have access to that variable list, in the next drawing I open?  I'll iron out the bugs on read-only statuses, or manipulating drawing states later.

(defun GetDrawings ()
(setq currentpath (getvar "dwgprefix"))
(command "pspace")
(setq DrawingList (dos_getfilem "Select a file" currentpath "Drawing files (*.dwg)|*.dwg|All files (*.*)|*.*||"))
(setq ListOfDrawings (cdr DrawingList))
(setq DrawingPath (nth 0 DrawingList))
[code]...

View 1 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Finding All JPG References In Drawings

Dec 31, 2013

I searched the groups and the closest discussion I could find was here but there didn't seem to be a clear cut solution. [URL]. I have a jpg file that I needed to apply some transparency to and saved it as a png file. I now want to delete the jpg file from the folder but it's being referenced in several drawings, and I don't know which ones. Is there a way to reverse the function of Reference Manager (perhaps with a different app), ie find all the drawing files that reference my jpg file?

Intel i7 3.33Ghz, 16Gb RAM
Nvidia Quadro 2000D
C3D 2012 SP4, holding off on C3D 2014
Win 7-64

View 3 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Get Folder Name Up One Level?

Sep 14, 2012

I am currently using this code to get the folder name containing the current drawing.

 FolderName = Dir(ThisDrawing.path, vbDirectory)
 What would I use if I wanted to get the foldername one level up (third)?

ex. C:FIRSTSECONDTHIRDFOURTH

View 3 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Delete All Empty Layouts From Drawings?

Mar 10, 2004

I am trying to create a lisp to delete all the empty layouts from mydrawings. I do not see any code to control this.

View 8 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Modify Properties On Multiple Drawings

Nov 6, 2012

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.

The drawing is attached.

View 3 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Update Several Similar Drawings Through BAT File

Feb 7, 2013

i am working on writing a lisp to update several similar drawings through a .bat file.  One of the things i would like to do is to automatically increase the revision number by one.  I have figured out everything except how to select the text.  Looking at the database, the coordinates for the revision number are (10 15.2908 0.0295 0.0).  However, (setq a (ssget "x" '((0 . "TEXT,MTEXT")(10 15.2908 0.0295 0.0)))) returns nil. 

If each drawing's revision number is not in the exact same location, is it possible to select by a range of coordinates?  Using (getpoint), the range is from (15.5 0.0 0.0) to (15.1805 0.1409 0.0).

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Create Layouts In Multiple Drawings

Aug 10, 2013

I have a csv file that has the drawing names and their layout names listed in columns A and B. Before I begin a project, I have to create the Sheet List (in Excel) and the csv file. The csv file is needed because I have a lisp routine that reads the csv and updates all my Title Block attributes in all my drawings. (VERY sweet program)  What I'm wanting to do, is create new layouts (using my dwt) based on the information in the csv file. So, when I start a new project all I need to do is create the base drawing files first. Then, in my csv file I've got those drawing names listed in Column A and their corresponding sheet titles (Layout names) in Column B. I run the lisp and it reads the csv and creates layouts in all those base drawings and naming the layouts with the sheet titles from column B.

Column A                                                      Column B
DRAWINGS                                                 SHEET TITLES
drawing1.dwg                                               A100
drawing1.dwg                                               A101
drawing"n".dwg                                            "n"500
Etc, etc.

I'm needing a way to automate creating hundreds of layouts at once. (very time consuming).So the lisp has to be able to read a csv (or Excel--doesn't really matter) and create new layouts (using my dwt) in as many drawing files represented in column A. [and filtered so it doesn't create duplicates so I can run the routine at a later date when new sheets are added to the drawings] Captcha?

View 1 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Put List Of Open Drawings Onto Ribbon?

Dec 3, 2012

I want to put the list of open drawings (like the window tab on the menubar has) onto the ribbon? Is this possible?

View 2 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Folder Selection Dialogue Box?

Aug 10, 2012

I'm working on a lisp that goes through a whole list of files and does different things to those files.  I've been racking my brain for a way to select just a folder via a dialogue box, but haven't found a way.  I'm sure it can be done with dcl, but I don't know where to start. 

This would not be the standard "file" selection box, but would only list the folders and let me select one even if there are others "under" them.  This is what I'd like it to look like. 

I'm not sure if there is a standard AutoCAD box that I could call for this or not

View 5 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Extract A Folder Name Within Dwgprefix

Aug 17, 2012

I’m looking to extract the second from the last directory within the dwgprefix of

"P:Projects66 Structural666-4800-00 TPA666-4815-00 Res4815 Res Figures"     (i.e. 666-4815-00 Res) 

This is what I have so far:

(defun c:tmp ( )
(setq P1 (getpoint "
Pick point: "))
  (command "text" P1 "" ""
    (strcat
      (vl-filename-base
        (vl-string-subst "." "\" (getvar 'dwgprefix) (vl-string-position (ascii "\") (getvar 'dwgprefix) nil T))
   ))))

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: SPACE In Folder Or Path Name

Feb 12, 2013

I'm try to write a list to produce a script file!I just want to insert a dwg file in current drawing.back to MS Windows, in case of having [space] in a folder's name, we should use "" marks:

CD "Program Files"; DEL "file 10.txt"; ....

I tried both with and without "" marks but I failed!I pasted part of my code below with result of each case:

(setq TBFile "H:z.autocadA1 A2 A3.dwg")
(write-line "-INSERT" des)
(write-line (strcat "*" TBFile) des); ; *H:z.autocadA1 A2 A3.dwg  <<=should be this
(write-line "0,0" des);;insert point
(write-line "1" des);;xyz scale
(write-line "0" des);;rotation
[code]....

View 4 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Edit Attribute Text In Multiple Drawings

Sep 16, 2012

I need to be able to batch process a bunch of title block attributes automatically.

Block Name: Title Block

Tag Name: SH

Currently they come out with just the number 1, 2 , 3 etc I need to add a leading zero ie 01, 02, 03 etc

All the scripts I have will just replace the number with another

I just want to append the zero infront of the existing number

ie the code will need to read the existing number and decide if its less than 10. if it is less than 10, then the code just needs to append the leading 0. if its 10 or over, then do nothing.

View 4 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Script For Moving Drawing In Multiple Drawings?

Apr 23, 2013

QT : 1 . I  am looking for a script to move the drawing such that the left bottom corner is placed at 0,0  without any manual intervension. This is to done for all the files in a particular folder.

QT : 2   In the same script file I want one block to be inserted also in each drawing. the block is placed in the network drive . so how to copy the path after putting the insert command.  I tried -insert;  but it is not working how can i give the path in script file.

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Global Attribute Change Multiple Drawings

Feb 6, 2012

We have a few hundred drawings that we need to change certain block attributes. We need to change the valve of the text in that attribute from whatever it is (doesn't matter what it is) to a specific text string.

For example: If the attribute is called "name" and has the text string of ALAN in it in some drawing or BRUCE in other drawings, we want to chaneg all drawings to TOM.

View 4 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Open Drawings In Previous Format Read Only

Nov 21, 2011

I am looking for a way to force all DWG files created with previous versions of AutoCAD to automatically open "Read Only".  For example, using Civil 3D 2011, I open a file that is a 2007 format DWG.  I want this file to automatically open read only, and inform the user that it has opened read only. 

I'm hoping that this is possible, since opening a 2007 format DWG in a newer AutoCAD already tells you that it's an older format in the command line, and files can already be opened as read only.

View 8 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Create 2D Drawings From 3D Models Using Layers With Different Colors?

Jul 25, 2013

I am using Autocad 2012. I need to make some  2D execution drawings from a 3D model. I tried to use the following commands: flatshot, flatten §ion plane. All of them are having bad results. From all this 3 commands the closer to my needs is the flatshot. But I am working with many layers which have different colors, so when I will generate the 2D views I need to see the same color as the layers have (each color is for a particular medium). 

I am using this command without showing the obscured lines. When I am generatic the isometric views with the flatshot I am seeing strange objects (UFO), is far away from the original model, you can see in the attachment.

My questions are: It is possible to generate somehow 2D views (front views&isometric views) seeing the color which every element has, and it is possible to correct somehow those ugly isometric views ( the guys from autocad should do something with this, because when I am generatic a isometric view the 2d drawing that I recived is completely different from the 3D model !).

I want to make the drawings using the 2D views, because the 3D Models are very big (50-60MB) and it is very hard to work with them!  

View 7 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Change Library Of Drawings To Color By Layer?

Jan 24, 2012

I have a library that has a primary folder with 11 subfolders. If the LISP can go through all the subfolders, that would be great. But, if it cannot, I can work with going into each subfolder and running the routine. There are over 12,000 files and I don't have the time to open each one and change the color.

Here's what I need the LISP to do:

open the drawing

select everything

change the color to "bylayer"

save

close

open next drawing in folder and repeat

Once it gets to the end of the folder it can stop.

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Routine To Delete Specific Blocks From Drawings?

Aug 25, 2005

I need a LISP routine that could delete specific blocks from drawings. I have over 100 drawings, each having 4 blocks that I need to get rid of.

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Script - Change Display To High Detail On All Drawings

Jan 30, 2013

I need to be able to set all drawings to display config "High Detail".

View 1 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Zoom Extents / Save All / Close All Open Drawings?

May 26, 2010

how to make a routine for zoom extents, save all, and close all open drawings in a single routine?

View 3 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Globally Find / Replace Text Across Multiple Drawings

Sep 16, 2002

I am trying to globally find and replace text in Autocad 2000 drawings. If I have a folder containing 10 Autocad files, I want to open every file in that folder, while in each file, search for a certain line of text and replace that text, then close that file, open the next and find/replace text in that file.

I've created an autolisp file that allows me to open all the files in a certain folder, but I can't find any way, either thru autolisp or scripts, to allow me to find and replace text in each autocad drawing without using Autocad's "find" command to manually enter the text when each drawing is open.

I want to setup the autolisp file to accept input up front, save the "old text" and "new text" to variables, then use those variables as the lisp routine is running.

This version was used to automate creating PDF files. The command 'PDF' is a command from another Lisp file.

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Open Windows Folder Of Current Drawing?

Jun 5, 2013

How to create lisp which i can simply type in to the command bar so that the current drawing's filepath-folder will be automatically opened by windows explorer?

running AutoCAD 2012 / Windows 7...

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Set File Location From Shared Dropbox Folder

May 10, 2012

I would like to put our company programming on a Dropbox folder.  I have not fully tested everything out yet, like locations of lisp files and image name...

One thing I am struggling with is an absolute path in my lisp file:

(setq FL:FLAYTAB "C:\Users\dvanerem\Dropbox\Canova and Stone\Customizations\Autodesk AutoCAD 2010\Programming\OENV-RCP.TAB")(FL:LoadTable)

I am confused how this would work with other users? Or does AutoCAD automatically correct for this? 

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved