Jump to content

Recommended Posts

Posted

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.

Posted

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)
 )

Posted

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?

Posted

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?

<
Posted

oops, that's not the first time I've forgotten to add (vl-load-com), it's in my acaddoc.lsp file.

Posted

Thank you so very much! It does exactly what I need it to.

Kay

Posted

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. :)

Posted

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. :D:):D

Posted

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...)

Posted

vl-load-com will enable the Visual LISP functions :)

 

There is quite a discussion about VBA, see here for more details... :)

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...