尘缘一生 发表于 2024-12-15 17:05:07

SLdesign 谈文字高度,宽高比,定位方式

本帖最后由 尘缘一生 于 2024-12-22 23:09 编辑

一:文字高度
对于文字高度,常用的是3,5系统,也就是,数字、字符高度为3,汉字高度为5,
注意,早期PKPM 是(2.5 5系统),这是真比例绘图,那么你说不对,你的是300,500,这就是3,5系统,为什么呢?
那是因为,你在模型空间不是真比例画的!那么你还是会说不对,你不是1000在模型空间画的是1000吗?是真比例啊?你这是1:1的特例,为了转图纸空间罢了!那么,你1:50,1:100的是吗?所以,这不是真比例。
   那么怎么理解呢?那就是各位啊,你的图纸空间各种比例视口的图,哪就是真比例。只不过,你用了中间技术,画在图纸空间里了,如此而已。
二:文字宽高比
      这个很明确,但这个问题,却涉及多多。定位方式作对了,完全可以抛弃这个参数的。
三:定位方式
   多达15种,为什么这么多?只不过CAD叫大家准确定位文字罢了。

综合以上,这是洋鬼子的CAD造的,假如是中国人开发,绝不会如此2B。

既然现实如此,下面分析大家怎么用的。
   当初啊,93年以前,再往前我不得论,建筑界,只有PKPM,中科院用的文字定位为“双穴点”,也就是"F"方式,
如图:
很明显,这文字是左右两个”穴点“,夹起来的,当初我并不明了这个优越性之所在,这种:”吆西!好处大大的!这就是为什么,中科院还是最权威之所在,这种,写文字啊,是可以做到不论字体,宽高比,高度,会狠狠夹死在这两点之间的道理!
   但是:那时候为什么,PKPM在CFG平台里,还提供了一段LISP呢?就是改“左定位”的,如图:

只有左下角这一点,这是不是目前大家都在开发所用的吧?是不是?这也就是PKPM为啥提供那段程序,实际上是“被逼无奈”,为什么?因为到时候,其他二开刚刚坠地,要这么弄,不是后来把PKPM都干倒了吗的那个东西?
    危害无穷,众人都错,也就认为应该如此下去罢了!很可惜的是,我得SLdesign,也无奈选择了这种来集成!实在可惜!
图示最大危害性:

这种打开,文字右侧,不齐的,就是左定位的最大危害。
   注:你的二开,采取那种,对应一套文字系统,程序当然也不一样(这就是左定位代码好写,简单罢了)。
各种纠缠,我觉得我难以说清楚,罢了,下面展示SLdesign 处理的办法。以不变应万变吧,作个工具,你自己处理吧,怎么的,你不会?哪管不得开发者了!假如你画图超过30年,你以后品品过往,就知道,你这辈子都在错误的道路上,并未知也!
临江仙·滚滚长江东逝水
【作者】杨慎
滚滚长江东逝水,浪花淘尽英雄。
是非成败转头空。
青山依旧在,几度夕阳红。
白发渔樵江渚上,惯看秋月春风。
一壶浊酒喜相逢。
古今多少事,都付笑谈中。


