Jump to content

Search the Community

Showing results for tags 'mtext'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • CADTutor
    • News, Announcements & FAQ
    • Feedback
  • AutoCAD
    • AutoCAD Beginners' Area
    • AutoCAD 2D Drafting, Object Properties & Interface
    • AutoCAD Drawing Management & Output
    • AutoCAD 3D Modelling & Rendering
    • AutoCAD Vertical Products
    • AutoCAD LT
    • CAD Management
    • AutoCAD Bugs, Error Messages & Quirks
    • AutoCAD General
    • AutoCAD Blogs
  • AutoCAD Customization
    • The CUI, Hatches, Linetypes, Scripts & Macros
    • AutoLISP, Visual LISP & DCL
    • .NET, ObjectARX & VBA
    • Application Beta Testing
    • Application Archive
  • Other Autodesk Products
    • Autodesk 3ds Max
    • Autodesk Revit
    • Autodesk Inventor
    • Autodesk Software General
  • Other CAD Products
    • BricsCAD
    • SketchUp
    • Rhino
    • SolidWorks
    • MicroStation
    • Design Software
    • Catch All
  • Resources
    • Tutorials & Tips'n'Tricks
    • AutoCAD Museum
    • Blocks, Images, Models & Materials
    • Useful Links
  • Community
    • Introduce Yourself
    • Showcase
    • Work In Progress
    • Jobs & Training
    • Chat
    • Competitions

