Jump to content

auto load style setting codes


blueshake

Recommended Posts

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.

Link to comment
Share on other sites

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.

 

 

 

 

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 by The Buzzard
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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