乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
查看: 66|回复: 8

[编程交流] set layer, text height, style,

[复制链接]

10

主题

40

帖子

30

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
50
发表于 2022-7-5 16:53:09 | 显示全部楼层 |阅读模式
hello,
sorry if this is an old question - i looked a bit for it but couldnt find just what i am after - but i am trying to have a command/button to create mtext and set the properties for it.
 
for example, i would like to be able to type in "35" and have the mtext window on screen but the layer set to "text 35" and the text style and height set to "standard" and "3.5".
 
i am working on this coding i found
  1. (defun c:tstyle ()   (command "-style" "MR_ROMANS" "romans" "3.5" "1" "what" "are" "these" "values") )
 
but i dont know what the values in inverted commas after "3.5" are. i assume they are layer, etc., but i could be very wrong... probably.
 
thanks for your help.
回复

使用道具 举报

10

主题

40

帖子

30

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
50
发表于 2022-7-5 17:01:00 | 显示全部楼层
okay, so i am almost there.
i have used the following:
 
  1. (command "Layer" "M" "NEWLAYER" "")(command "Style" "MR ROMANS" "romans" "3.5" "" "" "" "" "")(command "mtext")
 
and it sets everything as i want (layer, style, size, etc.).
 
the only thing i would like now is that when the mtext comes in, i only get the small text input on screen. i will try to find out how to fix this, but if anyone knows, please add!
回复

使用道具 举报

106

主题

1万

帖子

101

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1299
发表于 2022-7-5 17:11:48 | 显示全部楼层
Numbers work fine in lisp defuns
 
  1. ; 35 now maybe 35m for mtext 35t for text(defun c:35 ()(command "Layer" "M" "NEWLAYER" "")(command "Style" "MR ROMANS" "romans" "3.5" "" "" "" "" "")(command "mtext"))
or
  1. (defun c:35 ()(command "Layer" "M" "NEWLAYER" "" "Style" "MR ROMANS" "romans" "3.5" "" "" "" "" "" "mtext"))
回复

使用道具 举报

10

主题

40

帖子

30

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
50
发表于 2022-7-5 17:17:38 | 显示全部楼层
good morning BigAl!
 
here is exactly what i have
 
  1.   (defun c:t35 ()(command "Layer" "M" "MR_TXT_035" "")(command "Style" "MR ROMANS" "romans" "3.5" "" "" "" "" "")(command "mtext") )
 
the only issue i have is i am getting the command line input on screen type, whereas i want it to be the in place editor. i have no idea why mtext isnt running as usual?
回复

使用道具 举报

10

主题

40

帖子

30

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
50
发表于 2022-7-5 17:26:24 | 显示全部楼层
got it! it was here:
 
http://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/when-using-mtext-in-a-lisp-routine-text-can-only-be-entered-on/td-p/2630396
 
i needed this:
 
  1. ...(initdia)(command ".mtext")
 
thanks BigAl!
回复

使用道具 举报

106

主题

1万

帖子

101

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1299
发表于 2022-7-5 17:36:13 | 显示全部楼层
You dont the the period (command "mtext") the initdia is the bit needed, sometimes you need to use a - eg -layer stops the dialog box from popping up.
回复

使用道具 举报

10

主题

40

帖子

30

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
50
发表于 2022-7-5 17:43:31 | 显示全部楼层
excellent. thank you.
回复

使用道具 举报

10

主题

40

帖子

30

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
50
发表于 2022-7-5 17:45:50 | 显示全部楼层
okay, more more more!
 
does anyone know how i can set the text to have a background mask? (i know the value after ((90 .  is 2 to use the background and mask) also for leader text? i have two separate lisps i would like to combine, but i dont know how to integrate this
 
  1. (defun c:mblank ( / js n dxf_ent)(setq js (ssget '((0 . "MTEXT"))))(cond        (js                (repeat (setq n (sslength js))                        (setq dxf_ent (entget (ssname js (setq n (1- n)))))                        (entmod (append dxf_ent '((90 . 2) (63 .  (45 . 1.1) (441 . 0))))                )        )))
 
into this
 
  1.     (defun c:t5 () (command "Layer" "M" "MR_TXT_050" "")(command "Style" "MR_ROMANS" "romans" "5" "" "" "" "" "")(initdia)(command "mtext")
回复

使用道具 举报

26

主题

1495

帖子

20

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
118
发表于 2022-7-5 17:53:47 | 显示全部楼层
Since it is impossible to determine the number of parameters required for the STYLE table command without reading the shape's .shp definition file, I use this :
 
  1. ;++++++++++++ Set SHX or PFB Text Style ++++++++++(defun SetStyle (s)(and (or (/= 'STR (type s))  (and (not (tblsearch "STYLE" s))       (and (not (findfile (strcat s ".SHX")))            (not (findfile (strcat s ".PFB"))))))     (princ (strcat "Cannot Access Text Style " s))     (exit))(command "_.STYLE" s s)(while (> (getvar "CMDACTIVE") 0)   (command "")))
 
I prefer an (exit) here due to the inaccurate expectations of the results.  Therefore a robust *error* replacement is required.
 
-David
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-3-14 13:11 , Processed in 0.588075 second(s), 70 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表