Kay Posted February 25, 2009 Posted February 25, 2009 I am trying to find a lisp routine that will turn dtext into mtext while preserving my tspacefac and tspacetype settings. I need tspacetype to be exact and tspacefac to be 1.029. I love the txt2mtxt command, but it keeps resetting to the autocad defaults which don't work for our purposes. Thanks for any guidance you can give me. Quote
lpseifert Posted February 25, 2009 Posted February 25, 2009 try this (defun c:T2M+ (/ ss obj) (setq ss (ssget '((0 . "*text")))) (vl-cmdf "txt2mtxt" ss "") (setq obj (vlax-ename->vla-object (entlast))) (vlax-put-property obj 'LineSpacingFactor 1.029) (vlax-put-property obj 'LineSpacingStyle 2) (princ) ) Quote
Kay Posted February 26, 2009 Author Posted February 26, 2009 Thank you for your help. The routine completes the text to mtext portion but hangs up when it tries to do the tspacefac. Here is the error message Select objects: 13 Text objects removed, 1 MText object added. Command: ; error: no function definition: VLAX-ENAME->VLA-OBJECT. I tried changing linespacing factor to tspacefac which is the name of the variable, but no luck. I tried enclosing the variable in quotation marks - still no luck. My tiny amount of lisp experience is not serving me well. Do you have other suggestions? Quote
dani Posted February 26, 2009 Posted February 26, 2009 Thank you for your help. The routine completes the text to mtext portion but hangs up when it tries to do the tspacefac. Here is the error message Select objects: 13 Text objects removed, 1 MText object added.Command: ; error: no function definition: VLAX-ENAME->VLA-OBJECT. I tried changing linespacing factor to tspacefac which is the name of the variable, but no luck. I tried enclosing the variable in quotation marks - still no luck. My tiny amount of lisp experience is not serving me well. Do you have other suggestions? < Quote
lpseifert Posted February 26, 2009 Posted February 26, 2009 oops, that's not the first time I've forgotten to add (vl-load-com), it's in my acaddoc.lsp file. Quote
Kay Posted February 27, 2009 Author Posted February 27, 2009 Thank you so very much! It does exactly what I need it to. Kay Quote
Lee Mac Posted February 27, 2009 Posted February 27, 2009 Kay, I would recommend putting a call to (vl-load-com) in your ACADDOC.lsp file (if you have one created), as it makes no odds if it is called multiple times. Quote
Kay Posted February 27, 2009 Author Posted February 27, 2009 I really need to update my programming skills. I am basically a script writer who manages to do some lisp. I think the routine lpsiefert created for me was done using visual lisp. Does having the code (vl-load-com) in acaddoc.lsp work for standard lisp routines or just the visual lisp ones? Rumors say that vba is on the way out. Will that affect lisp? Thank you for your comments. I always find new info in the forums and the blog sites. Our drafting community is addicted to sharing and I am grateful. Quote
lpseifert Posted February 27, 2009 Posted February 27, 2009 From help vl-load-com function (vl-load-com) This function loads the extended AutoLISP functions provided with Visual LISP. The Visual LISP extensions implement ActiveX and AutoCAD reactor support through AutoLISP, and also provide ActiveX utility and data conversion functions, dictionary handling functions, and curve measurement functions. If the extensions are already loaded, vl-load-com does nothing. It is required for most of the Visual Lisp functions- the functions that start with VL. It is not required for the other lisp functions. There has been much discussion about VBA, Vlisp, etc. I think the general consensus is Lisp, Vlisp will be around for a long while, but the future for Acad is .NET (until next week...) Quote
Lee Mac Posted February 27, 2009 Posted February 27, 2009 vl-load-com will enable the Visual LISP functions There is quite a discussion about VBA, see here for more details... Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.