Jump to content

All Activity

This stream auto-updates

  1. Past hour
  2. If you want you can do something like (setq LispSys_Old (getvar 'lispsys)) (setvar 'lispsys 0) ... do your code here (setvar 'lispsys LispSys_Old) to set it and reset it to what it was if you are worried about the change affecting other things. I would normally set a variable and return it to what it was with the least code in between in case the LISP is interrupted or to put in error handling to return it to its original value
  3. After changing the variable LISPSYS=0, you need to restart Autocad. The code UNFORMAT worked perfectly! Thanks! Won't this affect the work of other lisp programs ?
  4. Today
  5. Try setting LISPSYS=0 if you haven't already.
  6. Yes, both versions are on the same computer. And before that, everything worked in autocad 2015. That's why I'm at a loss. Thank you very much.
  7. It's simply that your version of LM:UnFormat (I don't know if it's the original or modified one) isn't compatible with some localized versions of AutoCAD. Is your version of AutoCAD 2019 on the same PC as the 2021 version?
  8. GRABTEXTS Writing on the command line: (1 . ) (1 . )
  9. No, I didn't understand why the first code didn't work.
  10. Maybe you deleted some parentheses when you removed the T argument.
  11. ((= otyp "MTEXT")(print (vla-get-TextString obj))(vla-put-TextString obj (supriFMT (vla-get-TextString obj)))) ; AcDbMText It looks like it worked! Thank you all! I'll test it again. But I still haven't figured out what the problem is...
  12. ((= otyp "MTEXT")(print (vla-get-TextString obj))(vla-put-TextString obj (supriFMT (vla-get-TextString obj)))) ; AcDbMText It looks like it worked! Thank you all! I'll test it again.
  13. I'll put this one here for later. I have a suspicion that the text is still there, just not visible - very small perhaps. This will show all the mtext values (first 256 characters anyway) in the drawing. Run it after your unformat just to confirm that the texts have been deleted or are just not visible. (defun c:GrabTexts ( / MySS acount MyEnt) (setq myss (ssget "_X" '((0 . "mtext")))) (setq acount 0) (while (< acount (sslength myss)) (setq Myent (ssname Myss acount)) (princ "\n")(princ (assoc 1 (entget MyEnt))) (setq acount (+ acount 1)) ) ; end while )
  14. Write before (vla-put-textstring obj (vla-get-TextString obj)) this: (print (vla-get-TextString obj)), load it, run it and share a screenshot of what happened on the command line PS: Also make sure you've closed all the parentheses in your Lisp expression: your last message seems to be missing a closing parenthesis.
  15. ((= otyp "MTEXT")(vla-put-TextString obj (supriFMT (vla-get-TextString obj)) ; error: incorrectly generated list at the entrance
  16. The 'T' argument in the call to 'supriFMT' is unnecessary. That's why it returns 'too many arguments'. You should delete it. Find the line where you replaced LM:UnFormat with SupriFMT and notice there's a 'T': you should delete it.
  17. The AutoCAD Blog

    Can’t Miss AutoCAD Sessions at AU 2025

    It’s time to kick up your heels at AU: The Design & Make Conference 2025! This year in Nashville, AU 2025 is set to be another unforgettable experience. It’s where connections are made, innovation takes center stage, and the future is made as bright as the Music City lights. Registration is open as well as the session catalog. Here’s a quick, at-a-glance guide to help build your schedule so it’s chock full of AutoCAD goodness. And one to put at the top of your list? Join the AECO Roadmap: AutoCAD session. Get a front-row seat to what’s next for AutoCAD. The AutoCAD product team—including AutoCAD VP Marcus O’Brien and product managers Dan Whitcombe and Anum Mithani—will walk you through the latest enhancements and offer a preview of upcoming features that are redefining design and drafting. We can’t wait to see you there! Tuesday, September 16 10 Ways to Work Smarter and Protect Intellectual Property in AutoCAD Tuesday, September 16 11:00 AM – 12:00 PM CDT Unlock the full potential of AutoCAD software while safeguarding your intellectual property (IP), with this session on 10 essential strategies presented by Autodesk’s Sachin Singh and Kate Adam. Modernizing Your AutoCAD .NET Projects: Refactoring with .NET 8 Tuesday, September 16 12:30 PM – 1:00 PM CDT Learn how to bring your AutoCAD .NET Framework applications to work with AutoCAD 2025 and newer by refactoring them for .NET 8. James Johnson of Synergis Software Technologies will walk through key refactoring strategies, framework updates, and compatibility considerations to modernize your projects. Work Smarter, Draft Faster: Turbocharge Construction Documentation with AutoCAD Architecture and AutoCAD MEP Schedules Tuesday, September 16 1:30 PM – 2:30 PM CDT Autodesk’s Sridhar Subramani will share how AutoCAD Architecture and AutoCAD MEP Schedules can help you boost productivity and transform construction documentation workflows with ease, requiring only a minimal time investment. Design Review Workflows for AutoCAD and Civil 3D Users Tuesday, September 16 4:30 PM – 5:30 PM CDT In this session, Autodesk’s Aitana Marcos Guinea and Tedman Martinez will walk you through the cloud-based collaboration capabilities we’re investing in to help you communicate and coordinate more effectively with both internal and external stakeholders—driving faster design outcomes. Wednesday, September 17 Common Data Club: AEC Tools on Autodesk Docs Wednesday, September 17 1:30 PM – 2:30 PM CDT This panel with Autodesk’s Kerry Ko, Can Anbarlilar, Audrey Boguchwal, Andrew Milford, and Megan Green will showcase how Autodesk Docs can break down the information barriers and get you on the path toward the Autodesk Forma industry cloud for AutoCAD, Civil 3D, and Revit users. Shipshape 2.0: Smarter Standards and Leaner Layers with AI in AutoCAD Wednesday, September 17 3:00 PM – 4:00 PM CDT Join Shaun “CADjedi” Bryant (Autodesk Expert Elite and Autodesk Certified Instructor) for this advanced session that will dive deeper into best practices for keeping your AutoCAD environments clean, lean, and agile with a new twist: using tools powered by artificial intelligence (AI). Designing Tomorrow: Autodesk AI Innovations in AutoCAD Wednesday, September 17 3:00 PM – 4:00 PM CDT This product demo with Autodesk’s Anum Mithani and Anand Rajagopalwill showcase Autodesk AI features, including Markup Import and Assist, Smart Blocks: Search and Convert, Smart Blocks: Detect and Convert, and Autodesk Assistant. Help Shape a Smarter AutoCAD Wednesday, September 17 3:00 PM – 4:00 PM CDT Discover the latest updates and join the discussion to shape a smarter AutoCAD with Autodesk’s Peter Qian and mediated by Brian Levendowski, Autodesk Technology Lead at Kimberly-Horn. Drawing from Experience: A CAD Manager’s Guide to Connecting Workflows, Data, and Teams Wednesday, September 17 4:30 PM – 5:30 PM CDT This award-winning panel is back again with new topics to discuss and insights to share. This year, the panel will comprise a diverse group of CAD managers—R.K. McSwain, Rick Ellis, and Mike Thomas—to discuss topics ranging from technology and data to the even more challenging human aspects of teams and workflows. The Future of CAD Management: How AI Is Transforming AutoCAD and Civil 3D Wednesday, September 17 4:30 PM – 5:30 PM CDT In this session with Dan Lench and Justin Sepanski of WSB, you’ll explore how AI technologies—including ChatGPT for conversational assistance and script guidance, Autodesk Platform Services for seamless integration, and Dynamo for low-code automation—are reshaping CAD workflows in AutoCAD and Civil 3D software. The 10-Minute AutoCAD Cleanup: Use Autodesk Assistant and Scripts to Fix Messy Drawings (Live Demo!) Wednesday, September 17 4:30 PM – 5:30 PM CDT Struggling with chaotic client DWGs? In this demo session with architect Antonio Fontenele, you’ll learn how to combine Autodesk Assistant and AutoLISP scripts (for layer/block cleanup) to transform unreadable drawings into production-ready files in minutes. A Dynamic Lab on AutoCAD Dynamic Blocks Wednesday, September 17 1:30 PM – 3:00 PM CDT For this hands-on lab, Terry Chadwick, Computer Drafting Professor at Hutchinson Community College, will guide you through the steps to start building your own dynamic blocks. Thursday, September 18 AutoCAD Tips, Tricks, and the Most Stage-Ready Drafting Techniques Thursday, September 18 12:30 PM – 1:30 PM CDT If your hatches don’t have rhythm and your linework’s got the blues, it’s time to find your high note with the most stage-ready drafting techniques. In this toe-tappin’, line-snappin’, award-winning session, Autodesk Expert Elite Member and AutoCAD Blog author Donnie “The CAD Geek” Gladfelter will deliver techniques as smooth as a steel guitar and as sharp as a sheet set on deadline. MEP Content Editor: Fabrication Services and Content Creation Workshop Thursday, September 18 1:30 PM – 3:00 PM CDT In this session, Craig Farrish of Autodesk and Louie Mdanat of ARKANCE USA explore Autodesk’s MEP Content Editor, a powerful tool designed to streamline the creation and customization of fabrication components within Revit and AutoCAD workflows. Streamline and Automate Standards Management with Project-Aware Connected Support Files in AutoCAD and Autodesk Docs Thursday, September 18 3:00 PM – 4:00 PM CDT Revolutionize your admin workflow with the new Connected Support Files feature in AutoCAD and Autodesk Docs to unlock consistent project standards without requiring individual setup or complex automations! Join Autodesk’s Kerry Ko, Amarjeet Sonkar, and Damian Willcox to learn how you can configure support files via Autodesk Docs projects—ensuring everyone’s working with the correct files and settings, reducing errors, and improving efficiency. Register Today If you haven’t booked your AU trip yet, you might have a bit of FOMO from this list of amazing sessions to choose from. Browse the full session catalog for even more and check out the agenda for key events, including General Session, keynotes, and the very important AU party! Registration is open, so don’t delay! Can’t make it to Nashville? Join the global community shaping the future of design and make with your free Digital Pass. Unlock live keynotes, join featured programming, and access digital-only content built to inspire and connect—wherever you are. The post Can’t Miss AutoCAD Sessions at AU 2025 appeared first on AutoCAD Blog. View the full article
  18. (supriFMT (vla-get-TextString obj) T) becomes (supriFMT (vla-get-TextString obj) )
  19. ; UnFormat MText, MLeader, Table - strip formatting contol codes from texts ; ; based on Lee Mac's UnFormat string - www.lee-mac.com/unformatstring.html ; CAD Studio, 2018, www.cadstudio.cz www.cadforum.cz ; ; (vl-load-com) ;;-------------------=={ UnFormat String }==------------------;; ;; ;; ;; Returns a string with all MText formatting codes removed. ;; ;;------------------------------------------------------------;; ;; Author: Lee Mac, Copyright © 2011 - www.lee-mac.com ;; ;;------------------------------------------------------------;; ;; Arguments: ;; ;; str - String to Process ;; ;; mtx - MText Flag (T if string is for use in MText) ;; ;;------------------------------------------------------------;; ;; Returns: String with formatting codes removed ;; ;;------------------------------------------------------------;; (defun supriFMT (tx / rtx separa<->palabras) (defun separa<->palabras (tx lstCtrs / c p l) (foreach c (vl-string->list tx) (if (member (setq c (chr c)) lstCtrs) (if p (setq l (cons p l) p nil)) (setq p (if p (strcat p c) c)) ) ) (reverse (if p (cons p l) l)) ) (foreach v (separa<->palabras tx '(";" "{" "}" )) (if (not (wcmatch v "\\*")) (setq rtx (strcat (if rtx rtx "") (car (separa<->palabras v '("\\" ))))) ) ) ) (defun LM:UnFormat ( str mtx / _replace rx ) (defun _replace ( new old str ) (vlax-put-property rx 'pattern old) (vlax-invoke rx 'replace str new) ) (if (setq rx (vlax-get-or-create-object "VBScript.RegExp")) (progn (setq str (vl-catch-all-apply (function (lambda ( ) (vlax-put-property rx 'global actrue) (vlax-put-property rx 'multiline actrue) (vlax-put-property rx 'ignorecase acfalse) (foreach pair '( ("\032" . "\\\\\\\\") (" " . "\\\\P|\\n|\\t") ("$1" . "\\\\(\\\\[ACcFfHLlOopQTW])|\\\\[ACcFfHLlOopQTW][^\\\\;]*;|\\\\[ACcFfHLlOopQTW]") ("$1$2/$3" . "([^\\\\])\\\\S([^;]*)[/#\\^]([^;]*);") ("$1$2" . "\\\\(\\\\S)|[\\\\](})|}") ("$1" . "[\\\\]({)|{") ) (setq str (_replace (car pair) (cdr pair) str)) ) (if mtx (_replace "\\\\" "\032" (_replace "\\$1$2$3" "(\\\\[ACcFfHLlOoPpQSTW])|({)|(})" str)) (_replace "\\" "\032" str) ) ) ) ) ) (vlax-release-object rx) (if (null (vl-catch-all-error-p str)) str ) ) ) ) ;----------------- (defun doUnformatTable (table / rowCounter colCounter) (setq rowCounter (vla-Get-Rows table)) (repeat rowCounter (setq rowCounter (1- rowCounter)) (setq colCounter (vla-Get-Columns table)) (repeat colCounter (setq colCounter (1- colCounter)) (setq cellType (vla-GetCellType table rowCounter colCounter)) (if (= cellType acTextCell)(progn (setq cellText (vla-GetText table rowCounter colCounter)) (if (/= cellText "") (vla-SetText table rowCounter colCounter (LM:UnFormat cellText T))) )) ) ; rep ) ; rep ) (defun c:UNFORMAT_FMT (/ ss ssl cnt en xxobj otyp txr ntx) (princ "\nSelect MTEXTs/DIMENSIONs/MLEADERs/TABLEs: ") (setq ss (ssget '((0 . "MTEXT,DIMENSION,MULTILEADER,ACAD_TABLE")))) (if (and ss (> (setq ssl (sslength ss)) 0))(progn (setq cnt 0) (repeat ssl ; (setq en (ssname ss cnt)) (setq en (ssname ss cnt)) ex en ;? (setq obj (vlax-ename->vla-object en)) (setq otyp (cdr (assoc 0 (entget en)))) ; (vla-get-objectname obj)) (cond ((= otyp "MTEXT")(vla-put-TextString obj (supriFMT (vla-get-TextString obj) T))) ; AcDbMText ((= otyp "DIMENSION")(vla-put-TextOverride obj (LM:UnFormat (vla-get-TextOverride obj) T))) ; AcDbRotatedDimension, AcDbAlignedDimension ((= otyp "MULTILEADER")(vla-put-TextString obj(LM:UnFormat (vla-get-TextString obj) T))) ; AcDbMLeader ((= otyp "ACAD_TABLE")(doUnformatTable obj)) ; AcDbTable ) (setq cnt (1+ cnt)) ) ;rep ) (princ "\nNothing selected!") ) ;if (princ) ) (princ "\nUNFORMAT loaded.") (princ) error: too many arguments ???
  20. PS: You should also remove the T argument from the call to 'supriFMT'.
  21. I don't know if the format used in the other LM:UnFormat objects is the same as in MTEXT. Therefore, this function is, in principle, only valid for MTEXT.
  22. Paste this function into your code. (defun supriFMT (tx / rtx separa<->palabras) (defun separa<->palabras (tx lstCtrs / c p l) (foreach c (vl-string->list tx) (if (member (setq c (chr c)) lstCtrs) (if p (setq l (cons p l) p nil)) (setq p (if p (strcat p c) c)) ) ) (reverse (if p (cons p l) l)) ) (foreach v (separa<->palabras tx '(";" "{" "}" )) (if (not (wcmatch v "\\*")) (setq rtx (strcat (if rtx rtx "") (car (separa<->palabras v '("\\" ))))) ) ) ) Then replace 'LM:UnFormat' with 'supriFMT' inside the '((= otyp "MTEXT")' clause.
  23. CivilTechSource

    LISP Command names and shortcuts

    I added a prefix to all my lisp e.g. LE-XXXx. So when I type LE- all my lisps load and can still have the full name LE-SetMyTopo. I try to categorise lisps based on function. LE-SetMyXXX, LE-FixMyXXX, LE-Draw, LE-ModXXXX
  24. If I reset the AutoCAD settings to the default values and then add my custom settings again, will the error happen again? It doesn't seem to me to be related to user settings. I use a lot of codes, and they all work flawlessly.
  25. CivilTechSource

    CUI Input Text Field?

    Thank you so much! Managed to create a dropdown list that you select between existing and proposed and sets a variable to "Existing" or "Proposed" and amended the lisp to read the Global Variable! This is so handy, but feels it can be a pain to maintain but definitely sped up my workflow thank you!
  26. No, empty texts again...
  27. So we can force the height to be something like this - just as an example for your sample drawings above, see if it makes your text visible again (defun c:UNFORMAT ( / ss ssl cnt en xxobj otyp txr ntx MyText) ;;;;;;;;;;;;; mAssoc;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun mAssoc ( key lst / result ) ;; Lee Mac (foreach x lst (if (= key (car x)) (setq result (cons (cdr x) result)) ) ) (reverse result) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; UnFormat MText, MLeader, Table - strip formatting contol codes from texts ; ; based on Lee Mac's UnFormat string - www.lee-mac.com/unformatstring.html ; CAD Studio, 2018, www.cadstudio.cz www.cadforum.cz ; ; (vl-load-com) ;;-------------------=={ UnFormat String }==------------------;; ;; ;; ;; Returns a string with all MText formatting codes removed. ;; ;;------------------------------------------------------------;; ;; Author: Lee Mac, Copyright © 2011 - www.lee-mac.com ;; ;;------------------------------------------------------------;; ;; Arguments: ;; ;; str - String to Process ;; ;; mtx - MText Flag (T if string is for use in MText) ;; ;;------------------------------------------------------------;; ;; Returns: String with formatting codes removed ;; ;;------------------------------------------------------------;; ;;SP ASSUMING LEE MAC PART WORKS. IT USUALLY DOES. (defun LM:UnFormat ( str mtx / _replace rx ) (defun _replace ( new old str ) (vlax-put-property rx 'pattern old) (vlax-invoke rx 'replace str new) ) (if (setq rx (vlax-get-or-create-object "VBScript.RegExp")) (progn (setq str (vl-catch-all-apply (function (lambda ( ) (vlax-put-property rx 'global actrue) (vlax-put-property rx 'multiline actrue) (vlax-put-property rx 'ignorecase acfalse) (foreach pair '( ("\032" . "\\\\\\\\") (" " . "\\\\P|\\n|\\t") ("$1" . "\\\\(\\\\[ACcFfHLlOopQTW])|\\\\[ACcFfHLlOopQTW][^\\\\;]*;|\\\\[ACcFfHLlOopQTW]") ("$1$2/$3" . "([^\\\\])\\\\S([^;]*)[/#\\^]([^;]*);") ("$1$2" . "\\\\(\\\\S)|[\\\\](})|}") ("$1" . "[\\\\]({)|{") ) (setq str (_replace (car pair) (cdr pair) str)) ) (if mtx (_replace "\\\\" "\032" (_replace "\\$1$2$3" "(\\\\[ACcFfHLlOoPpQSTW])|({)|(})" str)) (_replace "\\" "\032" str) ) ) ) ) ) (vlax-release-object rx) (if (null (vl-catch-all-error-p str)) str ) ) ) ) ;; End LM:Unformat ;----------------- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun doUnformatTable (table / rowCounter colCounter) (setq rowCounter (vla-Get-Rows table)) (repeat rowCounter (setq rowCounter (1- rowCounter)) (setq colCounter (vla-Get-Columns table)) (repeat colCounter (setq colCounter (1- colCounter)) (setq cellType (vla-GetCellType table rowCounter colCounter)) (if (= cellType acTextCell)(progn (setq cellText (vla-GetText table rowCounter colCounter)) (if (/= cellText "") (vla-SetText table rowCounter colCounter (LM:UnFormat cellText T))) )) ; end if, end if ) ; rep ) ; rep ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; End Sub routines (princ "\nSelect MTEXTs/DIMENSIONs/MLEADERs/TABLEs: ") (setq ss (ssget '((0 . "MTEXT,DIMENSION,MULTILEADER,ACAD_TABLE")))) (if ss (progn (setq acount 0) (while (< acount (sslength ss)) (setq ed (ssname ss acount)) (if (or (equal (assoc 0 (entget ed)) '(0 . "MTEXT")) (equal (assoc 0 (entget ed)) '(0 . "DIMENSION")) (equal (assoc 0 (entget ed)) '(0 . "MULTILEADER")) ) ; endor (progn (setq Mytexts (mAssoc 1 (entget ed))) (foreach n Mytexts (entmod (subst (cons 1 (lm:Unformat n T)) (cons 1 n) (entget ed)) ) ) (setq Mytexts (mAssoc 3 (entget ed))) ;; extend mtexts (foreach n Mytexts (entmod (subst (cons 3 (lm:Unformat n T)) (cons 3 n) (entget ed)) ) ) (setq Mytexts (mAssoc 40 (entget ed))) ;; extend mtexts (foreach n Mytexts (entmod (subst (cons 40 25) (cons 40 n) (entget ed)) ) ) ) ; end progn mtext (progn ; tables ((= otyp "ACAD_TABLE")(doUnformatTable (vlax-ename->vla-object ed))) ; AcDbTable ) ) (setq acount (+ acount 1)) ) ; end while ) ; end progn, ss ) ; end if ss )
  1. Load more activity
×
×
  • Create New...