AutoCAD Visual LISP / AutoLISP :: Batch Convert DGN To DWG?
Nov 23, 2011My work needs to convert thousands of DGN files to DWG. We are using AutoCAD 2012. Is it possible to batch convert dgn files with a LISP and a mapping file?
View 9 RepliesMy work needs to convert thousands of DGN files to DWG. We are using AutoCAD 2012. Is it possible to batch convert dgn files with a LISP and a mapping file?
View 9 RepliesI am trying to make a lisp to export to dgn for use in a batch. I have tried the following but get hung up at an "invalid path" error. I think I am not passing to -dgnexport a path in the correct format.
(defun c:deport()
(setq fname (getvar "dwgname"))
(setq fpath (getvar "dwgprefix"))
(setq dgnname (vl-string-right-trim "." fname))
(setq dgnnamenew (strcat fname ".dgn"))
(princ dgnpath)
(command "-dgnexport" "V8" dgnnamenew "master" "standard" "C:ProgramDataAutodeskACA 2011enuTemplateAutoCAD
TemplatesV8-Imperial-Seed3D.dgn"))
We've recently converted all our microstation drawings to autocad now that the company has decided to go with one cad program company wide.
One of the issues we are having after getting the drawings back from the this co. converting them is the cells to blocks convertion inside the drawing. when we open a drawing and see a "Fuse" block for instance and if it a has multiple inserts, it named them:
Fuse
Fuse_1
Fuse_2 etc....
is there a lisp routine or some command that would replace the "Fuse_*" blocks with "Fuse"..I've been searching the forums and know about the express tool Replace Block but need to be able to automate somehow.
I thought about trying to rename each of the "Fuse_*" but of course it won't let you rename to a block name that already exists..
I cannot get my lisp routine to run when I batch plot in AutoCAD 2014. It's loaded into the startup suite and runs when I open the individual drawings but not during a batch plot. How can I get this to run during a batch plot?
View 9 Replies View RelatedI recently upgraded to a new PC.
We get a lot of files from customers where there are multiple drawing borders all in model space.
Sometimes as many as 150-200 borders in one file that we need to print for the shop floor.
Years ago, I wrote a LISP routine that prompts for printer settings (Fit or To scale, etc.) and then prompts for
2 corners of each border and then writes a script file and launches it to batch plot each drawing.
My thinking was that I had to manually pick each drawing anyway, this LISP routine saved me from having to issue the plot command over and over.
Anyway, since my PC upgrade, the LISP routine fails.
There is a line of code that answers the plot prompt for output device name where I have the same printer as always.
When the script runs up to that line, AutoCAD tells me that printer is "not found".
So then it keeps reading the rest of the script lines which answer other plot prompts and repeatedly says "device not found".
If I manually print, I can choose the same print settings in the dialog box that the script file has and it can "find" that same device.
Why I can print manually but the LISP/script file gives me a "not found" error.
BTW, when I upgraded my PC, I also upgraded AutoCAD from 2012 to 2013..
I would like to batch rename all blocks in a drawing to NEWJOB01, NEWJOB02 ,etc. I can't use wildcards with RENAME command because the old names don't always have a common name. I prefer to use a lisp routine.
View 9 Replies View RelatedIs there any way for me to choose a bunch of .dsd files, and have those be batch plotted?At the moment I have to publish one .dsd file at a time, and each .dsd file can take about 10 minutes to go through all the layouts I have.
Does Autocad have that capability built in? Or is this a problem that can be solved with scripts?
I have 40 pages in one set of drawings and would like to rev-up the drawings. i will put same texts in same locations in the title blocks.
View 9 Replies View RelatedI am working on a large project where a 3rd Party firm has turned over 100s of drawings that we need to get into our system. The problem is that they did not name their physical files properly. We have a particular numbering system for our drawings, the engineering firm did fill in our attributed title block properly and used our numbering system correctly within the drawing. However, their physical file name follows their format. We need to have the physical file name match the information in the title block to get into our system.
Is there a way to "Batch Rename" these files by reaching into the title block and then renaming the physical file to match the attribute?
I have to be honest, I may use AutoCAD 50 to 60 hours per week, but I am no programmer! I am just the go-to person here for AutoCAD whom is stuck trying to come up with a efficient solution for the project team whose engineering firm could not follow our procedures! I was hoping some sort of batch routine could take care of this problem for us instead of us having to individually rename each physical file one by one.
I have a batch program which I want to launch from a LISP program.
First this is an attempt at an automated process whereby user input is extremely restricted. Other than the first click of the mouse on the menu item to save a copy of the file to a very restricted folder, no other user input is allowed.
AutoCAD, like most commercial apps writes a temporary file and then renames it when you choose save or saveas. And due to the restrictions in this folder that will not work. Crazy, I know but it's the parameters I must work within.
The batch file I'm launching calls another batch program in it's execution and I'm wondering if that could be where control is lost. But the thing is I can type this at the command line in AutoCAD:
(startapp "//a_very_long/novell_server_path/my_folder/vlisp/mybatchfile.bat")
The whole process works great. The command window flashes briefly AutoCAD closes the active drawing window just like I want it to. And when I check that the dwg file has been copied to the restricted folder it's there and done. But when I place that same command within my LISP program or one like this:
(command "._STARTAPP" "CMD //a_very_long/novell_server_path/my_folder/vlisp/mybatchfile.bat")or(command "._STARTAPP" "CMD ""//a_very_long/novell_server_path/my_folder/vlisp/mybatchfile.bat"")
or just about anything else I try it fails to run. Perhaps I've been looking at this problem too long. I think I may move on to a VB.NET process to do this but I am really baffled why it will run from the command line but not within the program.
I have a list that is "acl", I would like to convert it to a string "acl", everything that I have read uses alot of code. Does this really take that much code to do?
View 9 Replies View Relatedis there a way to convert multiple 2d solids to hatches.
View 9 Replies View RelatedWhat is the Command that Converts a Field to Text so that I can stop a Field updating after the initial set-up? I need to apply this in lisp.
View 9 Replies View RelatedI need a lisp code to convert all Lines, Polylines, Arcs and Splines to Polylines with 0.4 width.
I prepare this:
(defun c:CH2pl ( / SS);changes all lines, plines, arcs and splines to POLYLINE with 0.4 width(if (setq SS (ssget "_X" '((0 . "LINE"))))(command "_.pedit" "m" SS "" "Y" "w" 0.4 ""))(if (setq SS (ssget "_X" '((0 . "*POLYLINE"))))(command "_.pedit" "m" SS "" "w" 0.4 ""))(if (setq SS (ssget "_X" '((0 . "ARC"))))(command "_.pedit" "m" SS "" "Y" "w" 0.4 ""))(if (setq SS (ssget "_X" '((0 . "SPLINE"))))(command "_.pedit" "m" SS "" "Y" 10 "w" 0.4 "")))
But I want pure lisp code in a professional way!
I have searched the web and the Autodesk Discussion Group for a LISP Routine that allows me to convert all attributes in a drawing to Layer 0 but i have had no luck. It would be great if the LISP could edit xrefs as well although not sure if this is possible.
**BATTMAN command will take too long for the hundreds of blocks, xrefs and drawings i need to edit.
I wrote code for an application that stores links to lines and blocks in dictionaries using handles. The routines work well and I can manipulate the data marvelously, but if one of the lines or blocks get erased the whole danged opera falls apart. I knew this when I wrote the routines and have always been careful about using the ERASE command, as a matter of fact, I considered disabling it.
I am trying to make the package more robust. I have been experimenting with attaching a reactor (:vlr-erased) to the objects which fires when the object is erased. Unfortunately it fires before I can retrieve the handle of the object so that I can remove the references from the dictionaries. The only thing that I can retrieve once ERASE fires is the ObjectID. I can't seem to find a Visual Lisp routine to convert this value to a handle, does one exist? Is there an ObjectID collection that has any references in it?
I am trying to shorten my code by using the variable as the command name. Is that possible to do?
;; instead of this(cond ((eq USER_INPUT_ANSWER "blk-cdtree-01-06")(C:blk-cdtree-01-06)) ((eq USER_INPUT_ANSWER "blk-cdtree-01-08")(C:blk-cdtree-01-08)) ((eq USER_INPUT_ANSWER "blk-cdtree-01-10")(C:blk-cdtree-01-10)) ((eq USER_INPUT_ANSWER "blk-cdtree-01-12")(C:blk-cdtree-01-12)));; do something like this(C:blk-cdtree-(substr USER_INPUT_ANSWER 11))
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.
Code to convert a spline or read its points so I can create a curved leader (with arrowhead) reasonably close ?
View 9 Replies View RelatedI am trying to finalize a routine which extracts attributes (created in all CAPS) from a drawing, does a bit of list handling and then will finally write each item of that list to its own line out to a TXT file.
I've had a request from an end-user to change the case of the words in the TXT file from all UPPERCASE to having each Word Capitalized Within Each Item :
e.g. :
the raw list is currently:
"DINING ROOM 1209" "LIBRARY1210" "CORRIDOR A100" "COPY ROOM 1215"
and the current output to TXT file:
DINING ROOM 1209
LIBRARY1210
CORRIDOR A100
COPY ROOM 1215
But I'd like the list to be processed within AutoCAD so that its format is changed to:
"Dining Room 1209" "Library 1210" "Corridor A100" "Copy Room 1215"
because the desired output to the TXT file is:
Dining Room 1209
Library 1210
Corridor A100
Copy Room 1215
Is there any way to convert ALL CAPS to more of a Capitalized format?
I have a list of (0 .4 .8 0 10). I want to convert every element of the list to string.
View 4 Replies View RelatedAny routine or way to convert a nested xref to a regular xref?
View 4 Replies View RelatedJust going over some old stormwater flows but have some other stuff included in the coordinates I have, is their anyway to convert lines to points?
I know a long way but im just seeing if theres a quick lisp routine that can do it for me?
I have a data structure called LayerList in the format [LIST "LayerName" "Linetype" Thickness Color]I then use the following piece of code to go through the structure selecting polylines and converting all polylines on a given layer to the correct thickness
(foreach layr layerlist
(setq player (car layr))
(if (setq ss (ssget "x" '((0 . "*polyLINE") (8 . player ) )))
(command "pedit" "m" ss "" "w" 0.15 "")
(princ "
No polylines exist!")
)
)
However all i keep getting is Bad SSGET list value at the command line,
Our customer send us drawing with ellipse segments into.
With Autocad 2008 I bought a plug-in call SplineConvert that did the job perfectly but not compatible with 2013.
Is there any plugin that could replace that tool ?
Is there any standard ACAD command that could easily do this Job ?
I need a way to make 2 or 3 times per week this converting on all ellipses of large and detail 2D drawings so no time to offset in and out all those .
I try also DXFOUT in R12 but all the spline are being converted into 3d polyline making a huge files that froze my PC.
I also try FLATTEN but did not see how it work , the ellipse stay an ellipse.
I need a function that allows to convert the polylines selected with a width globalize defined in a double closed line (spaced by the same width of the polyline), with a hatch inserted automatically defined.
Brilliant idea to draw raceways quickly: instead of making handmade double lines, connect, enter the hatches all by hand, you could quickly draw the polyline with width identical to the size of the duct, and then the lisp transform it into a duct more aesthetically pleasing if compared to the full polyline!
Looking for a lisp to convert a poly face mesh to a solid.
View 1 Replies View RelatedHow to convert the format obtained in "CDate" in absolute minutes?
ex:
Command: (rtos (getvar "CDate") 2 4)
The result is:
"20130326.1301"
What I need is:
+01 minuts
+13 hours X 60 = 780 minuts
+26 x 1440 = 37440 minuts
the current time this month is: 38221 minutes
Looking for routine for converting text to attributes inside the block?
In my drawing I hv some attribute blocks having some Text in it. I need to change the Texts inside the blocks as Attribute Texts. I am attaching sample Blocks drawing..
I'm trying to look for a LISP command where i will create a closed polyline with 4 sides in different angles. then convert it to region.
View 6 Replies View RelatedSomeday the light bulb is going off and I will understand mapcar and lambda. However.....I have a program that reads an excel file sheets. Sometimes the sheet only has 1 column, sometimes 2 or more.
I need to convert the saved values from the sheet to a list with the text spaced evenly. Unfortunately the text lengths vary. I would like a subroutine to pass the list to and return a list of strings with text aligned with padded spaces allowing for the longest text in each column. I am using the new list in a dialog box with fixed_width_font=true (so columns align).
Example 1-
(setq List1 (list "Col1-Line1" "Col1-Line2" "Col1-Line3-longer" "Col1-Line4"))
(AlignText List1)
returns
"Col1-Line1"
"Col1-Line2"
"Col1-Line3-longer"
"Col1-Line4"
so no padding needed
Example 2 -
(setq List2 (list (list "Col1-Line1" "Col1-Line2" "Col1-Line3-longer" "Col1-Line4") (list "Col2-Line1-longer" "Col2-Line2" "Col1-Line3" "Col2-Line4")))
(AlignText List1)
returns
"Col1-Line1 Col2-Line1-longer"
"Col1-Line2 Col2-Line2 "
"Col1-Line3-longer Col2-Line3 "
"Col1-Line4 Col2-Line4 "
Example 3 -
(setq List3 (list (list "Col1-Line1" "Col1-Line2-longer" "Col1-Line3" "Col1-Line4") (list "Col2-Line1-longer" "Col2-Line2" "Col1-Line3" "Col2-Line4") (list "Col3-Line1-longer" "Col3-Line2" "Col1-Line3" "Col3-Line4")))
returns
"Col1-Line1 Col2-Line1-longer Col3-Line1-longer"
"Col1-Line2-longer Col2-Line2 Col3-Line2 "
"Col1-Line3-longer Col2-Line3 Col1-Line3 "
"Col1-Line4 Col2-Line4 Col3-Line4 "