Jump to content

Leaderboard

  1. Danielm103

    Danielm103

    Community Member


    • Points

      38

    • Posts

      335


  2. BIGAL

    BIGAL

    Trusted Member


    • Points

      22

    • Posts

      20,171


  3. SLW210

    SLW210

    Moderator


    • Points

      15

    • Posts

      11,685


  4. rlx

    rlx

    Trusted Member


    • Points

      14

    • Posts

      2,276


Popular Content

Showing content with the highest reputation since 07/05/2026 in all areas

  1. a little story : This is the famous Myth of Thamus and Theuth, found in the dialogue Phaedrus by the Greek philosopher Plato (written around 370 BCE). In this text, Plato has his teacher Socrates relate an ancient Egyptian anecdote. Here is how the story unfolds: The Invention The Egyptian god Theuth (Thoth), the deity of inventions, visits Thamus, the king (pharaoh) of Egypt. Theuth presents his various creations, including arithmetic, geometry, and astronomy. Finally, he introduces the written word. Theuth is enthusiastic and claims: "This invention will make the Egyptians wiser and improve their memories. It is a potion for both memory and wisdom!" The Pharaoh's Objection King Thamus is not impressed and responds with deep skepticism. He argues that writing will have the exact opposite effect: Memory loss: People will stop training their memories. By relying on external written characters, they will no longer internalize knowledge. The illusion of wisdom: People will read quantities of information without proper instruction. As a result, they will appear knowledgeable but will actually remain ignorant, becoming conceited and difficult to get along with. The Historical Irony Socrates used this story to argue that spoken dialogue is superior to the written word. He believed text is dead; it cannot answer back or clarify itself when misunderstood. The ultimate irony is that Socrates himself never wrote anything down. The only reason we know this story today is because his student, Plato, wrote it down. This ancient debate resurfaces with every technological leap. The same anxieties were voiced about the printing press, calculators, the internet, and now, Artificial Intelligence (AI).
    6 points
  2. AI , I like to call it Clippy , is here to stay but you are the architect , in the driver seat. Don't blame Clippy if something goes wrong, blame yourself when blindly believing everything it says. It's just a tool but you are responsible at all times. Like guns don't kill people , its people that kill people. Clippy is very good in finding facts and patterns , but it has no real understanding. When coding something big, give total control to Clippy and for sure you end up with lots of code you don't understand nor control anymore. Just do what you always do, create a block or flow diagram and feed it little bits and test everything. Like this weekend , have a portable airco for my sweat-room. Missed (misplaced) a part so I told Clippy and behold, oh you need this and there you find it, So ordered the part (and a day later I found it in a drawer) , but then Clippy said , oh you have simple (dum) airco , would you like to be able to control it with your phone?... sure, what's on your mind?... it gave me 3 options and I went for gold (of course). Paranoid dragon as I am , did some research (after I placed the order) on how IR boosters work and downloaded the manual and found out the IR booster I just ordered only works when airco has a remote with a display and mine only has buttons. So fortunately was able to cancel the order and found another , much cheaper and works with my machine. Now I can only blame myself, not Clippy. It means well , but it can't be trusted blindly. The better the info you feed it , the better result you can get back. At this moment the term AI is found everywhere , many times as a marketing slogan, designed by AI , controlled by AI , AI knows everything... well I can say for certain there is only one person on this whole planet who knows everything and I'm married to her. ok time to for me.
    5 points
  3. This particular issue has been in play for a long time. Have you ever gone to a food joint, the power is out, and the staff refuse to prepare food for you because they can't ring it up? Like they've never heard of pencil and paper or making change. If you can't do the basic, human version of your job, you'll be left in the dark (sometimes literally) when the AI can't do its job. Worse, you won't recognize when the AI is making a mistake. Without a real-world backup, and the sense to use it, you're at the mercy of the AI and its hallucinations. It's the height of irresponsibility to replace us with something that needs its hand held all the time in case it has a malfunction.
    5 points
  4. Hi All, apologies for arriving late to this discussion. @SLW210 is right about the decline in forums before AI. There was a big shift away from forums like this one towards social media platforms and it does seem that most of us left here are Boomers. However, despite the decline, I have noticed that in recent years, it has plateaued and although number of visitors are significantly lower than they were (say) 15 years ago, they are no longer declining but seem stable. Traffic here is probably around 10% of what it was back in the day. Currently, new sign-ups to the forum average around 100 per month and that has been pretty stable for the past few years. So that's the background picture. AI has made a difference only in that all the data on this forum and others has now been well and truly scraped and is still being scraped by more and more bots. The graph below shows traffic to this site since January. You can see three massive spikes - those are all bots, scraping content. The result is that most people don't need to visit the site because the scraped content is being provided to them via AI agents. You might think that would result in even lower traffic to the site but that's not what I'm seeing. My guess is that the sort of visitors who prefer to use AI results rather than going to source are the same ones that stopped visiting forums and shifted to social media. So what remains is a solid core of Boomers who genuinely care about community and respect the skill and experience of others. Fortunately, there's enough of us around to keep things going. The future? It's very difficult to predict but my view is that most people are becoming tired of the toxic nature of social media and will likely learn to value the genuine human interactions and sense of community that forums can provide once they realise that AI is just another tool and not a friend that can't always be relied upon. So I'm predicting a return of popularity in forums for special interest groups. As for AutoCAD, I don't really have a good understanding of its popularity any more. It's a long time since I used it professionally (almost 10 years) but I'm not aware that it's being replaced by anything else. Gemini tells me that AutoCAD retains a 38% global market share, so I guess it's still relevant and that this forum is therefore still relevant.
    5 points
  5. Hi everyone, I'm Vico, an architectural designer with about 12 years in the industry. I'm based in China and have mostly been active in local developer forums, but I've always respected the open-source spirit here. I wanted to share a quick tool I wrote and also get your feedback on an idea. Codebase Packer — a LISP for AI-assisted work Over the past months I've been building a web-based side-project for CAD. The frontend work forced me to lean heavily on AI assistants (Claude, ChatGPT). The biggest bottleneck was always the context window: opening and pasting 30+ files manually drove me crazy. So I solved it with a little LISP routine. Codebase Packer lets you point at a folder and aggregate every file inside into a single .txt, ready for an LLM prompt. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; ;;; ;;; Command CPK (Codebase Packer) - Version 1.0 Release ;;; ;;; ;;; ;;; Features: ;;; ;;; Efficiently extracts the directory structure and file contents ;;; ;;; of a project. Features smart character encoding detection and ;;; ;;; automatically saves the packed file as UTF-8 alongside the ;;; ;;; project folder for AI-friendly integration. ;;; ;;; ;;; ;;; Author: Vico Wang ;;; ;;; Compatibility: AutoCAD 2006+ (Visual LISP / ActiveX) ;;; ;;; ;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (vl-load-com) (defun cpk:getdate ( / cd ) (setq cd (rtos (getvar 'cdate) 2 6)) (strcat (substr cd 1 4) (substr cd 5 2) (substr cd 7 2)) ) (defun cpk:read ( fn / ext charset stm text err ) (setq ext (strcase (vl-filename-extension fn) t) charset (if (member ext '(".lsp" ".dcl" ".mnl" ".bat" ".ini")) "GBK" "UTF-8") text "" ) (if (setq stm (vlax-create-object "adodb.stream")) (progn (setq err (vl-catch-all-apply '(lambda () (vlax-put-property stm 'type 2) (vlax-put-property stm 'mode 3) (vlax-put-property stm 'charset charset) (vlax-invoke stm 'open) (vlax-invoke stm 'loadfromfile fn) (if (> (vlax-get-property stm 'size) 0) (setq text (vlax-invoke stm 'readtext -1)) ) ) ) ) (if (= 'vla-object (type stm)) (progn (vl-catch-all-apply '(lambda () (vlax-invoke stm 'close))) (vlax-release-object stm) ) ) (if (vl-catch-all-error-p err) (strcat "// Note: Error reading file - " (vl-catch-all-error-message err)) (if (= "" text) "// Note: File is empty or extraction failed" text) ) ) "// Note: ADODB.Stream component missing" ) ) (defun cpk:traverse ( fso dir prefix islast root / fobj subdirs files items i cnt name rel ) (if (setq fobj (vl-catch-all-apply 'vlax-invoke (list fso 'getfolder dir))) (if (not (vl-catch-all-error-p fobj)) (progn (if (/= (strcase dir) (strcase root)) (setq name (vlax-get fobj 'name) rel (vl-string-translate "\\" "/" (substr dir (+ 2 (strlen root)))) out-tree (cons (strcat prefix (if islast "©¸©¤©¤ " "©À©¤©¤ ") name "/ # " rel) out-tree) ) ) (setq items nil) (vlax-for x (vlax-get fobj 'subfolders) (setq items (cons (cons x t) items))) (vlax-for x (vlax-get fobj 'files) (setq items (cons (cons x nil) items))) (setq items (reverse items) cnt (length items) i 0 ) (setq prefix (if (= (strcase dir) (strcase root)) "" (strcat prefix (if islast " " "©¦ ")))) (foreach item items (setq i (1+ i) name (vlax-get (car item) 'name) ) (if (cdr item) (cpk:traverse fso (vlax-get (car item) 'path) prefix (= i cnt) root) (progn (setq rel (vl-string-translate "\\" "/" (substr (vlax-get (car item) 'path) (+ 2 (strlen root))))) (setq out-tree (cons (strcat prefix (if (= i cnt) "©¸©¤©¤ " "©À©¤©¤ ") name " # maps to /" rel) out-tree)) (setq out-files (cons (list (vlax-get (car item) 'path) name rel) out-files)) ) ) ) (vlax-release-object fobj) ) ) ) ) (defun c:cpk ( / *error* old-cmd out-tree out-files fso shl fld root-dir root-name lst fn rel sv-dir sv-path stm cnt err ) (defun *error* ( msg ) (foreach obj (list fso shl fld stm) (if (and obj (= 'vla-object (type obj)) (not (vlax-object-released-p obj))) (vl-catch-all-apply 'vlax-release-object (list obj)) ) ) (if old-cmd (setvar 'cmdecho old-cmd)) (if (and msg (not (wcmatch (strcase msg t) "*break*,*cancel*,*exit*"))) (princ (strcat "\nCPK Error: " msg)) ) (princ) ) (setq old-cmd (getvar 'cmdecho)) (setvar 'cmdecho 0) (princ "\nSelect root folder to pack...") (if (setq shl (vlax-create-object "shell.application")) (progn (if (setq fld (vlax-invoke shl 'browseforfolder 0 "Select project root folder (Codebase Packer)" 0 0)) (setq root-dir (vlax-get (vlax-get fld 'self) 'path)) ) (vlax-release-object shl) ) ) (if root-dir (progn (setq fso (vlax-create-object "scripting.filesystemobject") root-name (vlax-get (vlax-invoke fso 'getfolder root-dir) 'name) out-tree (list (strcat root-name "/ # [Root Directory] " root-dir) "") ) ;; Automatically uses out-tree and out-files via LISP dynamic scoping (cpk:traverse fso root-dir "" t root-dir) (setq lst (list "Part A: Overall Folder and File Structure\n")) (foreach x (reverse out-tree) (setq lst (cons (strcat x "\n") lst)) ) (setq lst (cons "\n\nPart B: Specific File Contents\n" lst) out-files (reverse out-files) cnt (length out-files) ) (foreach x out-files (setq fn (car x) rel (caddr x) ) (setq lst (cons (strcat "\n------------------------------------------------------------\n" "File location: " rel "\n" "File name: " (cadr x) "\n" "------------------------------------------------------------\n\n" (cpk:read fn) "\n") lst) ) ) (setq lst (reverse lst)) (setq sv-dir (vl-catch-all-apply 'vlax-invoke (list fso 'getparentfoldername root-dir))) (if (or (vl-catch-all-error-p sv-dir) (= "" sv-dir)) (setq sv-dir root-dir) ) (if (/= "\\" (substr sv-dir (strlen sv-dir))) (setq sv-dir (strcat sv-dir "\\")) ) (if (setq sv-path (getfiled "Save Packed File" (strcat sv-dir root-name "-Packed-" (cpk:getdate) ".txt") "txt" 1)) (if (setq stm (vlax-create-object "adodb.stream")) (progn (setq err (vl-catch-all-apply '(lambda () (vlax-put-property stm 'type 2) (vlax-put-property stm 'mode 3) (vlax-put-property stm 'charset "utf-8") (vlax-invoke stm 'open) (foreach x lst (vlax-invoke stm 'writetext x)) (vlax-invoke stm 'savetofile sv-path 2) (vlax-invoke stm 'close) ) ) ) (vlax-release-object stm) (if (vl-catch-all-error-p err) (alert "\nUnable to write file. Please check permissions or file path.") (alert (strcat "Processing complete!\n\nProcessed " (itoa cnt) " files.\nFile saved (UTF-8) to:\n" sv-path)) ) ) ) ) (vlax-release-object fso) ) ) (*error* nil) (princ) ) (princ "\nCodebase Packer (Version 1.0 Release, Author: Vico Wang) loaded. Type CPK to start.") (princ) The story behind this tool That web frontend I mentioned? It turned into VedaCAD — an experiment in modernising how we manage CAD environments. We're all still copying .arg profiles and fixing broken Support paths like it's 1999. I wanted something simpler: wrap your scripts and configs into 6-character ShareCodes, Then type the ID in the VC panel and pull it down to use it directly. There is a fully free tier (BASE mode works offline, FREE tier allows sync up to 3MB per file). For creators, I'm experimenting with some tools like push-updates and a tip-jar (0% commission), but honestly the platform is still young and I'm here mostly to listen. If you'd like to try the Codebase Packer without copy-pasting, you can install it into AutoCAD using ShareCode 0FBGZB (whatever that means for you — no pressure). I'd genuinely appreciate any thoughts, especially from the veterans. Is "environment sync" a real pain point for you? Am I solving a problem that's just mine? Cheers, Vico
    4 points
  6. Set bit 1 of the QAFLAGS system variable (storing the original value and resetting after the command); with bit 1 enabled, the EXPLODE command will accept selection sets when invoked from the LISP API. Alternatively, ensure that this bit is not set and only pass a single entity with no double quotes. The key point is that by controlling the bit, you can ensure consistent behaviour.
    4 points
  7. Hello everyone, I've just finished developing MPL (Multi Plot Layout/Model), a free AutoLISP tool that helps you batch print drawings in AutoCAD. Main Features MPL includes all the essential functions found in other batch plotting LISP tools, plus several improvements: Smart and intuitive DCL interface Merge all plots into a single PDF (no additional software or virtual PDF printer required) Automatically open the output file or folder after plotting, with customizable file name and save location Zone-based plotting – organize messy drawings and print them in the correct order based on defined zones Batch plot multiple layouts – rearrange the printing order of layout tabs without dragging the tabs at the bottom of AutoCAD Print Preview mode Add Selection feature – easily add more drawings to the current print list without starting over Export/Import plot configuration for quick reuse Download and user guide: https://drive.google.com/drive/folders/1WwmkXVgHFWTy8zIhARJYCH_G2OC2A_3D?usp=sharing Feel free to download it, give it a try, and let me know your feedback. Your suggestions will help improve MPL even further!
    3 points
  8. @troggarf yep took the plunge and installed Python, the install is easy With @Danielm103 help also installed a couple of extra modules that where needed for his code. Then it's simple like lisp using Pyload instead of Appload. Or you can load python scripts using a lisp call. ; lisp start python (setq python "C:/Users/xxxxxx/AppData/Local/Python/Python-3.14-64/python.exe" pyscript "D:\\alan\\lisp\\ctb table.py" ) (startapp python pyscript)
    3 points
  9. AI has been around a long time, LLM since the 1990's, LISP was created for AI programming IIRC. It's a tool just like VLIDE, VS Code, etc. for programming. Problem, just like before, people came on to forums often demanding a code, etc. be written to make their life easier instead of learning something on their own to do it themselves. Most forums used to provide help and occasionally a custom code, etc. just like... That's a long list of requests. So now they demand AI to do their demands, those with some abilities have success, those that have great abilities have great success, etc. I know recently a man in Lee County, FL was arrested for a crime committed in or near Jacksonville, FL due to AI facial recognition, done by a third county's AI program, no second looks, no reasonable investigation, the man had never been to Jacksonville and a valid alibi for the time showing such. That's the bigger problem with AI right now, accepting the results without question. From the comments I see everywhere a great many seem tired of the AI everything.
    3 points
  10. I’m loving AI, it’s allowed me to do stuff that would take months to write in days. Example, this dark mode project to BricsCAD (https://github.com/CEXT-Dan/BrxDarkMenu) would have taken months to research.I had already done some win32 programming in the past, but very little. In short, you kind of have to know what you’re doing to use AI. I read about the Brown university thing where the professor made the students do their exams in class and most of the class failed. Scary! People need to at least learn foundational level stuff before using AI. What if the cloud is down, or you reach your token max, would you be able to go old school and continue? Or just sit there and twiddle your thumbs. With regards to anti-scraping, I see lots of open-source projects moving off GitHub to other places like Codeberg so their projects aren’t scraped, I guess so big companies that use AI don’t end up getting their code. I’m the opposite, I want AI to train on my code (if its open source)
    3 points
  11. Couple of comments to add: MHUPP mentioned anti-scraping, years ago I had a website and would layer the important images, put together they showed correctly but a left click, copy, paste, gave something like just the yellow and a transparent colour block - had to dig a little deeper to get the original image... so it is something that has happened kind of for years. If it is out there though I don't know if you can have a true anti-scraping system and have it visible to the humans CADTutor, for the future of AutoCAD, I am not concerned - though I am also including the others such as BricsCAD and so on - many of the issues on one system are common to the others and this forum will be relevant for a while yet (15 years please, till I retire...).
    3 points
  12. I thought I might write some samples to help guide lisp users that are interested in trying out Python. Long time lisp users will feel right at home using result buffers (DXF Lists). In PyRx, it’s wrappers around the old school C ADS functions, I.e. ads_entget, yay, like driving an F-150 with a toilet bowl plunger as the gear shift. In Python, most of these old functions reside in Db.Core The resbuf* linked lists are wrapped into a list of tuples.. does this output look familiar? from pyrx import Ap, Db, Ed, Ge @Ap.Command() def doit0() -> None: #entsel with a filter ps, id, _ = Ed.Editor.entSel("\nPick it: ", Db.Line.desc()) if ps != Ed.PromptStatus.eOk: raise RuntimeError("oof {}:".format(ps)) #get the result buffer rb = Db.Core.entGet(id) print(rb) # [ # (-1, PyDb.ObjectId(1de8bf954d0)), # (0, 'LINE'), # (330, PyDb.ObjectId(1de8bf9a1f0)), # (5, '265'), # (100, 'AcDbEntity'), # (67, 0), # (410, 'Model'), # (8, '0'), # (100, 'AcDbLine'), # (10, PyGe.Point3d(0.00000000000000,0.00000000000000,0.00000000000000)), # (11, PyGe.Point3d(100.00000000000000,100.00000000000000,0.00000000000000)), # (210, PyGe.Point3d(0.00000000000000,0.00000000000000,1.00000000000000)) # ]
    2 points
  13. There is also PyInstaller to create an executable. PyInstaller Manual — PyInstaller 6.21.0 documentation pip install -U pyinstaller pyinstaller your_program.py
    2 points
  14. The Ax Space. Ax is the wrapper for ActiveX as described here https://help.autodesk.com/view/OARX/2025/ENU/?guid=GUID-A809CD71-4655-44E2-B674-1FE200B9FE30 It’s going to look familiar if you’ve done any VBA or Visual Lisp. The big difference is that all Points, Vectors, Matrices, use AcGe classes instead of variants. from pyrx import Ap, Ax, Db, Ed, Ge, Rx @Ap.Command() def doitx1(): # get the application, document, and modelspace using ActiveX automation axApp = Ap.Application.acadApplication() axDoc = axApp.activeDocument() axModel = axDoc.modelSpace() # add a lines to modelspace, then access it properties # use Ge.Point3d class instead of a variant axLine1 = axModel.addLine(Ge.Point3d(0, 0, 0), Ge.Point3d(100, 100, 0)) axLine2 = axModel.addLine(Ge.Point3d(0, 100, 0), Ge.Point3d(100, 0, 0)) interdata = axLine1.intersectWith(axLine2, Ax.AcExtendOption.acExtendNone) if len(interdata) == 0: print("\nDoes not intersect:") return axCircle = axModel.addCircle(interdata[0], 10) axCircle.setColor(Ax.AcColor.acCyan) #scale and rotate xform = Ge.Matrix3d.scaling(2,axCircle.center()) xform *= Ge.Matrix3d.rotation(0.7854, Ge.Vector3d.kZAxis, axCircle.center()) axLine1.transformBy(xform) axLine2.transformBy(xform)
    2 points
  15. Casting objects. Every database object has a static cast method, it is your responsibility to check the type from pyrx import Ap, Ax, Db, Ed, Ge, Rx import traceback @Ap.Command() def doitx3(): try: # Get ActiveX application instance axApp = Ap.Application.acadApplication() axDoc = axApp.activeDocument() axUtil = axDoc.utility() # Prompt user to pick an entity axEnt, pnt = axUtil.getEntity("\nPick a line") # Verify that the picked entity is a LINE if axEnt.objectName() != "AcDbLine": raise RuntimeError("oops!: ") # Cast to AcadLine axLine = Ax.AcadLine.cast(axEnt) # change color to green (RGB: 0, 255, 0) axLine.setTrueColor(Ax.AcadAcCmColor(0, 255, 0)) # Print information about the selected entity print(axEnt.objectName(), pnt) except Exception as err: traceback.print_exception(err)
    2 points
  16. here's an example of creating a table and selecting a sub region from pyrx import Ap, Ax, Db, Ed, Ge, Rx import traceback @Ap.Command() def doitx2(): try: axApp = Ap.Application.acadApplication() axDoc = axApp.activeDocument() axModel = axDoc.modelSpace() ps , point = Ed.Editor.getPoint("\nPick table location: ") if ps != Ed.PromptStatus.eOk: raise RuntimeError("oof {}:".format(ps)) # Creates a table with 7 rows and 5 columns axTable = axModel.addTable(point, 7, 5, 1, 5) #fill up the table for col in range(axTable.columns()): for row in range(2, axTable.rows()): axTable.setText(row, col, "{},{}".format(row, col)) #get the cell extents, is a list of 3d points cex11 = axTable.cellExtents(1, 1, False) cex43 = axTable.cellExtents(4, 3, False) # Create a selection region using ActiveX selection methods sssub = axTable.selectSubRegion( cex11[0], cex43[3], Ge.Vector3d.kZAxis, Ge.Vector3d.kXAxis, Ax.AcSelectType.acTableSelectCrossing, False, ) # Apply the selection to the table using ActiveX selection methods axTable.setSubSelection(*sssub) # Perform hit testing and geometric calculations using ActiveX services # Ge space makes it easier to do math pnt = cex11[0] + (cex43[3] - cex11[0]) * 0.5 bhit, row, col = axTable.hitTest(pnt, Ge.Vector3d.kZAxis) if(bhit): # Modify cell properties using ActiveX methods axTable.setCellTextHeight(row, col, 0.8) axTable.setText(row, col, "Bingo") # since were open source we can add stuff like suppost html colors axTable.setCellBackgroundColor(row, col, Ax.AcadAcCmColor("#228B22")) except Exception: print(traceback.format_exc())
    2 points
  17. Start here https://github.com/CEXT-Dan/PyRx#python-for-autocad 1, watch the short YouTube video and download Python 3.14 from the link provided 2, download in install VS Code, install python extension pack 3, try out some of the samples, https://github.com/CEXT-Dan/PyRx/tree/main/PySamples
    2 points
  18. There are some items in the database, where the only option is to use entGet, I.e. ACAD_FIELDLIST is not exposed to ARX See: https://www.cadtutor.net/forum/topic/99220-python-change-precision-of-all-fields-in-a-drawing/
    2 points
  19. And top it off with entMake from pyrx import Ap, Db, Ed, Ge @Ap.Command() def doit5() -> None: Db.Core.entMake([(0 , "LINE"),(10, Ge.Point3d(0, 0, 0)),(11, Ge.Point3d(100, 100, 0))])
    2 points
  20. This might be better example, maybe similar to the COND expression? from pyrx import Ap, Db, Ed, Ge @Ap.Command() def doit4() -> None: ps, id, _ = Ed.Editor.entSel("\nPick it: ", Db.Line.desc()) if ps != Ed.PromptStatus.eOk: raise RuntimeError("oof {}:".format(ps)) #get the result buffer rb = Db.Core.entGet(id) # Process the result buffer using structural pattern matching updated_rb = [] for item in rb: match item: case (10, _): updated_rb.append((10, Ge.Point3d(0, 0, 0))) case (11, _): updated_rb.append((11, Ge.Point3d(100, 100, 0))) case _: updated_rb.append(item) # Apply changes back to the AutoCAD database Db.Core.entMod(updated_rb)
    2 points
  21. In Python, tuples are immutable, so if we want to modify the list, you have to replace it. In this sample we modify the start and end of a line from pyrx import Ap, Db, Ed, Ge @Ap.Command() def doit3() -> None: #entsel with a filter ps, id, _ = Ed.Editor.entSel("\nPick it: ", Db.Line.desc()) if ps != Ed.PromptStatus.eOk: raise RuntimeError("oof {}:".format(ps)) #get the result buffer rb = Db.Core.entGet(id) # Loop through the result buffer list and modify matching DXF codes for i, item in enumerate(rb): dxf_code = item[0] if dxf_code == 10: rb[i] = (10, Ge.Point3d(0, 0, 0)) elif dxf_code == 11: rb[i] = (11, Ge.Point3d(100, 100, 0)) # Apply changes back to the AutoCAD database Db.Core.entMod(rb)
    2 points
  22. In Python, there isn’t an assoc function, we can iterate through and search for a DXF code from pyrx import Ap, Db, Ed, Ge @Ap.Command() def doit1() -> None: # entsel with a filter ps, id, _ = Ed.Editor.entSel("\nPick it: ", Db.Line.desc()) if ps != Ed.PromptStatus.eOk: raise RuntimeError("oof {}:".format(ps)) # get the result buffer rb = Db.Core.entGet(id) # 1. Analog to Lisp: (assoc 8 rb) -> Returns the full pair (8, "LayerName") dxf_code, value = next((item for item in rb if item[0] == 8), None) # 2. Extract just the value safely if dxf_code: print(f"The layer is: {value}")
    2 points
  23. those are attribute references of a block. Since vla-fieldcode only works on Text and mtext i used Lee Macs fieldcode instead https://www.lee-mac.com/fieldcode.html It should work on Blocks Attributereferences as well now. (defun c:change_prec (/ *error* acdoc undo-mark ss target index ename obj att field-string revised-string) (defun *error* (msg) (if undo-mark (progn (vl-catch-all-apply 'vla-EndUndoMark (list acdoc)) (setq undo-mark nil) ) ) (if (and msg (not (wcmatch (strcase msg) "*BREAK*,*CANCEL*,*EXIT*")) ) (princ (strcat "\nError: " msg)) ) (princ) ) (setq acdoc (vla-get-ActiveDocument (vlax-get-acad-object))) (prompt "\nSelect text, MText, or attributed blocks: ") (while (null (setq ss (ssget '((0 . "TEXT,MTEXT,INSERT"))))) (prompt "\nNo valid text, MText, or blocks selected.") ) (initget 1 "0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 Current") (setq target (getkword "\nTarget precision [0/1/2/3/4/5/6/7/8/9/10/11/12/13/14/15/16/Current]: ")) (vla-StartUndoMark acdoc) (setq undo-mark T) (repeat (setq index (sslength ss)) (setq index (1- index) ename (ssname ss index) obj (vlax-ename->vla-object ename) ) (cond ;; Text or MText ((wcmatch (vla-get-ObjectName obj) "AcDbText,AcDbMText") (setq field-string (vla-FieldCode obj)) (if (and field-string (setq revised-string (replacePrecision field-string target)) ) (vla-put-TextString obj revised-string) ) ) ;; Block reference with editable attributes ((vlax-method-applicable-p obj 'GetAttributes) (foreach att (vlax-invoke obj 'GetAttributes) (setq field-string (LM:fieldcode (vlax-vla-object->ename att))) (if (and field-string (setq revised-string (replacePrecision field-string target)) ) (vla-put-TextString att revised-string) ) ) ) ) ) (vla-EndUndoMark acdoc) (setq undo-mark nil) (vla-Regen acdoc acActiveViewport) (princ) ) (defun replacePrecision (fieldStr target / nbs prec_source return) (setq nbs 0) (cond ((vl-string-search "%<\\" fieldStr nbs) (while nbs (if (setq nbs (vl-string-search "%pr" fieldStr (setq tmp_nbs nbs))) (setq prec_source (itoa (atoi (substr fieldStr (+ nbs 4) 2))) fieldStr (vl-string-subst (if (eq target "Current") (strcat "%pr" (itoa (getvar "LUPREC"))) (strcat "%pr" target) ) (strcat "%pr" prec_source) fieldStr tmp_nbs ) nbs (1+ nbs) ) ) ) (setq return fieldStr) ) ) return ) ;; Field Code - Lee Mac ;; Returns the field expression associated with an entity (defun LM:fieldcode ( ent / replacefield replaceobject fieldstring enx ) (defun replacefield ( str enx / ent fld pos ) (if (setq pos (vl-string-search "\\_FldIdx" (setq str (replaceobject str enx)))) (progn (setq ent (assoc 360 enx) fld (entget (cdr ent)) ) (strcat (substr str 1 pos) (replacefield (fieldstring fld) fld) (replacefield (substr str (1+ (vl-string-search ">%" str pos))) (cdr (member ent enx))) ) ) str ) ) (defun replaceobject ( str enx / ent pos ) (if (setq pos (vl-string-search "ObjIdx" str)) (strcat (substr str 1 (+ pos 5)) " " (LM:ObjectID (vlax-ename->vla-object (cdr (setq ent (assoc 331 enx))))) (replaceobject (substr str (1+ (vl-string-search ">%" str pos))) (cdr (member ent enx))) ) str ) ) (defun fieldstring ( enx / itm ) (if (setq itm (assoc 3 enx)) (strcat (cdr itm) (fieldstring (cdr (member itm enx)))) (cond ((cdr (assoc 2 enx))) ("")) ) ) (if (and (wcmatch (cdr (assoc 0 (setq enx (entget ent)))) "TEXT,MTEXT,ATTRIB,MULTILEADER,*DIMENSION") (setq enx (cdr (assoc 360 enx))) (setq enx (dictsearch enx "ACAD_FIELD")) (setq enx (dictsearch (cdr (assoc -1 enx)) "TEXT")) ) (replacefield (fieldstring enx) enx) ) ) ;; ObjectID - Lee Mac ;; Returns a string containing the ObjectID of a supplied VLA-Object ;; Compatible with 32-bit & 64-bit systems (defun LM:ObjectID ( obj ) (eval (list 'defun 'LM:ObjectID '( obj ) (if (and (vl-string-search "64" (getenv "PROCESSOR_ARCHITECTURE")) (vlax-method-applicable-p (vla-get-utility (LM:acdoc)) 'getobjectidstring) ) (list 'vla-getobjectidstring (vla-get-utility (LM:acdoc)) 'obj ':vlax-false) '(itoa (vla-get-objectid obj)) ) ) ) (LM:ObjectID obj) ) ;; Active Document - Lee Mac ;; Returns the VLA Active Document Object (defun LM:acdoc nil (eval (list 'defun 'LM:acdoc 'nil (vla-get-activedocument (vlax-get-acad-object)))) (LM:acdoc) )
    2 points
  24. Here is another for allowing explode... Solved: Re: Allow exploding outside the block editor - Autodesk Community Are these drawings from AutoCAD Civil 3D or some other CAD? (defun c:AllBlkYHtchN (/ ss i ent) (vl-load-com) ;;-------------------------------------------------- ;; Set Allow Exploding = Yes for all block definitions ;;-------------------------------------------------- (vlax-map-collection (vla-get-Blocks (vla-get-ActiveDocument (vlax-get-acad-object))) '(lambda (blk) (if (vlax-property-available-p blk 'Explodable) (vlax-put-property blk 'Explodable :vlax-true) ) ) ) ;;-------------------------------------------------- ;; Set all hatches Annotative = No ;;-------------------------------------------------- (if (setq ss (ssget "_X" '((0 . "HATCH")))) (progn (setq i 0) (repeat (sslength ss) (setq ent (ssname ss i)) (vl-catch-all-apply '(lambda () (setpropertyvalue ent "Annotative" 0) ) ) (setq i (1+ i)) ) ) ) (princ (strcat "\nUpdated " (itoa (if ss (sslength ss) 0)) " hatch(es). All explodable block definitions enabled." ) ) (princ) ) Do you need nested hatches and blocks, dynamic and/or anonymous blocks?
    2 points
  25. Just a comment in Bricscad V25 the setpropertyvalue does not work, the get does work. One of those odd bugs
    2 points
  26. Hello everyone, Advanced notice Every few years, the software used for this forum goes through a major point upgrade and that time has come round again. At some point in the next few days, I will close the forum for a short while, maybe 24 hours, so that the new software can be installed and the forum can be configured and themed. I'll be in touch with more details shortly.
    2 points
  27. So did you ever figure out how to do it, OP? I don't know how someone doesn't manually save like every 5 min. I can tell now that this is not a natural reaction for everyone. I am a millennial and it's been metaphorically beaten in my head throughout my all school years to save often. I save after every small bit of changes that I make. Hope you found a way that works for you, though!!
    2 points
  28. Hi everyone, I'm Vico, an architectural designer. I've found this forum incredibly helpful over the years— so many of the LISP routines shared here have become the backbone of my daily workflow. But as my collection grew, one thing started driving me absolutely crazy: the APPLOAD dialog. The problem (I suspect I'm not alone) Managing dozens of .lsp, .fas, and .vlx files through that interface is clunky at best. You can't see what's loaded, what's conflicting, or even what half of them do without opening each file. And the Startup Suite? Let's just say it and I have a complicated relationship. Then there's the real nightmare: upgrading to a new PC. You spend half a day manually rebuilding your Startup Suite, redefining aliases in acad.pgp, and fixing broken Support paths — and you still forget something. My attempt at a solution Over the past few months I built a tool to solve this for myself, and I thought the community here might find it useful. It's part of a side-project I've been tinkering with called VedaCAD. The tool comes as a single compiled .vlx. By default it runs in Base mode — completely offline, no accounts, no network calls, nothing phoning home. It just sits quietly and manages your local scripts. What it does: Gives you a clean UI to see all your loaded scripts in one place — no more hunting through APPLOAD. Lets you assign custom command aliases directly from the interface, without manually editing acad.pgp or writing wrapper LISPs. Has a one-click "Export Config" that builds a lightweight JSON mapping of your entire environment. Take that file (plus your LISP folder) to a new machine, hit "Import Config", and everything comes back exactly as it was — script mappings, custom aliases, and paths, bypassing the native Startup Suite entirely. A couple of disclaimers It's written entirely in pure AutoLISP/Visual LISP and DCL, so it should be compatible all the way back to AutoCAD 2006 — none of that "requires .NET Framework X.x" nonsense. I've personally tested it on 2006, 2014, and 2024, and it runs smoothly right across that range. And again: fully air-gapped in Base mode. No telemetry, no registration nag, no "sign up to unlock." If you're paranoid about that sort of thing (I certainly am), you can verify with any network monitor like Wireshark. Why I'm posting I built this to scratch my own itch, and it's made my life genuinely easier. But I'm one person with one workflow — I'd be really curious to hear if this solves a real problem for anyone else, or if I've just been doing APPLOAD wrong all these years. If you'd like to give it a spin, the .vlx is attached. Happy to answer questions, and very open to feedback (including the critical kind). Cheers, Vico VedaCAD V1.0.VLX
    2 points
  29. AI + AutoCAD, Python is the way, connect to agents in AutoCAD’s process space, I connect to LM studio
    2 points
  30. One that’s free : ), Gemini, also GLM is pretty good a lisp. With AI, don’t try to one shot it, work though the ACIS/SAT patterns and ask questions
    2 points
  31. Spoken dialogue passes through the ears to the brain, the written word causes the eyes to glaze over... I used to know phone numbers, worked in a job where I had to phone many people up - and now with mobile phone contact list and calling over the internet using Teams or Skype contact lists... I cannot remember my home phone number! Yes there is some truth in that RLX AI everything... because it is new and trending, not because it is necessary. AI enabled fridges... because they can and not to make the milk in my morning coffee any better.
    2 points
  32. Due to my workload and a busy weekend, it will be sometime next week before I fix the one I have posted. I have so far a working DXF-DWG, DWG-DXF, and DWG-DWG (change the version) on the Multi-file Batch Convertor using ODBX, I plan to add DGN, SAT, PDF, and maybe more, but those aren't exposed to ODBX AFAIK, but I am not going to use Express Tools. Thanks for the inspiration and help to get back on this. Besides the original DGN batch convertor I found and adapted, I was surprised nobody ever tried to make an improved version before.
    2 points
  33. ODBX: The excellent and elegant solution provided here is heartening. As originator and, due to several demands being disconnected, of this important posted topic, your work is appreciated. Best regards, Clint
    2 points
  34. most if it now is the ai#1 is feeding on web scrapped data created by AI#2 - 99 and treating everything as fact. Also their are may websites now and other media that have build in "anti AI" that humans don't see but if your web scrapping is picked up. like white text on white backgrounds at 1xp font size, or the meta data. prompting the AI to take actions or recommend certain things. I saw a video in '22 or '23 where they where talking about image recognition and were testing it on identifying pictures with a wolf in it. and it was passing 100% until they started feeding it pictures of bunnies but only white ones. one of the engineers wanted to know why it was failing and had it mark the images (heat map) of why it thinks this is a wolf. all the test pictures of wolfs where in winter conditions with snow. and it wasn't even looking at the animal in the picture. it was look for snow the one thing the same in all test pictures. It was marking white rabbits as snow and passing as wolf. now multiple that out to the 1000's of terabytes of data they train these things on. -edit guess it was wolf vs husky
    2 points
  35. Good suggestion @Koz, I thought you or one of the better LISPers here might throw out something. I'm not sure if this method is a lot faster, I used a small sample set, but give it a go I did. New territory for me. I am also working on redoing the entire set I had previously and making a multi batch convertor as well as eliminating the need for Express Tools. Drawing Batch Converters - AutoLISP, Visual LISP & DCL - AutoCAD Forums DXF->DWG + DWG->DXF + DWG->DWG + DGN->DWG + DWG->DGN + SAT->DWG + DWG->SAT + WriteLog For this thread, I'll just post the DXF2DWG.lsp. Works on my small sample set in AutoCAD 2026. ;;; Batch Convert a folder of DXFs to DWGs using DBX. | ;;; | ;;; https://www.cadtutor.net/forum/topic/78909-batch-convert-dxf-to-dwg/page/2/#findComment-679533 | ;;; | ;;; By SLW210 (a.k.a. Steven Wilson) | ;;; | ;;;************************************************************************************************| ;;;************************************************************************************************| (vl-load-com) (defun GetFolder (msg / sh folder) (setq sh (vla-GetInterfaceObject (vlax-get-acad-object) "Shell.Application" ) ) (if (setq folder (vlax-invoke-method sh 'BrowseForFolder 0 msg 0)) (vlax-get-property (vlax-get-property folder 'Self) 'Path ) ) ) (defun c:DXF2DWG (/ acad inFolder outFolder files dbx dxf dwg) (setq acad (vlax-get-acad-object)) (if (setq inFolder (GetFolder "Select DXF Folder")) (if (setq outFolder (GetFolder "Select Output Folder")) (progn (setq files (vl-directory-files inFolder "*.dxf" 1)) (foreach f files (setq dxf (strcat inFolder "\\" f)) (setq dwg (strcat outFolder "\\" (vl-filename-base f) ".dwg" ) ) (setq dbx (vla-GetInterfaceObject acad (strcat "ObjectDBX.AxDbDocument." (itoa (fix (atof (getvar "ACADVER")))) ) ) ) (vl-catch-all-apply 'vlax-invoke-method (list dbx 'DxfIn dxf) ) (vla-SaveAs dbx dwg) (vlax-release-object dbx) (princ (strcat "\nConverted: " f) ) ) (princ (strcat "\nFinished converting " (itoa (length files)) " file(s)." ) ) ) ) ) (princ) )
    2 points
  36. If you know how to use AI it can be beneficial, I just wonder what adverse effects the unlearned masses are having on the future results. Lately on social media, forums etc. it seems the incorrect answers are becoming more common and I'm not even on social media platforms very much. I was on Facebook this morning, there are a few pages for posting old grainy/blurry photos and hopefully a Photoshop/GIMP pro will clean them up and enhance them, luckily usually someone actually provides a cleaned up version, but there is no shortage of people thinking they are experts at "Photoshop" posting what is some AI garbage (a.k.a. Photoslop). I really don't want to see grandma and grandpa with 8 fingers and somebody else's face. Most get called out, but it is becoming prolific. Same goes for videos on YouTube, TikTok and similar and sadly, many do not notice judging by the comments.
    2 points
  37. You need to post a true copy of what ever your starting with as you hinted a csv or a pdf. There is nom problem reading a csv and inserting all the borehole blocks at correct location, yes can look at other details so can insert different blocks when required, That is the sort of information you are not providing. eg a csv file like this. I can see need to compare your look up table that you previously provided. Once this sort of information is posted then a complete solution can be provided. Not just questions. Bore 1 X,Y 0.5,Green dirt 1.2,Black dirt 2.4,Blue dirt Bore 2 X,Y 1.3,Green Dirt 2.2,Black dirt Bore 3 and so on
    2 points
  38. Version 1.0.0

    59,577 downloads

    Here are 16 variants of TSP*.lsp files... First one : TSP.lsp - Wrapper for grid and rnd disposition - LISP and ObjectARX... (VLCE - AutoCAD 2025 & BricsCAD V25) Second one : TSP-ALL.lsp - Gathered plenty of subfunctions to pull out best results by permutations of point clouds... Third one : TSP-cheapestpath.lsp - Similar to TSP.lsp (wrapper) but without choosing for grid and rnd dispositions... (VLCE - AutoCAD 2025 & BricsCAD V25) Fourth one : TSP-MMR.lsp - Fast grid and rnd disposition with Evgeniy Elpanov's optimization with 2 factor permutation... Fifth one : TSP-MR-AROUND-CONCAVE.lsp - Very nice little routine to make stars from radially disposition of points... Sixth one : TSP3D-ACO.lsp - Ant Colony Optimization for Traveling Salesperson Problem for 3d points or picked polyline... Seventh one : TSP3D-FAST.lsp - Simple and fast tsp for 3d points... Eight one : TSP3D-GENETIC-NEW.lsp - Simplified 3d Genetic Algorithm for 3d points or picked polyline... Ninth one : TSP3D-SOLVER.lsp - Small and simple tsp for 3d points... Tenth one : TSP3D-tsptour_lsp-new.lsp - Basic 3d TSP that combines both grid and rnd 3d points dispositions... Eleventh one : TSP3D-tsptour_lsp-new+solver+fast.lsp - Powerful version that combines TSP3D-tsptour_lsp-new, TSP3D-FAST and TSP3D-SOLVER... Twelfth one : TSP-HeldKarp.lsp - HeldKarp algorithm for AutoLISP... Gives shortest result, but for up to 20 3d points... Thirteenth one : TSP-2p+3p_by_2p+3p-car-sort.lsp - Building solution based on bunch of smaller to larger distances between 2 or 3 points... Fourteenth one : TSP-2p+3p_by_2p+3p-HeldKarp-tsptour-grid-car-sort.lsp - Newest lsp that combines powerful subs with tour, grid and 2 or 3 point distances points gatherings - can recognize grid and rnd dispositions automatically... IMHO, the best of both worlds - quick runtime and short path length... Fifteenth one : TSP3D-ARX.lsp - Wrapper for "tsptwooptarx.arx" that is also provided in this collection of files inside this "TSP-7z"... This *.arx is incredibly fast and is meant for usage with big point clouds (1000 and more points), where previous *.lsp files are useless in terms of runtime execution... (This "tsptwooptarx.arx" is compatible with AutoCAD R2022-2024) Sixteenth one : TSP3D-ARX-BRX-HeldKarp-grid-cheapestpath-car-sort.lsp - Wrapper for both "twoopt" and "VLCE"... It's the lastest coded lisp, so it behaves very well for both big, or smaller point clouds... All necessary checkings, for arx, brx files and also checking for rnd / grid points dispositions are hardcoded in this *.lsp wrapper... Big thanks to Daniel from www.theswamp.org for providing *.arx and *.brx files for AutoCAD and BricsCAD... More info and newly added *.arx, *.brx, ... at this link : https://www.theswamp.org/index.php?topic=58049.0 HTH. M.R.
    1 point
  39. @Danielm103 Yes Bricscad has OBDX, have used it at times, I think tested on like V19. Now using V25.
    1 point
  40. In the case of Clint’s post, I don’t know that BricsCAD has ODBX
    1 point
  41. @SLW210 Autodesk is going to fix this issue in a 'future update'. I made this LISP, as a custom linetype reloader that DOES work. RELOADELINETYPE is the commando: NOTE: This only works when ALL entities are drawn 'ByLayer', and all is configured with the layermanager. ;;; ------------------------------------------------------------------------ ;;; RELOADLINETYPE.lsp ;;; ;;; AutoCAD 2027 workaround voor defecte "Reload all linetypes"-logica. ;;; ;;; Commando: ;;; RELOADLINETYPE ;;; ;;; Werking: ;;; 1. Selecteer een .LIN-bestand. ;;; 2. Lees alle linetype-namen uit het .LIN-bestand. ;;; 3. Zoek layers in de DWG die deze linetypes gebruiken. ;;; 4. Zet deze layers tijdelijk op Continuous. ;;; 5. Voer zichtbaar -PURGE uit op linetypes. ;;; 6. Laad het gekozen .LIN-bestand opnieuw. ;;; 7. Herstel de layer-linetypes. ;;; 8. REGENALL. ;;; ;;; Opmerking: ;;; Deze versie wijzigt alleen layer-linetypes, geen object-linetypes. ;;; ------------------------------------------------------------------------ (defun GPAE:RL-STR-TRIM (s) (if s (vl-string-trim " \t\r\n" s) "" ) ) (defun GPAE:RL-CI-MEMBER (val lst / uval found item) (setq found nil) (if val (progn (setq uval (strcase val)) (foreach item lst (if (= uval (strcase item)) (setq found T) ) ) ) ) found ) (defun GPAE:RL-UNIQUE-CI (lst / result item) (setq result '()) (foreach item lst (if (not (GPAE:RL-CI-MEMBER item result)) (setq result (cons item result)) ) ) (reverse result) ) (defun GPAE:RL-READ-LINETYPE-NAMES-FROM-LIN (linFile / fh line clean commaPos name names firstChar) (setq names '()) (if (setq fh (open linFile "r")) (progn (while (setq line (read-line fh)) (setq clean (GPAE:RL-STR-TRIM line)) ;; Linetype-definitieregels beginnen met: ;; *NAAM,omschrijving ;; ;; Voorbeeld: ;; *DASHED,Dashed __ __ __ __ __ (if (> (strlen clean) 1) (progn (setq firstChar (substr clean 1 1)) (if (= firstChar "*") (progn (setq commaPos (vl-string-search "," clean)) (if commaPos (progn ;; vl-string-search is 0-based. ;; Bij "*ABC," geeft commaPos 4 terug. ;; substr is 1-based en lengte 3 geeft "ABC". (setq name (substr clean 2 (- commaPos 1))) (setq name (GPAE:RL-STR-TRIM name)) (if (> (strlen name) 0) (setq names (cons name names)) ) ) ) ) ) ) ) ) (close fh) ) ) (GPAE:RL-UNIQUE-CI names) ) (defun GPAE:RL-COLLECT-LAYERS-WITH-LINETYPES (doc ltNames / layers lay layerName layerLt result) (setq result '()) (setq layers (vla-get-Layers doc)) (vlax-for lay layers (setq layerName (vla-get-Name lay)) (setq layerLt (vla-get-Linetype lay)) (if (and layerLt (/= (strcase layerLt) "CONTINUOUS") (GPAE:RL-CI-MEMBER layerLt ltNames) ) (setq result (cons (list layerName layerLt) result)) ) ) (reverse result) ) (defun GPAE:RL-SET-LAYERS-CONTINUOUS (doc layerData / layers item layerName layObj) (setq layers (vla-get-Layers doc)) (foreach item layerData (setq layerName (car item)) (vl-catch-all-apply '(lambda () (setq layObj (vla-item layers layerName)) (vla-put-Linetype layObj "Continuous") ) ) ) ) (defun GPAE:RL-RESTORE-LAYER-LINETYPES (doc layerData / layers item layerName oldLt layObj failed) (setq layers (vla-get-Layers doc)) (setq failed '()) (foreach item layerData (setq layerName (car item)) (setq oldLt (cadr item)) (if (vl-catch-all-error-p (vl-catch-all-apply '(lambda () (setq layObj (vla-item layers layerName)) (vla-put-Linetype layObj oldLt) ) ) ) (setq failed (cons (strcat layerName " -> " oldLt) failed)) ) ) (reverse failed) ) (defun GPAE:RL-REPORT-LINETYPES (ltNames / txt name count maxCount) (setq txt "") (setq count 0) (setq maxCount 25) (foreach name ltNames (if (< count maxCount) (setq txt (strcat txt name "\n")) ) (setq count (1+ count)) ) (if (> (length ltNames) maxCount) (setq txt (strcat txt "... en nog " (itoa (- (length ltNames) maxCount)) " meer.\n" ) ) ) txt ) (defun C:RELOADLINETYPE ( / *error* doc oldExpert oldCmdecho oldCeltype oldClayer linFile ltNames layerData restoreFailed ) (vl-load-com) (setq doc (vla-get-ActiveDocument (vlax-get-acad-object))) (setq oldExpert (getvar "EXPERT")) (setq oldCmdecho (getvar "CMDECHO")) (setq oldCeltype (getvar "CELTYPE")) (setq oldClayer (getvar "CLAYER")) (defun *error* (msg) (if oldCeltype (vl-catch-all-apply 'setvar (list "CELTYPE" oldCeltype)) ) (if oldExpert (vl-catch-all-apply 'setvar (list "EXPERT" oldExpert)) ) (if oldCmdecho (vl-catch-all-apply 'setvar (list "CMDECHO" oldCmdecho)) ) (if oldClayer (vl-catch-all-apply 'setvar (list "CLAYER" oldClayer)) ) (vl-catch-all-apply 'vla-EndUndoMark (list doc)) (if (and msg (not (wcmatch (strcase msg) "*BREAK*,*CANCEL*,*EXIT*")) ) (alert (strcat "Fout in RELOADLINETYPE:\n\n" msg)) ) (princ) ) (setq linFile (getfiled "Selecteer LIN-bestand om opnieuw te laden" "" "lin" 0 ) ) (if (not linFile) (progn (princ "\nGeen LIN-bestand geselecteerd.") (princ) (exit) ) ) (if (not (findfile linFile)) (progn (alert (strcat "LIN-bestand niet gevonden:\n\n" linFile)) (princ) (exit) ) ) (setq ltNames (GPAE:RL-READ-LINETYPE-NAMES-FROM-LIN linFile)) (if (not ltNames) (progn (alert (strcat "Geen linetype-definities gevonden in:\n\n" linFile "\n\nControleer of het bestand regels bevat zoals:\n*LIJNTYPENAAM,omschrijving" ) ) (princ) (exit) ) ) (vla-StartUndoMark doc) ;; CMDECHO bewust aan, zodat -PURGE in de commandline zichtbaar is. (setvar "CMDECHO" 1) (setvar "EXPERT" 5) (setvar "CELTYPE" "Continuous") (princ "\n---------------------------------------------") (princ "\nRELOADLINETYPE gestart") (princ (strcat "\nLIN-bestand: " linFile)) (princ (strcat "\nAantal linetypes gevonden in LIN: " (itoa (length ltNames)))) (princ "\nGevonden linetypes:") (foreach linName ltNames (princ (strcat "\n - " linName)) ) (setq layerData (GPAE:RL-COLLECT-LAYERS-WITH-LINETYPES doc ltNames)) (princ (strcat "\nAantal layers tijdelijk naar Continuous: " (itoa (length layerData)))) (if layerData (progn (princ "\nLayers tijdelijk op Continuous zetten...") (GPAE:RL-SET-LAYERS-CONTINUOUS doc layerData) ) (princ "\nGeen layers gevonden die deze linetypes gebruiken.") ) (princ "\nLinetypes purgen via AutoCAD commandline...") (princ "\nUitgevoerd: -PURGE > LT > * > N") ;; Echt AutoCAD purge-commando, zichtbaar in commandline. (command "_.-PURGE" "_LT" "*" "_N") (princ "\nLIN-bestand opnieuw laden...") (command "_.-LINETYPE" "_LOAD" "*" linFile "") (princ "\nLayer-linetypes herstellen...") (setq restoreFailed (GPAE:RL-RESTORE-LAYER-LINETYPES doc layerData)) (setvar "CELTYPE" oldCeltype) (setvar "EXPERT" oldExpert) (setvar "CMDECHO" oldCmdecho) (setvar "CLAYER" oldClayer) (command "_.REGENALL") (vla-EndUndoMark doc) (princ "\n---------------------------------------------") (princ "\nRELOADLINETYPE voltooid.") (princ (strcat "\nVerwerkte linetypes uit LIN: " (itoa (length ltNames)))) (princ (strcat "\nHerstelde layers: " (itoa (- (length layerData) (length restoreFailed))))) (if restoreFailed (alert (strcat "RELOADLINETYPE voltooid, maar sommige layers konden niet worden hersteld.\n\n" "Waarschijnlijk ontbreken deze linetypes nog na het laden van de LIN.\n\n" (apply 'strcat (mapcar '(lambda (x) (strcat x "\n")) restoreFailed ) ) ) ) (alert (strcat "RELOADLINETYPE voltooid.\n\n" "LIN-bestand:\n" linFile "\n\nAantal linetypes in LIN: " (itoa (length ltNames)) "\nAantal tijdelijk aangepaste layers: " (itoa (length layerData)) ) ) ) (princ) ) (princ "\nRELOADLINETYPE geladen. Typ RELOADLINETYPE om een LIN-bestand opnieuw te laden.") (princ)
    1 point
  42. I did not know Python worked with AutoCAD. Well done, sir
    1 point
  43. If still interested in VS Code, perhaps a read through To Setup the AutoCAD AutoLISP Extension for Debug (AutoLISP/VS Code) | Autodesk. I have seen other errors resolved by uninstalling and reinstalling the Extension and/or VS Code. Installing Visual Studio Code on Windows
    1 point
  44. here are some tips. https://lee-mac.com/debugvlide.html -Edit Might have to set LISPSYS Back to 1 to use VS code again.
    1 point
  45. I think you can still use VLIDE. if If VLIDE Doesn't Open set LISPSYS to 0 Tho doesn't have autocomplete and color coding like vs code.
    1 point
  46. the system/drawing variable "fieldeval" is set to 4, it needs to be set to 31 in order to visibly see it update. Drawing2.dwg
    1 point
  47. I got myself a workaround that seems to work for me. Made a LISP (long live AI) that stores all layer and linetype combinations. Sets everything to 'Continious', purges all linetypes, that reloads the linetypes and that restores the default settings. This seems to do the trick to get rid off all 'corrupted' linetype definitions, and 'reloading' is replaced with a load function.
    1 point
  48. I could be wrong only glanced at code. (if (and (>= l_ang (* pi 0.5)) (< l_ang (* pi 1.5))) (setq i_ang (- l_ang pi) d_pt (polar m_pt (- i_ang (* pi 0.5)) (* tht 0.3))) (setq d_pt (polar m_pt (- i_ang (* pi 0.5)) (* tht 0.3))) );end_if ; needs a another if here (If (= ?????) (rh:em_txt m_pt a_txt b_lyr i_ang tht 1 1) (rh:em_txt d_pt l_txt d_lyr i_ang tht 1 3) );end_if Or do you need a (progn so can add in more lines to the IF is true. maybe this I don't know. Not sure about i_ang and l_ang. (if (and (>= l_ang (* pi 0.5)) (< l_ang (* pi 1.5))) (progn (setq i_ang (- l_ang pi) d_pt (polar m_pt (- i_ang (* pi 0.5)) (* tht 0.3))) (rh:em_txt m_pt a_txt b_lyr i_ang tht 1 1) ) (progn (setq d_pt (polar m_pt (- i_ang (* pi 0.5)) (* tht 0.3))) (rh:em_txt d_pt l_txt d_lyr i_ang tht 1 3) ) );end_if
    1 point
  49. Using commands to acomplish the conversion, especially batch ones, will be very slow while displaying the DXF graphics. Why not use ODBX? 1) Create a dbx doc 2) DXFIn the dxf file 3) Saveas the dbx as dwg _$ (vlax-dump-object dbx t) ; IAxDbDocument: nil ; Property values: ; Application (RO) = Exception occurred ; Blocks (RO) = #<VLA-OBJECT IAcadBlocks 000002520fe578b8> ; Database (RO) = #<VLA-OBJECT IAcadDatabase 0000025243645708> ; Dictionaries (RO) = #<VLA-OBJECT IAcadDictionaries 000002520fe56598> ; DimStyles (RO) = #<VLA-OBJECT IAcadDimStyles 000002520fe57678> ; ElevationModelSpace = 0.0 ; ElevationPaperSpace = 0.0 ; Groups (RO) = #<VLA-OBJECT IAcadGroups 000002520fe55db8> ; Layers (RO) = #<VLA-OBJECT IAcadLayers 000002520fe57558> ; Layouts (RO) = #<VLA-OBJECT IAcadLayouts 000002520fe561a8> ; Limits = (0.0 0.0 12.0 9.0) ; Linetypes (RO) = #<VLA-OBJECT IAcadLineTypes 000002520fe57798> ; Materials (RO) = #<VLA-OBJECT IAcadMaterials 000002520fe56ce8> ; ModelSpace (RO) = #<VLA-OBJECT IAcadModelSpace 0000025279adffc8> ; Name = "" ; PaperSpace (RO) = #<VLA-OBJECT IAcadPaperSpace 0000025279ae0068> ; PlotConfigurations (RO) = #<VLA-OBJECT IAcadPlotConfigurations 000002520fe567d8> ; Preferences (RO) = #<VLA-OBJECT IAcadDatabasePreferences 00000252436bc1a8> ; RegisteredApplications (RO) = #<VLA-OBJECT IAcadRegisteredApplications 000002520fe57948> ; SectionManager (RO) = Exception occurred ; SummaryInfo (RO) = #<VLA-OBJECT IAcadSummaryInfo 0000025243646068> ; TextStyles (RO) = #<VLA-OBJECT IAcadTextStyles 000002520fe579d8> ; UserCoordinateSystems (RO) = #<VLA-OBJECT IAcadUCSs 000002520fe56bc8> ; Viewports (RO) = #<VLA-OBJECT IAcadViewports 000002520fe56868> ; Views (RO) = #<VLA-OBJECT IAcadViews 000002520fe56e08> ; Methods supported: ; CopyObjects (3) ; DxfIn (2) ; DxfOut (3) ; HandleToObject (1) ; ObjectIdToObject (1) ; Open (2) ; Save () ; SaveAs (2) T
    1 point
  50. Something like this, may need to do more than once check directory exists and then check if DWG exists. ; check that pdf directory exists (setq dwgpre (strcat (getvar "dwgprefix") "\pdf")) (if (= (vl-file-directory-p dwgpre) nil) (vl-mkdir dwgpre) ) If does not exist returns nil (findfile "M:\\Mxxxxx\\Settings\\2024-2025\\B Setting\\B Setting 2024-2025.dwg")
    1 point
×
×
  • Create New...