Categories

  • Programs and Scripts
  • 2D AutoCAD Blocks
  • 3D AutoCAD Blocks
  • Images
    • Backgrounds

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

  1. I am trying to write a routine to "simulate" MText command in lisp using predefined Text Height (2.0mm in this case for 1:1 scale) and text Style. I started with this code: (defun C:test (/ Height Style) (setvar "cmdecho" 1) (setq Height (* (getvar "DIMSCALE") 2.0 )) (setq Style "My_Style") (command "._MTEXT" pause "H" Height "S" Style pause) (princ) ) The text style seems to work but the Text Height doesn't change. Could anyone help please?
  2. As posted over at theSwamp, I thought I'd post it here for you guys also CopyText.lsp The program will allow a user to copy the text content from a source object to a selection of destination objects or swap the text content between two objects. The user may select from Text, MText, Attribute, or Multileader objects. Upon choosing 'Settings' the user can alter whether source object formatting should be retained upon copying/swapping to/with objects which permit the use of such formatting. Ideas/criticism/feedback are, as always, welcome Enjoy! Lee CopySwapTextV1-6.lsp
  3. Hi, I found OneMtext.lsp and Text2MTextV2-0.lsp which are both very useful for my needs, but I wish that the contents could be set to sort by alphabetical order. Can anybody help me or point me in the direction of how to modify the lisp so I can have this result? Thank you OneMtext.lsp Text2MTextV2-0.lsp
  4. Hi, I have thousands of drawings. They are all similar to This.dwg one. My final goal is to merge them into one kml file.. This would take months to do it one by one. If I have the right lisp to automate this in one drawing, then I can use script to run that lisp over other drawings. To reduce the result file size, I decided to keep only the green polyline in the center of the drawing(which matters the most): (defun C:foo ( / varf ins str) ; Selecting Polyline (setq varf (list '(-4 . "<OR") '(0 . "LWPOLYLINE") '(-4 . "<AND") '(0 . "POLYLINE") '(-4 . "<NOT") '(-4 . "&") '(70 . 80) '(-4 . "NOT>") '(-4 . "AND>") '(-4 . "OR>") (cons 62 3) ) ) (sssetfirst nil (ssget "_X" varf)) ; Inverting selection (if (ssget "_I") (progn; then (sssetfirst nil) (command "_.select" "_all" "_remove" (ssget "_p") "") (sssetfirst nil (ssget "_p")) ) (prompt "\nRequires pre-selection."); else ) ; Delete Selection (command "_.erase") ; And This is how I insert Drawing Name (and (or (> (getvar 'DWGTITLED) 0) (alert "Save the drawing then try again!") ) (setq ins (getpoint "\nChoose Insertion Point: ")) (setq str (entmakex (list '(0 . "MTEXT") '(100 . "AcDbEntity") '(100 . "AcDbMText") (cons 10 (trans ins 1 0)) (cons 40 0.8);Text height (cons 7 "STANDARD");Text style '(1 . "") ) ) ) (vla-put-textstring (vlax-ename->vla-object str) "%<\\AcVar Filename \\f \"%tc4%fn2\">%}" ) ) ) Now these are what I'm looking for: - I don't want to pick the insertion point manually, need to insert field inside or over selected polyline - after inserting field text, I want to explode the text. to maintain drawing name after merge. - adding a condition to check the process, if anything goes wrong, insert that drawing name at (0,0,0). this way I can track that file to check it manually. Thank you in Advanced.
  5. I have searched all over for the answer to this but with no success. When I am in my VP and double-click the MTEXT it stays horizontal. Then when I type any letter or spacebar it rotates to East. My VP is rotated with North pointing NW. I have tried MTEXTFIXED I have tried MTEXTFIXED . When I try to change to OldEditor it says that it cannot acknowledge the font, which is Hand. Hand is our special type of font that we use. How on earth do I get the text to stay horizontal while editing? I can't remember her name Lynn or something, said that its frustrating standing on your head to edit text. As always, any and all help/comments are welcome. Thank you. Miller
  6. <Update:> The issue I encountered was a drawing converted from VISIO to Autocad. If I convert the fonts to ARIAL beforehand, I can use STRIPMTEXT if not I have to use one of the methods below. I have several drawings filled with MText objects. If I select them all and attempt to change via the Properties dialog a new height is then displayed but the text height does not change. If I double click on one of the objects the Text Formatting bar appears and a different text height is shown there. I thought that Lee's STRIPMTEXT would resolve this but running it leaves me with the same issue afterwards. This may be the wrong forum but if anyone knows of a routing to resolve this I would appreciate being pointed to it please.. I have hundreds of text objects to change. Please advise. (feel free to move this thread if it shouldn't be here)
  7. I found valuable lisp for auto creation block. I want to improve this lisp to following requirement * block selected object individually, not in one block thanks AUTO-BLOCK.LSP
  8. Hi, I would like to know some help. 01 - Is there a possibility in this Lee Mac lisp, Automatically Label Attributes, that it can be changed so that every time I open a different file it asks me about the increment, prefix and suffix settings? Because in the current way it always loads the pre-configuration that is already in lisp. I don't want to have to edit the lisp to configure the numbers for each file. Note: I use attributed blocks and multileader blocks. 02 - I also use the Lisp Incremental Numbering Suite, I would like to know if the option for multileaders can be added. As the current options are only for text, mtext and blocks. For my use multileaders are more interesting. Because the use of block with attributes will have to be manually making the leader lines to indicate their positions and references after their insertion and when you have many blocks end up wasting valuable time. I would like to know if it is possible to make any of these changes, since lisps have many lines. Note: Sorry for the google translation. #NumIncV3-9.lsp AutoLabelAttributesV1-4.lsp
  9. Hi erverybody, when manipulating "MTEXT" objects, I can not get some information about this kind of object, while they are shown in "PROPERTIES" commands window. Should any one know where they are? One of the hidden properties of "MTEXT" is shown in PROPERTIES dialog, under "Text" region, with the lable "Columns". I appreciate greatly any help or clue guiding me to the solution.
  10. Hi all, how is it possible to get and put alignment of a MTEXT object via AutoLISP? I appreciate any help.
  11. I want to add text to an existing MTEXT, but the utility I have used doesn't support what I am trying to do. I can select it fine, but it doesn't come out right. This is the old format: This is the new format (this is what is desired): This is the old text in properties: This is the new text in properties (this is what is desired): I tried to use this code to call a MRWA.lsp (but the format doesn't work right): (setq mylisp "MRWA.lsp") ; Set the lisp routine name (setq mypatlsp (strcat mypath mylisp)) ; Set the path/file of the lisp routine name (load mypatlsp) ; Load the lisp routine (replace "INSPECTION AND WELDING." "INSPECTION AND WELDING. NORTH IS BASED ON PLANT NOTRTH PER DWG 123-KD-401.") ; Replace MTEXT string: old/new Using this lisp (MRWA.lsp): (defun replace (old new / string_subst dxf idx o ss) (defun string_subst (str old new / idx) (setq idx 0) (while (setq idx (vl-string-search old str idx)) (setq str (vl-string-subst new old str idx)) (setq idx (+ idx (strlen new))) ) str ) (if (setq ss (ssget "_X" (list '(0 . "MTEXT") (cons 410 (getvar 'ctab))))) (repeat (setq idx (sslength ss)) (setq o (vlax-ename->vla-object (ssname ss (setq idx (1- idx))))) (if (vl-string-search old (vla-get-textstring o)) (vla-put-textstring o (string_subst (vla-get-textstring o) old new)) ) ) ) (princ) ) Am I just a few characters off to get this to work right? Or do I need to take another path to make this work? Greg
  12. Hi there! I am exploring lisp and dcl at the same time. I have this DCL as shown below. Whenever the command is done and doing the same command again, values reset (pic2). I want the values to remain whenever I used the dcl again after I press "Ok" to edit particular inputs instead of typing the whole data again. How could I possibly do that? Here is the dcl code I used. CHECKING : dialog { label = "CHECKING"; : row { :boxed_row { label = "PARAMETERS"; : edit_box { key = "a"; label = "Wind Pressure (kPa)"; edit_width = 8;} : edit_box {key = "b"; label = "Tributary Width (mm)"; edit_width = 8;} : edit_box {key = "c"; label = "Unsupported Length (mm)"; edit_width = 8;} } } : row { :boxed_column { label = "SECTION PROPERTIES (ALUMINUM)"; : edit_box { key = "d"; label = "Moment of Inertia (mm^4)"; edit_width = 8;} : edit_box {key = "e"; label = "Area (mm^2)"; edit_width = 8;} : edit_box {key = "f"; label = "Extreme Fiber (mm)"; edit_width = 8;} : edit_box {key = "g"; label = "Allowable Stress (MPa)"; edit_width = 8;} } :boxed_column { label = "SECTION PROPERTIES (STEEL)"; : edit_box { key = "h"; label = "Moment of Inertia (mm^4)"; edit_width = 8;} : edit_box {key = "i"; label = "Area (mm^2)"; edit_width = 8;} : edit_box {key = "j"; label = "Extreme Fiber (mm)"; edit_width = 8;} : edit_box {key = "k"; label = "Allowable Stress (MPa)"; edit_width = 8;} } } : button { key = "accept"; label = " &OK "; is_default = true; mnemonic = "S"; } : button { key = "cancel"; label = " Cancel "; is_default = false; is_cancel = true; } } and here is the lisp code: (defun saveVars() (setq wp(distof(get_tile "a"))) (setq tw(distof(get_tile "b"))) (setq L(distof(get_tile "c"))) (setq Im(distof(get_tile "d"))) (setq Am(distof(get_tile "e"))) (setq cm(distof(get_tile "f"))) (setq Fbm(distof(get_tile "g"))) (setq Is(distof(get_tile "h"))) (setq As(distof(get_tile "i"))) (setq cs(distof(get_tile "j"))) (setq Fbs(distof(get_tile "k"))) ) (defun C:CC() (if(not(setq dcl_id (load_dialog "CHECKING.dcl"))) (progn (alert "The DCL file could not be loaded!") (exit) ) (progn (if (not(new_dialog "CHECKING" dcl_id)) (progn (alert "CHECKING.DCL file could not be loaded!") (exit) ) (progn (action_tile "accept" "(saveVars)(done_dialog 2)") (action_tile "cancel" "(done_dialog 1)") (setq ddiag(start_dialog)) (unload_dialog dcl_id) (if(= ddiag 1) (princ "\n END") ) (if(= ddiag 2) (progn (setq IT(+ Im (* 2.87 Is))) (setq moment(/ (* wp tw L L) 8000)) (setq stress(/ (* moment cm) Im)) (setq stressratio(/ stress Fbm)) (setq deflection(/ (* 5 wp tw L L L L) (* 384000 69600 IT))) (setq allowdeflection(/ L 175)) (setq defratio(/ deflection allowdeflection)) (setq pt1 (getpoint)) (setq pt2 (getpoint)) (command "_mtext" pt1 pt2 "\n Actual Bending Stress =" (rtos stress 2 2) "\n Allowable Bending Stress =" (rtos Fbm 2 2) "\n Stress Ratio =" (rtos stressratio 2 2) "\n Actual Deflection =" (rtos deflection 2 2) "\n Allowable Deflection =" (rtos allowdeflection 2 2) "\n Deflection Ratio =" (rtos defratio 2 2) "" ) ) ) ) ) ) ) ) One more thing. About the mtext output. The output is this. Numerical results always appear on the next line. and I want the result to be like this with units as text (MPa, mm, etc) Does someone has a thing about this? Thank you in advance. :)
  13. I've only been learning LISPing for a few weeks so C&C's are most welcome. LINK TO VIDEO: One of my most used LISPs is the LeaderToMleader.LSP. Found here. It was last updated many moons ago, so I decided to try learn and modify it to suit. Many thanks to the original author Lyle Hardin. I just need some guidance on how to get UCS working with it. EDIT. Using the TRANS fn. It works okay. Took a bit of tweaking but I got it. Please test. Here's a list of things I've changed at the top of the code: Main ones are: Multiple Selection - User can now select the LEADER and MTEXT together and no longer individually resulting in a much faster conversion. Strip text - Of formatting option - LM:UnFormat fn written by LeeMac. Annotation support - Program simply matches the (entget) object to that of the (entlast) object. With the help of AT:isAnnotative written by Alan J. Thompson. Case conversion - Built in fns using (load "TcaseSup.lsp") - OPTIONS: Titlecase Lowercase Uppercase Sentencecase toGglecase Keepcase Verts - Leader_To_Multileader now supports 2 or 3 points. (Old method was only 2). It uses the 1st, 2nd (if applicable) and last verts of the LEADER. The 4th vert or more, will get removed. Text Rotation - MTEXT rotation is now preserved. Undo levels - As opposed to one command at a time. PS. How easy would it be to calculate the distance between the start point of the LEADER point and pos of the MTEXT and then for each of the closest pairs make them an MULTILEADER. That would be cool. ;;; CADALYST 08/08 www.cadalyst.com/code ; Tip 2305: Leader_To_Multileader.lsp LEADER to Multileader (c) 2008 Lyle Hardin ; Pick an old style LEADER and text to create a new MLEADER entity and erase the old LEADER and text. ; March/2008 ;;; EDITED ON 15/04/2017 BY 3DWANNAB ; Reason for creating this, was to learn and create a LISP that I use on a regular basis. ; Commandline Syntax: Type "Leader_To_Multileader" OR "LTM" to run Program. ; ; ADDED - Case Conversion. ; OPTIONS: ; Titlecase Lowercase Uppercase Sentencecase toGglecase Keepcase. ; ; ADDED - Annotation support. Program simply matches the (entget) object to that of the (entlast) object. With the help of AT:isAnnotative written by Alan J. Thompson. ; ADDED - Custom LM:ssget fn written by LeeMac. ; ADDED - Multiple Selection. User can now select the LEADER and MTEXT together and no longer individually resulting in a much faster conversion. ; ADDED - Round off points - To nearest round number. That been 1. round fn written by Doug Broad. Additional credits to Joe Burke, Peter Toby. ; ADDED - Strip MTEXT - Of formatting option - LM:UnFormat fn written by LeeMac. ; ADDED - Text Rotation - MTEXT rotation is now preserved. ; ADDED - Undo levels - As opposed to one command at a time. ; ADDED - Picking of existing MLEADER to use as new style. ; RMB-SPACEBAR-ENTER to skip this step and use the current MLEADER style ; SETTINGS TRANSLATED IF PICKED: ; (vla-put-Layer newmleader existingMlLayer) ; (vla-put-ScaleFactor newmleader existingMlScale) ; (vla-put-StyleName newmleader existingMlStyle) ; (vla-put-TextWidth newmleader existingMlWidth) ; ; SETTINGS TRANSLATED IF NOT: ; (vla-put-Layer newmleader existingTxtLayer) ; (vla-put-TextRotation newmleader existingTxtRot) ; (vla-put-TextWidth newmleader existingTxtWidth) ; ; CHG - Changed to 'vla-get-TextString' as more robust. ; CHG - Moved new MLEADER to TEXT Layer as opposed to existing LEADER. ; CHG - Picking never fails, prompts user to keep picking until successful. LM:SelectIf fn written by LeeMac. ; FIX - ACADs built in functions to convert ill-formatted MTEXT creates a bug in the string result. LM:StringSubst by LeeMac. ; FIX - End position of MLEADER. ; FIX - Z coordinate to 0, resulting in no fuzzy text. ; FIX - Forces the MLEADER to be created from the 'LEADER arrowHead first' resulting in correct results all the time. ; FIX - Vertices, Leader_To_Multileader now supports 2 or 3 points. ; If 2 (Straight) it straightens the MLEADER up to the Y axis of the LEADER point for those LEADERS at an angle. ; If 3 (Dog Legged) it recreates those as they originally were. ; If <3 (Multiple) it recreates the 1st, 2nd & end point point of the original LEADER. The 4th vert or more, will get removed. ; NOTE: Not really any need for more than 3 points on an MLEADER, I don't think. ; ;;; KNOWN QUIRKS, BUGS ; Works in different UCSs, if you are fixing MTEXT & LEADERS which are upside down then the new MLEADER might be a little wacky. ; ;;; FUTURE ADDITIONS ; Convert based on how close the LEADER and MTEXT are away from each other. To enable multiple selection. ; ;;; COMMENT OUT ; First off, Big THANKS to Lyle Hardin for the original code. ; Big THANKS to LeeMac for the functions he has put up on his website. ; Finally getting the basics of this LISP'ing lark thanks to guys like him. ; Lots of other places on forums and Users too. To many users to mention. ; Let me know your thoughts on this Program or if you want to drop a Thank you. ; e. stephensherry147@yahoo.co.uk (defun c:LTM nil (c:Leader_To_Multileader)) (defun c:Leader_To_Multileader ( / *error* cmde entLeader entLeaderName entTxt entTxtName entTxtVlaObj existingMlScale existingMlStyle existingMlvlaObj existingMlWidth existingTxtLayer existingTxtRot existingTxtString existingTxtWidth ldxf10_1 ldxf10_2 ldxf10_last lstleaderlen lstleaderpts os ss1 ss2 ) (defun *error* (errmsg) (and acDoc (vla-EndUndoMark acDoc)) (and errmsg (not (wcmatch (strcase errmsg) "*CANCEL*,*EXIT*")) (princ (strcat "\n<< Error: " errmsg " >>")) ) (setvar 'cmdecho cmde) (setvar 'osmode os) ) (setq acDoc (vla-get-ActiveDocument (vlax-get-acad-object))) (or (vla-EndUndoMark acDoc) (vla-StartUndoMark acDoc)) (setq cmde (getvar "cmdecho")) (setq os (getvar "osmode")) (setvar 'cmdecho 0) (setvar 'osmode 0) (if (setq ss1 (car (LM:SelectIf (strcat "\nSelect an existing MULTILEADER to use as the new style\nor RMB-SPACEBAR-ENTER to use current: '" (getvar "cmleaderstyle") "'." ) (lambda ( x ) (eq "MULTILEADER" (cdr (assoc 0 (entget (car x)))))) entsel nil ) ) ) (progn (setq existingMlvlaObj (vlax-ename->vla-object ss1) existingMlLayer (vla-get-Layer existingMlvlaObj) existingMlStyle (vla-get-StyleName existingMlvlaObj) existingMlWidth (vla-get-TextWidth existingMlvlaObj) ) (if (/= T (AT:isAnnotative ss1)) (setq existingMlScale (vla-get-ScaleFactor existingMlvlaObj)) ) (princ (strcat "\nStyle to use: ' " existingMlStyle " '")) ) ) (initget "Titlecase Lowercase Uppercase Sentencecase toGglecase Keepcase") (setq ansCase (cond ( (getkword (strcat "\nChoose Text Case : [Title case/Lower case/Upper case/Sentence case/toGgle case/Keep case] <" (setq ansCase (cond ( ansCase ) ( "Keepcase" )) ) ">: " ) ) ) ( ansCase ) ) ) (initget "Keepformatting Removeformatting") (setq ansFromatting (cond ( (getkword (strcat "\nChoose Formatting : [Keep formatting/Remove formatting] <" (setq ansFromatting (cond ( ansFromatting ) ( "Keepformatting" )) ) ">: " ) ) ) ( ansFromatting ) ) ) (while (setq ss2 (LM:ssget "\nSelect 1 LEADER & 1 MTEXT: " (list "_:L" (append '( (-4 . "<OR") (0 . "MTEXT") (0 . "LEADER") (-4 . "OR>") ) ) ) ) ) (if (/= (sslength ss2) 2) (progn (alert "Select only 1 MTEXT and 1 LEADER.") (princ " >>> 'LTM' failed selection, try again ...")(princ) ) (progn (if (= (cdr (assoc 0 (entget (ssname ss2 0)))) "LEADER") (setq entLeader (entget (ssname ss2 0)) entTxt (entget (ssname ss2 1)) ) (setq entLeader (entget (ssname ss2 1)) entTxt (entget (ssname ss2 0)) ) ) (if (or (and (eq (dxf 0 entLeader) "LEADER") (eq (dxf 0 entTxt) "LEADER")) (and (eq (dxf 0 entLeader) "MTEXT") (eq (dxf 0 entTxt) "MTEXT"))) (progn (alert "Please, check your Selection !\n\nSelect only 1 MTEXT and 1 LEADER.") (princ " >>> 'LTM' failed selection, try again ...")(princ) ) (progn (setq entLeaderName (dxf -1 entLeader) entTxtName (dxf -1 entTxt) existingTxtLayer (dxf 8 entTxt) entTxtVlaObj (vlax-ename->vla-object entTxtName) existingTxtString (vla-get-TextString entTxtVlaObj) existingTxtWidth (dxf 41 entTxt) existingTxtRot (dxf 50 entTxt) lstleaderpts (vl-remove-if-not '(lambda (p) (eq (car p) 10)) entLeader ) lstleaderlen (length lstleaderpts) ldxf10_1 (cdr (car lstleaderpts)) ldxf10_1 (mapcar '(lambda (x) (round x 1) ) ldxf10_1 ) ldxf10_2 (if (>= lstleaderlen 3) (cdr (nth (- lstleaderlen 2) lstleaderpts)) ) ldxf10_2 (mapcar '(lambda (x) (round x 1) ) ldxf10_2 ) ldxf10_last (if (< lstleaderlen 3) (list (car (dxf 10 entTxt)) (cadr ldxf10_1) (caDDr (dxf 10 entTxt))) (list (car (dxf 10 entTxt)) (cadr ldxf10_2) (caDDr (dxf 10 entTxt))) ; (list (car (dxf 10 entTxt)) (cadr ldxf10_1) 0) ; (list (car (dxf 10 entTxt)) (cadr ldxf10_2) 0) ) ldxf10_last (mapcar '(lambda (x) (round x 1) ) ldxf10_last ) ) (cond ((= "Keepformatting" ansFromatting) ) ((= "Removeformatting" ansFromatting) (setq existingTxtString (LM:UnFormat existingTxtString nil)) ) ) (progn (if (>= lstleaderlen 3) (progn (command "._MLEADER" "_L" "_H" "_O" "_M" 3 "_A" "_N" "_X" "_non" (trans ldxf10_1 0 1) "_non" (trans ldxf10_2 0 1) "_non" (trans ldxf10_last 0 1) "") ) (progn (command "._MLEADER" "_L" "_H" "_O" "_M" 2 "_A" "_N" "_X" "_non" (trans ldxf10_1 0 1) "_non" (trans ldxf10_last 0 1) "") ) ) (setq newmleader (vlax-ename->vla-object (entlast))) (cond ((= "Titlecase" ansCase) (setq existingTxtString (acet-tcase-change-string existingTxtString "TITLE")) ) ((= "Lowercase" ansCase) (setq existingTxtString (acet-tcase-change-string existingTxtString "LOWER")) ) ((= "Uppercase" ansCase) (setq existingTxtString (acet-tcase-change-string existingTxtString "UPPER")) ) ((= "Sentencecase" ansCase) (setq existingTxtString (acet-tcase-change-string existingTxtString "SENTENCE")) ) ((= "toGglecase" ansCase) (setq existingTxtString (acet-tcase-change-string existingTxtString "TOGGLE")) ) ((= "Keepcase" ansCase) (setq existingTxtString existingTxtString) ) ) (setq existingTxtString (LM:StringSubst "\\\H" "\\\h" existingTxtString)) (vla-put-TextString newmleader existingTxtString) (vla-put-TextRotation newmleader existingTxtRot) (if ss1 (progn (command "._MATCHPROP" ss1 (entlast) "") (vla-put-TextWidth newmleader existingMlWidth) ; (vla-put-StyleName newmleader existingMlStyle) ; (vla-put-Layer newmleader existingMlLayer) (if (/= T (AT:isAnnotative ss1)) (vla-put-ScaleFactor newmleader existingMlScale) ) ) (progn (vla-put-Layer newmleader existingTxtLayer) (if (/= existingTxtWidth 0) (vla-put-TextWidth newmleader existingTxtWidth) ) ) ) (command "_.erase" entTxtName "") (command "_.erase" entLeaderName "") (command "_.move" (entlast) "" '(0 0 1e99) "" "_.move" "_p" "" '(0 0 -1e99) "") (princ " >>> 'LTM' has done the business ...")(princ) ) ) ) ) ) ) (*error* nil) (princ) ) ;; Unknown Autor (defun dxf (code elist) (cdr (assoc code elist)) ) ;; Doug Broad ;; additional credits Joe Burke, Peter Toby (defun round (value to) (setq to (abs to)) (* to (fix (/ ((if (minusp value) - +) value (* to 0.5)) to))) ) ;;--------------------=={ String Subst }==--------------------;; ;; ;; ;; Substitutes a string for all occurrences of another ;; ;; string within a string. ;; ;;------------------------------------------------------------;; ;; Author: Lee Mac, Copyright © 2011 - www.lee-mac.com ;; ;;------------------------------------------------------------;; ;; Arguments: ;; ;; new - string to be substituted for 'old' ;; ;; old - string to be replaced ;; ;; str - the string to be searched ;; ;;------------------------------------------------------------;; ;; Returns: String with 'old' replaced with 'new' ;; ;;------------------------------------------------------------;; (defun LM:StringSubst ( new old str / inc len ) (setq len (strlen new) inc 0 ) (while (setq inc (vl-string-search old str inc)) (setq str (vl-string-subst new old str inc) inc (+ inc len) ) ) str ) ;; ssget - Lee Mac ;; A wrapper for the ssget function to permit the use of a custom selection prompt ;; ;; Arguments: ;; msg - selection prompt ;; params - list of ssget arguments (defun LM:ssget ( msg params / sel ) (princ msg) (setvar 'nomutt 1) (setq sel (vl-catch-all-apply 'ssget params)) (setvar 'nomutt 0) (if (and sel (not (vl-catch-all-error-p sel))) sel ) ) ;;---------------------=={ Select if }==----------------------;; ;; ;; ;; Provides continuous selection prompts until either a ;; ;; predicate function is validated or a keyword is supplied. ;; ;;------------------------------------------------------------;; ;; Author: Lee Mac, Copyright © 2011 - www.lee-mac.com ;; ;;------------------------------------------------------------;; ;; Arguments: ;; ;; msg - prompt string ;; ;; pred - optional predicate function [selection list arg] ;; ;; func - selection function to invoke ;; ;; keyw - optional initget argument list ;; ;;------------------------------------------------------------;; ;; Returns: Entity selection list, keyword, or nil ;; ;;------------------------------------------------------------;; (defun LM:SelectIf ( msg pred func keyw / sel ) (setq pred (eval pred)) (while (progn (setvar 'ERRNO 0) (if keyw (apply 'initget keyw)) (setq sel (func msg)) (cond ( (= 7 (getvar 'ERRNO)) (princ "\nMissed, Try again.") ) ( (eq 'STR (type sel)) nil ) ( (vl-consp sel) (if (and pred (not (pred sel))) (princ "\nInvalid Object Selected.") ) ) ) ) ) sel ) ;;-------------------=={ 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 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 ) ) ) ) ;; https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/set-annotative-using-lisp-or-vlisp/m-p/3266716#M301077 ;; Check if entity is annotative and which accounts for objects that were once annotative but are no longer. ;; ename - ename to check (returns T if annotative) ;; Alan J. Thompson (defun AT:isAnnotative (ename / check) (and (setq check (cdr (assoc 360 (entget ename)))) (setq check (dictsearch check "AcDbContextDataManager")) (setq check (dictsearch (cdr (assoc -1 check)) "AcDb_AnnotationScales")) (assoc 350 check) ) ) ;; https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/set-annotative-using-lisp-or-vlisp/m-p/3266684#M301075 ;; By User pbejse ;; (IsAnno-p ;; (setq itm (vlax-ename->vla-object (Car (entsel)))) ;; ) (defun IsAnno-p (ent / exd ano) (vl-load-com) (and (eq (vla-get-HasExtensionDictionary ent) :vlax-true) (setq exd (vla-GetExtensionDictionary ent) exd (vla-item exd "AcDbContextDataManager") ano (vla-item exd "ACDB_ANNOTATIONSCALES") ) (not (zerop (vla-get-Count ano))) ) ) (load "TcaseSup.lsp") (vl-load-com) ;; End (princ (strcat "\n:: Leader_To_Multileader.lsp edited on " (menucmd "m=$(edtime,0,DD-MO-yyyy)") " by 3dwannab (stephensherry147@yahoo.co.uk) loaded ::" "\n:: Type \"Leader_To_Multileader\" OR \"LTM\" to run Program ::" ) ) (princ) MLEADER Test Drawing.dwg
  14. Hi, Please see attached the Fuzzy Text Problem.dwg Fuzzy Text Problem.dwg The bottom of the two text (MTEXT) has a Z value of 0. When exploded to TEXT it has a value of -0.00000454. It appears FUZZY in AutoCAD for this reason. 2d wireframe is set DVIEW is ok also. FLATTEN or my routine below for putting objects to Z won't work either. (defun C:FX_Flatten_To_Z () (command "_.UCS" "") (command "_.move" "_all" "" '(0 0 1e99) "" "_.move" "_p" "" '(0 0 -1e99) "") (princ) ) Any insight to this problem would be great, thanks.
  15. Howdy howdy, Any time I would like to create an EXACT height over the x2.5 that can be selected in the MTEXT Editor dropdown, it gives me the minor annoyance of having to do the process twice. The first time I input my line spacing (With 'exact' selected), apply, and close the dialogue box, the text gets all scrunched up. It will stay like this until I go BACK into the line space dialogue box and input the amount I want again. Attached are pictures of the described process. Thoughts? [attachment=48613:name] [attachment=48614:name] [attachment=48615:name] [attachment=48616:name] [attachment=48617:name] *placed in code wrap to save space due to the amount of pictures
  16. Hi all, whenever I enter the MTEXT editing function, then type a letter on any given line of text, that line rotates to the world UCS. This makes typing almost impossible, as the overlapping text can't be read clearly. Any suggestions? I'm using AutoCAD 2013 for Mac and looking at my drawing with a rotated UCS.
  17. Hello everybody, This is my first post on CADTutor. I've been reading alot here even before I became a member, but it is time for me to join the community with a question since I cannot find the exact answer to mine. Question: Is it possible to sum numbers in Mtext fields created with lisps? AT.LSP OT.LSP I edited them to suit my needs with prefix and suffix and decimal precision (they are in the core the same, originally made by JTB), one is displaying area of selected polyline (AT.lsp) and the other perimeter/length (OT.lsp). I would like to preserve possibility of field updating so when polyline/area is changed I just enter regenall. I copied Mtext fields maually to "oldstyletable" made from lines and mtext, mtext fields. See attached dwg for example. I've seen this thread: http://www.cadtutor.net/forum/showthread.php?43699-Sum-Text-Strings-to-Text-Field... I tried all the lisps but none are applicable to my problem. I get only #### even after regen (I think it's maybe because of prefix and suffix, but don't know). I've managed to work only with text and then my updating Mtext fields are, for sure, gone. Please advise. TEST1.dwg
  18. Hi all, I would like to know how I can replace a MTEXT (not TEXT) of an attribute by selecting a TEXT/MTEXT. Thank you so much !
  19. HFBandit

    MTEXT "squashing" on move

    Hi I'm running LT 2017 and have encountered an issue when moving MTEXT. As I move the text, the transparent "placeholder" text is squashing vertically. This makes it hard to know where the end position of the text will actually be. Hopefully the attached image will clarify what I mean.
  20. Hello. I want to change line space factor for all the mtext objects in a hole bunch of drawings by script. I found this lisp and it works fine but only by manually selecting the mtext objects. (setq vla_mtext (vlax-ename->vla-object (setq mymtext (car (entsel))))) (vla-put-LineSpacingFactor vla_mtext 0.5) Can this lisp be changed so it changes all mtext objects found in the drawing, or is there another way? Thanks
  21. We are getting some serious issues with plotting in Autocad. In one of our drawings, someone dimensioned the diameter of a circle. Here is where things get weird: It showed up in Paper space. It showed up when it was plotted to our Ricoh printer. When it was plotted to our HP Designjet the MText was gone. No dimension line, no text, nothing. The weirder thing is this behavior is inconsistent. I've plotted it on two separate computers and it shows up just fine. But sometimes it won't show up at all. Has any one else experienced this issue or a similar issue? Or does anyone know any reason that MText will sometimes not show up when plotted to a certain printer?
  22. I've attached a sample of some text we got in a CAD drawing from one of our clients. For whatever reason, all the standard text is showing up as vivaldi text for me. A coworker said he was able to open up the drawing and everything was showing up fine?? If you look in the contents under properties there's a slash pxqc prefix that I've never seen before. It's like Vivaldi was set up an override to the standard text style. So even if I change the text style to something else, the Vivaldi text persists. So the only way I see to change it back to something different is to open every mtext in the drawing and change the override text style to something different. That works but.... if there's some way to remove the text overrides all at once it would save me alot of time. Has anyone seen this before? Thank you! -ChriS ScrewyTextSample.dwg
  23. I'm about to receive a bunch of borehole data for a bigger project with x,y coordinates in state plane for each hole and I believe it will be sent as an Excel file. I'd like to add a center-justified text consisting of the borehole name at the x,y coordinate where it should go so I can quickly check out the location of a hole and then look up its other properties by name in the Excel sheet. So far, I'm thinking about concatenating the cells and adding spaces in a separate column in excel so that for each hole I have something like: text j mc 0 x-coordinate,y-coordinate BH120 in a single cell. That way I can copy and paste that line at the CAD command prompt and skip a ton of key strokes going through the text options. I've done a similar workaround, inspired by someone here on the forums, when working with line segments where clients have sent me endpoints in Excel format. It's been great because it's transparent enough that I can forward my spreadsheet on to any one of my coworkers and have them duplicate the process without having to worry about a couple of people in my work group who only have LT and can't use LISPs (I think?). The difference is that while you can exit a line command by putting a space after that entry above, I think the only way to end the text command might be by pressing enter twice and I don't know if there's a way to just concatenate a couple of enters at the end of a line like I can a couple of spaces. The question is, is there a quick cheat that would let me do everything by copying and pasting multiple lines formatted as above all at once from excel without having to press enter after each hole? Is there an arraypath type command that's more well-suited to this instead, since I do have x,y coordinates?
  24. Hi! I have a text box containing mText with fields. I have drawn up the multiline box I want to have the text in, problem is that when the fields change the text gets longer and therefor makes the box bigger leading to my text no longer staying within the size its supposed to. Is there a way to fit mtext? Force it to stay within the set border and if more rows than fit are added, shrink the text? Thank you!
×
×
  • Create New...