blueshake Posted October 3, 2010 Share Posted October 3, 2010 hi,all for the below codes. (if (= (tblsearch "style" "standard") nil) (command "_.-style" "standard" "Arial" 3.5 0.666 0.0 "" "" "") (command "_.-style" "standard" "Arial" 3.5 0.666 0.0 "" "" "") ) if I type them in the command line.everything goes well but when I save them in a lsp file and then make cad automatic load for the file.the help file always jump out. I found that in output log ,the command "_help" is executed .I was so confused by this.can someone help me?thanks. Quote Link to comment Share on other sites More sharing options...
The Buzzard Posted October 3, 2010 Share Posted October 3, 2010 (edited) hi,allfor the below codes. (if (= (tblsearch "style" "standard") nil) (command "_.-style" "standard" "Arial" 3.5 0.666 0.0 "" "" "") (command "_.-style" "standard" "Arial" 3.5 0.666 0.0 "" "" "") ) if I type them in the command line.everything goes well but when I save them in a lsp file and then make cad automatic load for the file.the help file always jump out. I found that in output log ,the command "_help" is executed .I was so confused by this.can someone help me?thanks. You are showing two styles on the same command. Standard is already in your drawing and is the name of the installed ACAD font and should not be used as a name for another style. Call them anything else, Just don't call them late to dinner. And Arial is a true type font (TTF) which does not require the last "" in the command. You really should not specify a height in your font style or all text that is arial will be limited to it. You can set that when you write something requiring text, But thats up to you. Your choice. Here is the format for TTF type fonts. (if (null (tblsearch "style" "MyFont1")) (command "._STYLE" "MyFont1" "arial.TTF" "0.0" "1.0" "0.0" "_N" "_N" )) Here is the format for SHX type fonts. (if (null (tblsearch "style" "MyFont2")) (command "._STYLE" "MyFont2" "romans.shx" "0.0" "1.0" "0.0" "_N" "_N" "")) Take note to the small difference between the two of them. Edited October 3, 2010 by The Buzzard Quote Link to comment Share on other sites More sharing options...
blueshake Posted October 3, 2010 Author Share Posted October 3, 2010 thank you. dig into more.I found for Chinese font.it should be so. (defun build_style(/) (if (= (tblsearch "style" "标准") nil) (command "_.style" "标准" "楷体_GB2312" "0.0" "0.666" "0.0" "_N" "_N") (command "_.style" "标准" "楷体_GB2312" "0.0" "0.666" "0.0" "_N" "_N") ) ) the ".TTF" should not be add.or will give searching font error. Quote Link to comment Share on other sites More sharing options...
The Buzzard Posted October 3, 2010 Share Posted October 3, 2010 thank you.dig into more.I found for Chinese font.it should be so. (defun build_style(/) (if (= (tblsearch "style" "标准") nil) (command "_.style" "标准" "楷体_GB2312" "0.0" "0.666" "0.0" "_N" "_N") (command "_.style" "标准" "楷体_GB2312" "0.0" "0.666" "0.0" "_N" "_N") ) ) the ".TTF" should not be add.or will give searching font error. Thats a different thing alltogether. I am not sure how that would work, But they are definitely not TTF fonts. Why would you need this in Chinese? Quote Link to comment Share on other sites More sharing options...
The Buzzard Posted October 3, 2010 Share Posted October 3, 2010 If you are using a Chinese version of ACAD, I would check to see what is the file extension for the Chinese fonts you are selecting. Other than that, I cannot give you a better answer unless another user here at the forum uses something similar. Quote Link to comment Share on other sites More sharing options...
blueshake Posted October 3, 2010 Author Share Posted October 3, 2010 I comes from China,actually I am writing a tool for cad to make my job more convenient.but I am just the beginner.so much trouble beat me.:wink: something like these codes.I run it well yesterday.but now it fail.cad give the error:no function definition: VLAX-ENAME->VLA-OBJECT I search it on google.it says I should add "vl-load-com", and I have done this.but nothing changed.error still continued. @buzzard, do you have any idea about this? thanks. (defun c:drawing_retangle_for_text(/) vl-load-com (setq dd 0.5) (print "\nplease choose the texts.") ;(setvar "osmode" 0) (setq ss (ssget)) (setq i 0) (repeat (sslength ss) (setq ssn (ssname ss i)) (setq ssdata (entget ssn)) (setq key (cdr (assoc 0 ssdata))) (if (= key "MTEXT") ;then (progn (vla-GetBoundingBox (vlax-ename->vla-object ssn) 'obj1 'obj2) ;(setq p1 (vlax-safearray->list (vlax-variant-value obj1))) ;(setq p3 (vlax-safearray->list (vlax-variant-value obj2))) (setq p1 (safearray-value obj1)) (setq p3 (safearray-value obj2)) ;(print "hi") (command "_.rectangle" p1 p3 "") ;(print "hi") (setq ee (entlast)) (command "_.offset" dd (list ee p1) (polar p3 (/ pi 2) dd) "") (entdel ee) ) ) ) ;(command "ucs" "") (princ) ) Quote Link to comment Share on other sites More sharing options...
blueshake Posted October 3, 2010 Author Share Posted October 3, 2010 ok,I found the reason. it is my fault. it should be (vl-load-com) Quote Link to comment Share on other sites More sharing options...
The Buzzard Posted October 3, 2010 Share Posted October 3, 2010 OK, I found this in the help section. Alternate Font Variable FONTALT Specifies the location of the font file to use if AutoCAD cannot locate the original font and an alternate font is not specified in the font mapping file. You can also set the location of Alternate Font File by using the FONTALT system variable. If you do not specify an alternate font through the Options dialog box or the FONTALT system variable, when you open a drawing containing fonts that AutoCAD cannot locate, a similar dialog box displays from which you specify a font to use for each missing font. Font Name Lists the font family name for all registered TrueType fonts and all AutoCAD SHX fonts in the AutoCAD Fonts folder. When you select a name from the list, AutoCAD reads the file for the specified font. Font Style Specifies font character formatting, such as italic, bold, or regular. If the missing font is a Big Font, this option changes to Big Font and lists all available Asian-language Big Font files. Quote Link to comment Share on other sites More sharing options...
The Buzzard Posted October 3, 2010 Share Posted October 3, 2010 ok,I found the reason. it is my fault.it should be (vl-load-com) I guess that should do it. I had no idea you were using a VL code anyway as it was not mentioned. Good Luck. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted October 3, 2010 Share Posted October 3, 2010 I'm guessing this is in relation to this thread: http://www.cadtutor.net/forum/showthread.php?52968-drawing-rectangle-for-text Perhaps take a look here also: http://www.cadtutor.net/forum/showthread.php?52031-Start-and-End-points-of-a-TEXT&p=352471&viewfull=1#post352471 Quote Link to comment Share on other sites More sharing options...
blueshake Posted October 3, 2010 Author Share Posted October 3, 2010 I'm guessing this is in relation to this thread: http://www.cadtutor.net/forum/showthread.php?52968-drawing-rectangle-for-text Perhaps take a look here also: http://www.cadtutor.net/forum/showthread.php?52031-Start-and-End-points-of-a-TEXT&p=352471&viewfull=1#post352471 everything goes well now. thank you all. Quote Link to comment Share on other sites More sharing options...
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.