All Activity
- Past hour
-
shirleydaf joined the community
- Today
-
o.oclilac joined the community
-
Their IT department even has a slogan (and I'm not kidding here) : You name it , we block it
-
Yikes! Working with your arms tied.. No way I could work effectively without my tools, I would at least need autohotkey. Last company I worked for, I automated their whole system, mostly because I was lazy and I wanted to eat donuts all day. AutoCAD ships with .NET, nothing to install, I would be rolling some goodies for sure. “We At ACME corporation stifle innovation by making everyone think inside the box”
- Yesterday
-
Even if I wanted to use a different language I wouldn't be able because at my work I'm unable to install any software that's not supplied in our software center , also certain extensions like *.bat are a big freaking no no so my dragon claws are tied in that respect. But I can get vl-some satisfaction however whenever I can create something that at first glance seems impossible to do and then come up with something that actually works.
-
What programming language to use ? There are so many, Lisp, Pascal, VBA, C##, now .NET, Python and of course the push product by Autodesk Dynamo but only on certain platforms. Yeah the macro record almost useless. As I have said before years ago macro record in a CAD program wrote VBA code. There is lisp2C from years ago that converted lisp code to C## code, hey Daniel what about convert lisp to Python ? The main advantage in lisp is the non compile, just run, I use code that is 30+ years old still works. Any compiled code every few years has to be recompiled to work as versions change. Dont forget how many years ago now Autodesk said VBA support would be removed, it's still there.
-
Lee Mac started following Perform an OUTWARD offset for several rectangles
-
Perform an OUTWARD offset for several rectangles
Lee Mac replied to Nikon's topic in AutoLISP, Visual LISP & DCL
Use this and simply switch: *dist* (- *dist*) To: (- *dist*) *dist* -
Perform an OUTWARD offset for several rectangles
BIGAL replied to Nikon's topic in AutoLISP, Visual LISP & DCL
A couple of answers, as suggested, check is closed pline ie a rectang drawn CW or CCW then vla-offset will always go out for a CCW pline. You can do a check and reverse the pline if required. Or the simpler is (setq offsetpt (getvar 'extmax)) -
It’s more of, ‘pick the right tool for the right job’. In this case, ObjectARX, and by extension, Python, can provide a clean new drawing to import your DXFs into every time, whereas lisp may not. I don’t remember what all is stored in DXF, i.e. if there are things that are non-purgeable. An example is an existing text, dimension, or table style, that are named “Standard”. Nested references, Associated Styles (the text style for a dimension style). There may be user variables stored per drawing CLAYER, LTSCALE: So, using lisp DXFIN -> purge -> save on repeat may have subtle side effects. This may or may not be an issue for you
-
For most things I do this is my default option, rarely need to do much other than that and if I do, drag and drop.
-
Steven P started following Perform an OUTWARD offset for several rectangles
-
Perform an OUTWARD offset for several rectangles
Steven P replied to Nikon's topic in AutoLISP, Visual LISP & DCL
I would maybe use: (vla-Offset (vlax-ename->vla-object ent) dist) where dist can be positive to go one direction, negative to go the other. This direction might also depend on the direction that the rectangle was drawn - clockwise or anticlockwise. Could do them both directions and just delete the shorter line - a few more lines of code to add though, some thinking for the first full week of work in 2026, always a quiet week. I might also suggest a couple more filters to the selection set, if all rectangles are closed polylines (test: 70 is 1 or 128 - use bitand (search for this Lee Mac uses this often to test both at the same time)), or number of vertices being 3 (closed polyline) or 4 (open polyline) (test: 90 is 3 or 4) -
Perform an OUTWARD offset for several rectangles
Nikon posted a topic in AutoLISP, Visual LISP & DCL
Good day everyone! *** Happy New Year 2026! *** I wish you good health and creative success! I'm asking for help in changing the code. I want to select several rectangles and execute the command "Offset" OUTWARD by a specified distance. But the command performs an inward Offset. thanks (defun c:RectOffBatch (/ selset dist i ent pts maxpt offsetpt) (prompt "\nSelect rectangles (polylines): ") (setq selset (ssget '((0 . "LWPOLYLINE")))) (if selset (progn (initget 7) (setq dist (getdist "\nEnter the offset distance: ")) (setq i 0) (repeat (sslength selset) (setq ent (ssname selset i)) (setq pts (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 10)) (entget ent)))) (setq maxpt (list (apply 'max (mapcar 'car pts)) (apply 'max (mapcar 'cadr pts)))) (setq offsetpt (list (+ (car maxpt) dist) (+ (cadr maxpt) dist))) (command "_.OFFSET" dist ent offsetpt "") (setq i (1+ i)) ) ) ) (princ) ) -
Hi Danielm 103, Yes, Python is a distinct possibility. Has Python-based programs replaced LISP-based programming in your current experience. Why or why not? Thanks, Clint
-
Hi rlx, The Excel-based automated gem you coded would have certainly minimized the extremely mundane diagram-based tasks and would have been handy in what is one half (15 years) of my overall drafting design career sentence within the chemical processing industry * using mainly AutoCAD, other Autodesk-based products, plus a few of the last years there in BricsCAD. I appreciate your explanation on the program's purpose and your particular career experience. I find it very interesting how functionality changed in BricsCAD between your V22 used and the BricsCAD V25 used that caused the lack of an expected file conversion outcome. I am slowly weaning myself off the AI crutch that can never replace real personal experience and direct application from learning programming languages. Thanks, Clint Footnote (*) My interests now lie in CAD programming that I wish I had started years ago as I am now working in the pre-engineered metal building design/manufacturing position that is much more in line with my formal education, personal interest, and work in mechanical and structural design departments that make up half of my 30+ years of design drafting experience.
-
Hi BIGAL, Of course, an elegantly simple and effective solution is presented here. This nugget is being stored and will come in handy for related batch scripting. Thanks, Clint
-
The promised update The version above works but with one exception: It only places the converted (DWG) files in the source (DXF) file folder according to the code, of course. It works for me. Thanks, Clint
-
Hi troggarf, We use BricsCAD. I thank you, sir! Clint
-
The reason I clean the drawing is I once wrote a program to generate instrument loop diagrams from an excel file. I found the most stable and easy way was not to use a script but stay in the current drawing and from there save(as) each loop. I also made use from templates and also had the option to update the drawing in stead of generating the entire drawing. But at some time some templates had been given an update to a block definition and to be certain the latest version was used I had to make sure the old block was purged. Overkill , some times yes , but in my case it worked as it should. In this case , dxfin , probably overkill , but it doesn't hurt either. I tested it on Bricad 22 and the dwg extension was no problem, it worked as it should. The recommendation from the annoying paperclip oh , sorry , AI its called these days , to pimp the filename and use vla-saveas is not wrong though. Just didn't need it on my computer. Had it gave me an error I would have fixed it but it worked right from the start for me.
-
According to the ARX docs using dxfIn While rlx’s version attempts to clean the drawing via vla-purgeall, I suppose there could be some items that are not purged? It’s not clear what happens in case of an existing dictionary or style. AI “AutoCAD typically handles conflicts by prioritizing the current drawing's definitions” I'm guessing that rlx’s version is safe enough though
-
What was wrong with rlx's?
-
Danielm103 started following Batch convert dxf to dwg
-
if you can use Python import traceback from pyrx import Ap, Db, Ed, Ge @Ap.Command() def dxftodwg(): try: for dxf in Ap.Application.listFilesInPath("E:\\FloorPlans", ".dxf"): dwg = dxf.replace(".dxf", ".dwg") db = Db.Database(False, True) db.dxfIn(dxf) db.saveAs(dwg) print(dxf, dwg) except Exception as err: traceback.print_exception(err)
-
The main problem with Autodesk Apps is updates, not to mention getting IT to install it. I still have 3 APPs from the APP Store to be installed since I was updated to AutoCAD 2026 products.
-
AJESH KR joined the community
-
strange behavior of 3dface
yangguoshe replied to motee-z's topic in AutoCAD 3D Modelling & Rendering
First, use the region command to convert two 3D faces into regions, then you can use the loft command to create a loft surface, and then use the surfsculpt command to create a 3D solid - Last week
-
There's an app for that: https://apps.autodesk.com/ACD/en/Detail/Index?id=3434696327413675915&appLang=en&os=Win32_64
-
ttppp joined the community
-
kiljoos joined the community
-
Dhyzi joined the community
-
SLW210, Your concern is very much appreciated. As I now understand it, below is the key difference that is breaking the original program coded for AutoCAD when used in BricsCAD Researching per Grok AI: "The DXFIN command does not work exactly the same in AutoCAD and BricsCAD, though both support it and it relates to handling DXF files. Key Differences Core behavior — AutoCAD's DXFIN opens the DXF as a standalone drawing; BricsCAD's imports into the current one. Use cases — This reflects design philosophy: BricsCAD (and some other AutoCAD-compatible platforms like progeCAD) adds convenience for merging DXF data directly, a feature AutoCAD users often request but handle via workarounds. In AutoCAD The DXFIN command loads a DXF file in a way similar to the OPEN command. It typically opens the selected DXF file as a new or current drawing (often in a new tab if multiple drawings are allowed). This behavior aligns with historical use for converting DXF into an editable AutoCAD drawing, especially in older versions or for recovery purposes (e.g., exporting to DXF via DXFOUT and reloading via DXFIN to clean issues). AutoCAD lacks a built-in command to directly merge or import the full contents of a DXF file into an already open drawing. Users often work around this by opening the DXF separately and copying/pasting elements. In BricsCAD The DXFIN command explicitly opens a file dialog to select a DXF file and imports its contents into the current open drawing (merging the geometry, layers, etc., into the existing workspace). This makes it more like an "import/merge" tool. BricsCAD also has separate commands like OPEN (for opening DXF/DWG as new tabs) and IMPORT (for other formats or specific cases). Contextual nuances — Some BricsCAD forum discussions suggest slight variations (e.g., in scripts vs. interactive use), but official documentation confirms the import-into-current behavior." ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- I queried Grok about the Visual LISP code submitted. Here is the result: No, this LISP code will not work reliably in BricsCAD as written, though parts of it are compatible and could function with modifications. BricsCAD offers excellent AutoLISP and Visual LISP compatibility—most functions like vla-get-activedocument, vla-purgeall, vla-ZoomExtents, vlax-get-acad-object, vl-directory-files, and vl-file-directory-p work identically or very similarly to AutoCAD. The helper functions (_getfolder, _getfiles, void) are standard and platform-agnostic (assuming Windows for the Shell COM object in _getfolder). DXFIN Behavior and Erase Step BricsCAD's DXFIN command imports the DXF file's contents into the current drawing (merging geometry, layers, etc., with existing content), rather than replacing it outright. The code explicitly erases everything first with (command ".erase" "all" ""), which clears the drawing before importing. This effectively achieves a "replace" behavior, making this part intentional and effective for BricsCAD's merge-style import. However, the line (vl-cmdf "_.dxfin" dxf) supplies the filename directly. Official BricsCAD documentation states that DXFIN opens a file dialog. In scripted/LISP mode, this might: Open the dialog (requiring user interaction, breaking batch processing) Or accept the filename argument directly (common in some CAD platforms for scripting) Without suppressing dialogs (e.g., via (setvar "FILEDIA" 0)), it risks pausing for input. Save Command Issue This is the primary breaking point. The code uses (command ".save" (strcat ... )) to save each processed DXF as a DWG (using the original base name, no extension—BricsCAD would add .dwg). In BricsCAD, the SAVE command typically performs a quick save (QSAVE) to the current drawing's name or opens the Save As dialog if unnamed. It does not reliably accept a filename argument directly in command/LISP mode for a scripted Save As operation. As a result: The provided path/filename would likely be ignored. It would either quick-save to the current drawing's existing name (overwriting the first saved file repeatedly) or prompt a dialog. For multiple files, all conversions would end up saving to the same file (the one named after the first DXF), defeating the batch purpose. BricsCAD (like AutoCAD) uses SAVEAS for specifying a new filename in scripts, often requiring (setvar "FILEDIA" 0) to avoid dialogs, e.g.: lisp (setvar "FILEDIA" 0) (command "._saveas" "" (strcat path (vl-filename-base dxf) ".dwg")) (setvar "FILEDIA" 1) Or better, use ActiveX: (vla-SaveAs actDoc newFullPath acNative) for reliable, dialog-free saving. Other Minor Notes Undo marking/back: Works, but saves commit changes, so undoing at the end won't revert saved files. Expert set to 2: Suppresses warnings—fine. Path handling: Mix of / and \\ is usually tolerated on Windows. Purge after erase: Redundant but harmless. ZoomExtents: Fine via VLA. Suggested Fixes for BricsCAD To make this batch DXF-to-DWG converter work unattended: Suppress dialogs: Add (setvar "FILEDIA" 0) at start, restore at end. For DXFIN: Test if direct filename works; if not, use a workaround (e.g., OPEN the DXF in a new drawing, then copy/paste or save). Replace the save line with a proper SaveAs, preferably via vla-SaveAs. Optionally start with a new blank drawing. Have you tested this code in BricsCAD already? What specific error or behavior did you observe (e.g., dialogs appearing, wrong saves)? Knowing that would help pinpoint if DXFIN accepts direct files in your version. Alternatively, are you open to a modified version of the code that uses more reliable methods like vla-SaveAs? ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- I will proceed with testing a modified version of the code as supplied from the above suggestions that follows: START (defun c:DxfToDwg ( / actDoc dxf-folder dxf-list oldFileDia oldCmdEcho oldExpert) (setq actDoc (vla-get-activedocument (vlax-get-acad-object))) (vl-load-com) (cond ((not (setq dxf-folder (_getfolder "Select folder with dxf files"))) (princ "\nNo folder selected")) ((not (vl-consp (setq dxf-list (_getfiles dxf-folder "*.dxf")))) (princ (strcat "\nNo dxf files in folder " dxf-folder))) (t ;; Save and suppress dialogs/echo for scripted operation (setq oldFileDia (getvar "FILEDIA")) (setq oldCmdEcho (getvar "CMDECHO")) (setq oldExpert (getvar "EXPERT")) (setvar "FILEDIA" 0) (setvar "CMDECHO" 0) (setvar "EXPERT" 2) (command ".undo" "mark") (foreach dxf dxf-list (command ".erase" "all" "") (vla-purgeall actDoc) (vl-cmdf "_.dxfin" dxf) ;; Imports into current (cleared) drawing (vla-ZoomExtents (vlax-get-acad-object)) ;; Save as DWG with explicit .dwg extension using ActiveX (reliable in BricsCAD) (setq dwgPath (strcat (vl-filename-directory dxf) "\\" (vl-filename-base dxf) ".dwg")) (vla-SaveAs actDoc dwgPath) ;; Saves in current DWG format; overwrites if exists ) (command ".undo" "back") ;; Restore system variables (setvar "FILEDIA" oldFileDia) (setvar "CMDECHO" oldCmdEcho) (setvar "EXPERT" oldExpert) ) ) (princ) ) ;; Helper functions (unchanged from original) (defun _getfolder ( m / f s) (if (and (setq s (vlax-create-object "Shell.Application")) (setq f (vlax-invoke s 'browseforfolder 0 m 65536 ""))) (setq f (vlax-get-property (vlax-get-property f 'self) 'path)) ) (vl-catch-all-apply 'vlax-release-object (list s)) (if f (vl-string-translate "\\" "/" f)) ) (defun void (x) (or (eq x nil) (and (listp x) (not (vl-consp x))) (and (eq 'STR (type x)) (eq "" (vl-string-trim " \t\r\n" x)))) ) (defun _getfiles ( fol ext / lst) (cond ((or (void fol) (not (vl-file-directory-p fol))) (princ (strcat "\nInvalid folder :" (vl-princ-to-string fol)))) (t (if (vl-consp (setq lst (vl-directory-files fol ext 1))) (setq lst (mapcar '(lambda (x) (strcat fol "/" x)) lst)) ) ) ) lst ) THANKS! I want to thank the original submitter of this post and to all the concerned experts here that take time to assist. NOTE I realize that AI can only take you so far. It does not replace learning and advancing my LISP programming skills nor does it replace the important nuances and logic that us as humans can detect and serves to perfect the code. I will test the above code and provide an update. Thanks, Clint
-
Do you have an example file? Most likely a difference in AutoCAD and BricsCAD, I'll try to look at it next week, but a full workload so no guarantees. IIRC, I have not used that on AutoCAD 2026.
-
rlx started following Batch convert dxf to dwg
-
new to Bricad but this seems to work : (defun c:DxfToDwg ( / actDoc dxf-folder dxf-list ) (setq actDoc (vla-get-activedocument (vlax-get-acad-object))) (vl-load-com) (cond ((not (setq dxf-folder (_getfolder "Select folder with dxf files"))) (princ "\nNo folder selected")) ((not (vl-consp (setq dxf-list (_getfiles dxf-folder "*.dxf")))) (princ (strcat "\nNo dxf files in folder " dxf-folder))) (t (command ".undo" "mark")(setvar "expert" 2) (foreach dxf dxf-list (command ".erase" "all" "") (vla-purgeall actDoc) (vl-cmdf "_.dxfin" dxf) (vla-ZoomExtents (vlax-get-acad-object)) (command ".save" (strcat (vl-filename-directory dxf) "\\" (vl-filename-base dxf))) ) (command ".undo" "back") ) ) (princ) ) ; generic getfolder routine with possibility to create a new subfolder (_getfolder "select path") (defun _getfolder ( m / f s) (if (and (setq s (vlax-create-object "Shell.Application")) (setq f (vlax-invoke s 'browseforfolder 0 m 65536 "")))(setq f (vlax-get-property (vlax-get-property f 'self) 'path)) (setq f nil))(vl-catch-all-apply 'vlax-release-object (list s)) (if f (vl-string-translate "\\" "/" f))) (defun void (x) (or (eq x nil) (and (listp x)(not (vl-consp x))) (and (eq 'STR (type x)) (eq "" (vl-string-trim " \t\r\n" x))))) (defun _getfiles ( fol ext / lst) (cond ((or (void fol) (not (vl-file-directory-p fol))) (princ (strcat "\nInvalid folder :" (vl-princ-to-string fol)))) (t (if (vl-consp (setq lst (vl-directory-files fol ext 1))) (setq lst (mapcar '(lambda (x)(strcat fol "/" x)) lst)))) ) lst )
