Dadgad Posted December 8, 2024 Posted December 8, 2024 I have been loving everything that Lee does for years. Nothing but kudos and great respect. I have just identified a bit of a bug in the ointment. Or rather MY ointment. I have been using Autocad 2013 as my default SAVE AS FORMAT probably since 2017, or whenever 2018 format was rolled out. I recently used BFind to replace the Issue Date on about 400 drawings, a few of which were open on my desktop, and the rest in their folder. I shared them with a team member who uses Autocad 2016. I later learned that she had been unable to open them, as when BFind processes closed Dwgs files, they are automatically saved as the latest format...AKA 2018... in my case since ProSteel Connect uses Autocad 2020. What I would like to do, is to specify that the Format defaults to our in house default SAVE AS file type, of Autocad 2013 Format? After testing I figured out that, any files which are OPEN, when BFind is run, honor the current Profile SAVE AS defaults. The last time this happened it was with about 800 drawings, but it never occurred to me that BFind might be the seeming Glitch that caused it. I am very happy to have now figured out how it happened, and hoping for a creative fix? I looked at the code, but couldn't figure out how to do it. Quote
rlx Posted December 8, 2024 Posted December 8, 2024 (edited) I don't think it's Lee's bug but Autodesk... odbx can only save files in native AutoCad format so when you run it on 2013 , files are saved as 2013 even if you set an other version in the saveas command. So when you run code on 2018 or 2020 odbx saves it in this format. I also use a batch app that can use script / core & dbx but when I close a project I have a button called 'just save' and when I use this all files are saved in the version specified in my company's profile because it uses a plain and simple script. Edited December 8, 2024 by rlx 1 Quote
BIGAL Posted December 8, 2024 Posted December 8, 2024 (edited) As you mentioned the issue is using OBDX to change objects, so you may have to run a script open the 400 one at a time and saveas. Then go to lunch. The other may be using Acoreconsole it may support the saveas command. Not tested, accoreconsole can run over an entire directory of dwg's. Like OBDX there is no opening of dwgs. Here is a couple of good sources of how to use Accoreconsole. https://through-the-interface.typepad.com/through_the_interface/2012/02/the-autocad-2013-core-console.html https://forums.autodesk.com/t5/forums/replypage/board-id/130/message-id/444989 Edited December 8, 2024 by BIGAL 1 Quote
Lee Mac Posted December 8, 2024 Posted December 8, 2024 (edited) As noted by rlx, this is unfortunately a bug in the ObjectDBX interface, and therefore not something which can be overcome using the LISP API - I note this as one of the known restrictions of the application. Hopefully a simple open/save/close script can rectify any inconvenience caused. Edited December 8, 2024 by Lee Mac 1 Quote
Dadgad Posted December 9, 2024 Author Posted December 9, 2024 (edited) Well, while what I thought might be a relatively simple line added at the end of the code? Got me all fired up to take a gander? Stay up til 2:00a.m. because I was so enthused that maybe I should dive in? I use Action macros all the time, which I love, but have never written any code. A keystroke recorder is so much easier, as a non-lisperati. I recently got a new laptop, which is pretty sweet, and with 64Gb of available RAM, I am able to open quite a few drawings at the same time. Typically I might open up to about 50 at a time, and then cycle through them with the appropriate Action Macro. Not nearly as efficient as using a script, but in that way the 2013 SAVE AS Formatting is honored. Thanks very much Lee, for all you do, and have done, for so long for global members of the Cad community. LE gE ndary. Layer Director? Don't fire up Autocad without it. To those who haven't used it? Check it out, you'll be glad you did. If you are unable to find something else on Lee's wonderful website, to elevate your game and functionality, you haven't looked hard enough! Get the kiddies off the streets! Us old dogs too! I just checked out your Script Writer lisp, and given my familiarity with using the Action Macro Recorder, this looks to be a real game changer! Edited December 9, 2024 by Dadgad random synapse Quote
Dadgad Posted December 9, 2024 Author Posted December 9, 2024 6 hours ago, Lee Mac said: As noted by rlx, this is unfortunately a bug in the ObjectDBX interface, and therefore not something which can be overcome using the LISP API - I note this as one of the known restrictions of the application. Hopefully a simple open/save/close script can rectify any inconvenience caused. I never took this to be a bug in your code Lee, rather a bug in MY ointment...as in the way it was being applied. INCONVENIENCE caused by one of your masterful lisps? The bug is in the interface...don't shoot the messenger! Quote
SLW210 Posted December 9, 2024 Posted December 9, 2024 I have modified this batch convertor, it works on an entire folder and should SaveAs 2013. (not tested) You can also convert to older versions with DWGConvert in newer AutoCAD (not sure first version), eTransmit and DWG TrueView. ;;;|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ;;; | ;;;<<<<<<<<<<<<<<<<<<<<<<<<>Modified to Batch Convert AutoCAD® DWG *.dwg into AutoCAD® DWG *.dwg>>>>>>>>>>>>>>>>>>>>>>>>>>| ;;; | ;;;|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ;;; | ;;; Original versions I got from here | ;;; https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/batch-convert-dgn-to-dwg/td-p/3237978 | ;;; | ;;;|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ;;; ;;;* DGNIMPORT.LSP - Converts a list of Microstation *.dgn drawings into AutoCAD *.dwg drawings ;;; Start command by typing DGNI ;;; ;;; Make the necessary adjustments to the following variables: ;;; --------------------------------------------------------- ;;; tx1 = path and name of a file that holds a list with names for all the *.dgn's to be imported, ;;; names of *.dgn drawings may be written without extension, as well as with extension, ;;; in plain text format, no return after the last line. ;;; tx2 = the path for the input folder, containing the actual *.dgn files to import. ;;; tx3 = the path for the output folder, where the drawings converted into *.dwg will be saved, ;;; (routine assumes that the *.dwg files do not exist yet) ;;; tx4 = name of the drawing model to import ;;; ;;; ;;; The routine reads drawing names from the file given in tx1 line-for-line. ;;; In each loop it performs a DGNIMPORT from the folder given as tx2 into the existing AutoCAD drawing, ;;; does a Zoom Extends, saves the converted drawing result as *.dwg in the folder given as tx3, ;;; and finally restores the drawing to its original state, ready to receive the next DGNIMPORT loop. ;;; ;;; The DELAY command for 1000 milliseconds (1 second) is needed to provide sufficient separation ;;; between the DGNIMPORT and SAVEAS processes (otherwise it starts to mix up drawings). ;;; ;;; The DGNIMPORT command trips when the name of the *.dgn to be imported contains a comma, ;;; I advise to rename drawings having this issue. ;;; ;;; Written by M. Moolhuysen. Modified by C. Matthews ;;; ;;; Modified by Cage Here https://www.cadtutor.net/forum/topic/78123-batch-convert-acis-sat-to-dwg/#comment-624627 ;;; ;;; This software may not be sold as commercial product or included as part of a commercial product. ;;; ;;; ;;;************************************************************************************************************************ ;;;************************************************************************************************************************ ;;; * ;;; Converts a folder of AutoCAD® DWG *.dwg drawings into AutoCAD® DWG *.dwg drawings (Version 2013) * ;;; * ;;; Start command by typing DWG2DWG * ;;; * ;;; Modified by SLW210 A.K.A. Steve Wilson from DGNIMPORT to DWG2DWG 01/31/2024 * ;;; * ;;;************************************************************************************************************************ ;;;************************************************************************************************************************ (defun C:DWG2DWG (/ fil tx1 tx2 tx3 tx4 tx5) (princ "Please select input folder. \n") (setq tx1 (vl-directory-files (setq tx2 (acet-ui-pickdir)) "*.dwg")) ; Select the folder containing *.dwg files to be imported. (princ "Please select output folder. \n") (setq tx3 (acet-ui-pickdir) ; Select folder for the converted *.dwg files to be exported into. tx4 "Default" ) (setvar "FILEDIA" 0) (foreach tx5 tx1 (if (wcmatch tx5 "*`.???") (setq tx5 (substr tx5 1 (- (strlen tx5) 4))) ) (command "_UNDO" "_MARK" "OPEN" "" (strcat tx2 "\\" tx5) tx4 "" "" "_ZOOM" "_E" "._DELAY" 500 "_SAVEAS" "D" "V" "2013" "16" (strcat tx3 "\\" tx5 ".dwg") "_N" ; change SaveAs version etc. here. ) (command "_ERASE" "ALL" "") ;erases everything on the page after the save (command "_.purge" "_all" "" "_no") ;purges everything so you don't carry it over to the next drawing (command "_.purge" "_regapp" "" "_no") (command "_QNEW") ;opens a new drawing (setvar "FILEDIA" 0) ) (princ) ) 1 Quote
Dadgad Posted December 10, 2024 Author Posted December 10, 2024 Thanks very much SLW210, for taking the time to do that. Greatly appreciated. Quote
BIGAL Posted December 10, 2024 Posted December 10, 2024 Did you look at this, scroll down. It will do an entire directory for you and will not open any dwg's, big advantage over a script. Yes you have to write a very small saveas script file. https://through-the-interface.typepad.com/through_the_interface/2012/02/the-autocad-2013-core-console.html 1 Quote
rlx Posted December 10, 2024 Posted December 10, 2024 (edited) Core console does open drawings but the graphical interface isn't loaded , thats why (if I remember correctly) not all all commands are allowed like dview whatever (basically all commands that invoke a dialog). So core console is faster than script but slower than dbx. I love core console but sadly IT doesn't https://help.autodesk.com/view/OARX/2025/ENU/?guid=AUTOCAD_CORE_CONSOLE Edited December 10, 2024 by rlx 1 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.