;根据 lstSub 子表中的首元素 替换 lstSource 中对应表元-----(一级)--------
;lstSub需要替换的列表 lstSource源列表 bAdd是否向源列表中追加 原本没有的元素
(defun sl:list-substassoc (lstsublstsourcebadd / e e1)
(foreach e lstsub
    (if (setq e1 (assoc (car e) lstsource))
      (setq lstsource (subst e (assoc (car e) lstsource) lstsource))
      (if badd (setq lstsource (append lstsource (list e))))
    )
)
lstsource
)
;;SLdesign V3.0by尘缘一生QQ:15290049
;原位修改文字对齐方式---(一级)----
(defun text:alignmod (nam mode / p10 p11 ent box b ang)
(setq ent (entget nam) p10 (dxf1 ent 10) b (cadr (textbox ent)) ang (dxf1 ent 50))
(setq ent
    (entmod
      (cond
      ((= (strcase mode) "L") ;左对齐
          (sl:list-substassoc (list (cons 10 p10) '(72 . 0) '(73 . 0)) ent t)
      )
      ((= (strcase mode) "C") ;中对齐
          (sl:list-substassoc (list (cons 11 p10) '(72 . 1) '(73 . 0)) ent t)
      )
      ((= (strcase mode) "R") ;右对齐
          (sl:list-substassoc (list (cons 11 p10) '(72 . 2) '(73 . 0)) ent t)
      )
      ((= (strcase mode) "M") ;中心对齐
          (sl:list-substassoc (list (cons 11 p10) '(72 . 4) '(73 . 0)) ent t)
      )
      ((= (strcase mode) "A") ;对齐
          (setq p11 (polar p10 ang (car b)))
          (sl:list-substassoc (list (cons 10 p10) (cons 11 p11) '(72 . 3) '(73 . 0)) ent t)
      )
      ((= (strcase mode) "F") ;调整
          (setq p11 (polar p10 ang (car b)))
          (sl:list-substassoc (list (cons 10 p10) (cons 11 p11) '(72 . 5) '(73 . 0)) ent t)
      )
      ((= (strcase mode) "BL") ;左下
          (sl:list-substassoc (list (cons 11 p10) '(72 . 0) '(73 . 1)) ent t)
      )
      ((= (strcase mode) "BC") ;中下
          (sl:list-substassoc (list (cons 11 p10) '(72 . 1) '(73 . 1)) ent t)
      )
      ((= (strcase mode) "BR") ;右下
          (sl:list-substassoc (list (cons 11 p10) '(72 . 2) '(73 . 1)) ent t)
      )
      ((= (strcase mode) "ML") ;左中
          (sl:list-substassoc (list (cons 11 p10) '(72 . 0) '(73 . 2)) ent t)
      )
      ((= (strcase mode) "MC") ;正中
          (sl:list-substassoc (list (cons 11 p10) '(72 . 1) '(73 . 2)) ent t)
      )
      ((= (strcase mode) "MR") ;右中
          (sl:list-substassoc (list (cons 11 p10) '(72 . 2) '(73 . 2)) ent t)
      )
      ((= (strcase mode) "TL") ;左上
          (sl:list-substassoc (list (cons 11 p10) '(72 . 0) '(73 . 3)) ent t)
      )
      ((= (strcase mode) "IC") ;中上
          (sl:list-substassoc (list (cons 11 p10) '(72 . 1) '(73 . 3)) ent t)
      )
      ((= (strcase mode) "TR") ;右上
          (sl:list-substassoc (list (cons 11 p10) '(72 . 2) '(73 . 3)) ent t)
      )
      (t ent)
      )
    )
)
(setq ent (entget (dxf1 ent -1)))
(setq p11 (mapcar '+ (mapcar '- p10 (dxf1 ent 10)) (dxf1 ent 11)))
(entmod (sl:list-substassoc (list (cons 10 p10) (cons 11 p11)) ent t))
)
;;SLdesign V3.0by尘缘一生QQ:15290049
;;修改文字高|高宽比|对齐方式--------
(defun c:ch-zs (/ ss h0 hi dcl_id re mode nam n)
(defun dotil (k)
    (set_tile "b0" (rtos (* slbl k) 2 0))
    (setq hi (atof (get_tile "b0")))
    (done_dialog 2)
)
;---------------
(defun dotilb (k)
    (set_tile "b0" (rtos k 2 2))
    (setq hi (atof (get_tile "b0")))
    (done_dialog 3)
)
;---------------
(defun dotildc ()
    (done_dialog 5)
)
;---------------
(setq ss (ssget '((0 . "INSERT,ATTDEF,DIMENSION,TEXT,MTEXT,MULTILEADER,TCH_ARROW,TCH_TEXT,TCH_DRAWINGNAME,TCH_MULTILEADER,TCH_ELEVATION,TCH_MTEXT,ATTRIB"))))
(setq h0 (e-higt (ssname ss 0)))
(setq dcl_id (load_dialog (chzhi-dcl)))
(new_dialog "CHZHI" dcl_id)
(set_tile "b0" (rtos h0 2 0))
(action_tile "b0" "(setq hi (atof (get_tile \"b0\")))")
(action_tile "b00" "(set_tile \"b0\" $value)(setq hi (atof (get_tile \"b0\")))")
(action_tile "b1" "(dotil 3)")
(action_tile "b2" "(dotil 4)")
(action_tile "b3" "(dotil 5)")
(action_tile "b4" "(dotil 6)")
(action_tile "b5" "(dotil 7)")
(action_tile "b6" "(dotil 8)")
(action_tile "b7" "(dotil 9)")
(action_tile "b8" "(dotil 10)")
(action_tile "b9" "(dotil 15)")
(action_tile "b10" "(dotil 20)")
(action_tile "b11" "(dotil 25)")
(action_tile "b12" "(dotil 30)")
(action_tile "k1" "(dotilb 0.7)")
(action_tile "k2" "(dotilb 1.0)")
(action_tile "k3" "(dotilb 1.1)")
(action_tile "k4" "(dotilb 1.2)")
(action_tile "k5" "(dotilb 0.6)")
(action_tile "k6" "(dotilb 0.65)")
(action_tile "k7" "(dotilb 0.75)")
(action_tile "k8" "(dotilb 0.8)")
(action_tile "k9" "(dotilb 0.85)")
(action_tile "k10" "(dotilb 0.9)")
(action_tile "k11" "(dotilb 1.3)")
(action_tile "k12" "(dotilb 1.4)")
(action_tile "chi" "(setq hi (atof (get_tile \"b0\")))(done_dialog 2)")
(action_tile "chbi" "(setq hi (atof (get_tile \"b0\")))(done_dialog 3)")
(action_tile "dob" "(done_dialog 4)")
(action_tile "chzl" "(setq mode \"L\")(dotildc)")
(action_tile "chzc" "(setq mode \"C\")(dotildc)")
(action_tile "chzr" "(setq mode \"R\")(dotildc)")
(action_tile "chzm" "(setq mode \"M\")(dotildc)")
(action_tile "chza" "(setq mode \"A\")(dotildc)")
(action_tile "chzf" "(setq mode \"F\")(dotildc)")
(action_tile "chzbl" "(setq mode \"BL\")(dotildc)")
(action_tile "chzbc" "(setq mode \"BC\")(dotildc)")
(action_tile "chzbr" "(setq mode \"BR\")(dotildc)")
(action_tile "chzml" "(setq mode \"ML\")(dotildc)")
(action_tile "chzmc" "(setq mode \"MC\")(dotildc)")
(action_tile "chzmr" "(setq mode \"MR\")(dotildc)")
(action_tile "chztl" "(setq mode \"TL\")(dotildc)")
(action_tile "chztc" "(setq mode \"TC\")(dotildc)")
(action_tile "chztr" "(setq mode \"TR\")(dotildc)")
(action_tile "cancel" "(done_dialog 0)")
(setq re (start_dialog))
(slunloaddcl dcl_id)
(cond
    ((= re 2)
      (ss-ch-z-hi ss hi (cadr (grread 5)))
    )
    ((= re 3)
      (sl_subupd ss 41 hi)
    )
    ((= re 4);动比
      (macedit-text (sstoslss ss))
    )
    ((= re 5);对齐方式
      (repeat (setq n (sslength ss))
      (setq nam (ssname ss (setq n (1- n))))
      (text:alignmod nam mode)
      )
    )
)
)
;;----------
(defun chzhi-dcl (/ lst_str)
(setq lst_str
    (list
      "CHZHI:dialog {"
      (strcat "label=\""
      (slmsg
          "修改文字:            高度|宽高比|对齐方式"
          "эゅ:            蔼|糴蔼ゑ|癸霍よΑ"
          "Modify Text:         Height|Aspect Ratio|Alignment Method"
      ) "\";"
      )
      "initial_focus=b0;"
      $boxed_column
      (strcat "label=\"" (slmsg "字高,宽高比" "蔼,糴蔼ゑ" "Height,Aspect Ratio") "\";")
      $row
      ":edit_box{key=\"b0\";allow_accept=true;}"
      (strcat ":slider{key=\"b00\";fixed_widht=true;width=16"
      ";max_value=" (rtos (* slbl 40) 2 0) ";min_value=" (rtos (* slbl 2) 2 0) ";bit_increment=5;small_increment=1;}"
      )
      (strcat ":button{label=\"" (slmsg "字高" "蔼" "Height") "\"; key=\"chi\";}")
      (strcat ":button{label=\"" (slmsg "宽高比" "糴蔼ゑ" "Aspect ratio") "\"; key=\"chbi\";}")
      (strcat ":button{label=\"" (slmsg "->动比" "->笆ゑ" "->Dynamic ratio") "\"; key=\"dob\";}")
      "}"
      $row
      $boxed_column
      (strcat "label=\"" (slmsg "字高" "蔼" "Height") "\";")
      $row
      (strcat ":radio_button {label=\"" (rtos (* slbl 3) 2 0) "\";key=\"b1\";}")
      (strcat ":radio_button {label=\"" (rtos (* slbl 4) 2 0) "\";key=\"b2\";}")
      (strcat ":radio_button {label=\"" (rtos (* slbl 5) 2 0) "\";key=\"b3\";}")
      (strcat ":radio_button {label=\"" (rtos (* slbl 6) 2 0) "\";key=\"b4\";}")
      "}"
      $row
      (strcat ":radio_button {label=\"" (rtos (* slbl 7) 2 0) "\";key=\"b5\";}")
      (strcat ":radio_button {label=\"" (rtos (* slbl 8) 2 0) "\";key=\"b6\";}")
      (strcat ":radio_button {label=\"" (rtos (* slbl 9) 2 0) "\";key=\"b7\";}")
      (strcat ":radio_button {label=\"" (rtos (* slbl 10) 2 0) "\";key=\"b8\";}")
      "}"
      $row
      (strcat ":radio_button {label=\"" (rtos (* slbl 15) 2 0) "\";key=\"b9\";}")
      (strcat ":radio_button {label=\"" (rtos (* slbl 20) 2 0) "\";key=\"b10\";}")
      (strcat ":radio_button {label=\"" (rtos (* slbl 25) 2 0) "\";key=\"b11\";}")
      (strcat ":radio_button {label=\"" (rtos (* slbl 30) 2 0) "\";key=\"b12\";}")
      "}}"
      $boxed_column
      (strcat "label=\"" (slmsg "宽高比" "糴蔼ゑ" "Aspect ratio") "\";")
      $row
      ":radio_button {label=\"0.6\";key=\"k5\";}"
      ":radio_button {label=\"0.65\";key=\"k6\";}"
      ":radio_button {label=\"0.7\";key=\"k1\";}"
      ":radio_button {label=\"0.75\";key=\"k7\";}"
      "}"
      $row
      ":radio_button {label=\"0.8\";key=\"k8\";}"
      ":radio_button {label=\"0.85\";key=\"k9\";}"
      ":radio_button {label=\"0.9\";key=\"k10\";}"
      ":radio_button {label=\"1.0\";key=\"k2\";}"
      "}"
      $row
      ":radio_button {label=\"1.1\";key=\"k3\";}"
      ":radio_button {label=\"1.2\";key=\"k4\";}"
      ":radio_button {label=\"1.3\";key=\"k11\";}"
      ":radio_button {label=\"1.4\";key=\"k12\";}"
      "}}}}"
      $boxed_column
      (strcat "label=\"" (slmsg "对齐方式" "癸霍よΑ" "Alignment Method") "\";")
      $row
      (strcat ":button{label=\"" (slmsg "*左 " "*オ " "*L") "\"; key=\"chzl\";}")
      (strcat ":button{label=\"" (slmsg " 中 " " い " " C") "\"; key=\"chzc\";}")
      (strcat ":button{label=\"" (slmsg " 右 " "  " " R") "\"; key=\"chzr\";}")
      (strcat ":button{label=\"" (slmsg "中心" "いみ" " M") "\"; key=\"chzm\";}")
      (strcat ":button{label=\"" (slmsg "对齐" "癸霍" " A") "\"; key=\"chza\";}")
      (strcat ":button{label=\"" (slmsg "调整" "秸俱" " F") "\"; key=\"chzf\";}")
      "}"
      $row
      (strcat ":button{label=\"" (slmsg "左下" "オ" "BL") "\"; key=\"chzbl\";}")
      (strcat ":button{label=\"" (slmsg "中下" "い" "BC") "\"; key=\"chzbc\";}")
      (strcat ":button{label=\"" (slmsg "右下" "" "BR") "\"; key=\"chzbr\";}")
      (strcat ":button{label=\"" (slmsg "左中" "オい" "ML") "\"; key=\"chzml\";}")
      (strcat ":button{label=\"" (slmsg "正中" "タい" "MC") "\"; key=\"chzmc\";}")
      (strcat ":button{label=\"" (slmsg "右中" "い" "MR") "\"; key=\"chzmr\";}")
      "}"
      $row
      (strcat ":button{label=\"" (slmsg "左上" "オ" "TL") "\"; key=\"chztl\";}")
      (strcat ":button{label=\"" (slmsg "中上" "い" "TC") "\"; key=\"chztc\";}")
      (strcat ":button{label=\"" (slmsg "右上" "" "TR") "\"; key=\"chztr\";}")
      (strcat ":text{label=\"" (slmsg "    缺省SLdesign:->左" "    SLdesign:->オ" "SLdesignDefault:->Left") "\";}")
      ":tile {}:tile {}:tile {}"
      "}"
      "}"
      $row
      ":tile {}:tile {}:tile {}"
      $canbt
      ":tile {}:tile {}:tile {}"
      "}}"
    )
)
(dcl2lisp lst_str)
)

免费的三领链接在此:
SLdesign V3.0 三领设计
链接:https://pan.baidu.com/s/11OnulqGJHNgzukpd_pQgbQ
提取码:zqyu

后续:目前,你要想找一个二开,双穴点定位集成的,是没有的,因为洒家也走在错误的道上,不然,用三领画的图,就另类了!除非你在用PKPM老版本,或某个版本的某个模块。不要给我提什么名字的二开,我头疼,怎么水平的,我还不知道吗?

bai2000 发表于 2024-12-15 19:10:56

ss-ch-z-hi 函数少了

尘缘一生 发表于 2024-12-15 19:15:33

bai2000 发表于 2024-12-15 19:10
ss-ch-z-hi 函数少了

改字的高度
;;选择集修改文字高度----(一级)----
;;ss 选择集hi 新字高pt nil 当前鼠标点位
(defun ss-ch-z-hi (ss hi pt / e el n tp tp1 nam)
        (repeat (setq n (sslength ss))
                (setq nam (ssname ss (setq n (1- n))) e (entget nam) tp (dxf1 e 0))
                (cond
                        ((member tp '("TEXT" "MTEXT" "TCH_TEXT" "ATTDEF" "TCH_MTEXT"))
                                (vla-scaleentity (en2obj nam) (vlax-3D-point (cadr (e9pt nam nil))) (/ hi (dxf1 e 40)))
                        )
                        ((and (= tp "INSERT") (= (dxf1 e 66) 1)) ;;单独属性块文字
                                (entmod (emod (entget (entnext nam)) 40 hi))
                                (entupd nam)
                        )
                        ((and (= tp "INSERT")
                               (if (not pt) (setq pt (cadr (grread 5)))) ;;用于块操作
                               (setq e (nentselp pt))
                               (= (length e) 4) ;;块的实体表数为4
                               (setq el (entget (car e)) tp1 (dxf1 el 0))
                               (member tp1 '("TEXT" "MTEXT" "TCH_TEXT" "TCH_MTEXT"))
                       )
                                (entmod (emod el 40 hi))
                                (entupd (car (last e)))
                                (entupd nam)
                        )
                        ((member tp '("DIMENSION" "MULTILEADER" "TCH_ELEVATION" "TCH_ARROW"))
                                (setq e (entlast))
                                (expl-dim (ssadd nam))
                                (ss-ch-z-hi (last_ent e) hi nil)
                        )
                )
        )
函数嵌套,一一下去,很麻烦,你用自己内库,替代即可。
页: [1]
查看完整版本: SLdesign 谈文字高度,宽高比,定位方式