计算打印区域字高
->请输入1:1的标注文字高度 <2>: 2.5->请指定要打印窗口的第一角点或 <退出>:
->请指定打印窗口的对角点或 <退出>:
->是否设置当前标注文字高度为 <A4>:
->打印区域最佳文字高度为: A4=2.5A3=1.8A2=1.3A1=0.9A0=0.6
->当前标注文字高度已经设置为2.5!不知有朋友做过类似的程序吗?首先输入1:1标注的文字高度 ,指定打印区域,指定打印的纸张大小,计算出最合适的标注文字高度
有没有谁知道计算方法??? 燕秀外挂好像有,就是操作步骤太多 lucas_3333我知道有 ,现已经仿yanxiu写了一个
可否看看你大作源码哦? wayne_myles 发表于 2015-7-11 07:39 static/image/common/back.gif
lucas_3333我知道有 ,现已经仿yanxiu写了一个
可否看看你大作源码哦?
也不是真正的源码, 算是伪源码, 用的XDAPI ,
后来想想,其实此方法不科学, 基本没用了
科学的方法:
http://bbs.mjtd.com/thread-100053-1-1.html
或者eachy 的这个
ea_setgloble: dialog {
label= "绘图参数 EaTools";
: row {
fixed_width = true;
: boxed_column {
label = "出图比例";
: edit_box {
key = "scal";
fixed_width = true;
edit_width = 8;
edit_limit = 8;
mnemonic = "C";
}
: popup_list {
key = "scal_list";
edit_width = 10;
list = "1:100\n1:200\n1:300\n1:500\n1:1000\n1:1500\n1:2000\n1:3000\n1:5000\n1:10000\n1:25000\n1:50000\n1:250000\n1:1000000";
}
}
: boxed_column {
label = "绘图单位";
: radio_button {
label = "米M";
mnemonic = "M";
key = "un_m";
is_tab_stop = false;
}
: radio_button {
label = "毫米H";
mnemonic = "H";
key = "un_h";
is_tab_stop = false;
}
}
}
: boxed_row {
label = "文字高度: ";
: edit_box {
label = "H:";
key = "hig";
fixed_width = true;
edit_width = 8;
}
: popup_list {
key = "hig_list";
edit_width = 8;
list = "2.0\n2.5\n3.0\n3.5\n4.0\n4.5\n5.0";
}
}
ok_cancel;
}
;; 米 0.001 毫米1.0
;;这个仅仅是写 dict 不改变你图中任何东西
(defun c:tt (/ $do_default $ea:do_units
$ea:do_scale$ea_scale _easet_id
ea:selst hlst edit_in
ea:units slst
)
(defun edit_in (n val / ppt k1 lst)
(setq
lst (ybl-str-parse (vlax-ldata-get "Ea_dict" "ea_contrl") "|")
)
(cond ((= n 1)
(setq ppt "出图比例"
k1"scal"
)
)
((= n 2)
(setq ppt "字体高度"
k1"hig"
)
)
)
(if ($EADCL_CheckIn val ppt k1)
(cond
((= n 1)
(vlax-ldata-put
"Ea_dict"
"ea_contrl"
(strcat (get_tile "scal") "|" (cadr lst) "|" (last lst))
)
)
((= n 2)
(vlax-ldata-put
"Ea_dict"
"ea_contrl"
(strcat (car lst) "|" (cadr lst) "|" (get_tile "hig"))
)
)
)
)
)
(defun $do_default (/ lst)
(setq
lst (ybl-str-parse (vlax-ldata-get "Ea_dict" "ea_contrl") "|")
)
(set_tile "scal" (car lst))
(set_tile "hig" (last lst))
(if (= 1.0 (float (read (cadr lst))))
(set_tile "un_h" "1")
(set_tile "un_m" "1")
)
;;($EADCL_AddList "hig_list" (mapcar 'vl-princ-to-string hlst) 1)
;;($EADCL_AddList "scal_list" (mapcar 'itoa slst) 3)
)
(defun ea:selst (/ lst indx dlst)
(setq
dlst
(ybl-str-parse (vlax-ldata-get "Ea_dict" "ea_contrl") "|")
)
(setq indx (atoi (get_tile "scal_list")))
(set_tile "scal"
(itoa (nth indx slst))
)
(vlax-ldata-put
"Ea_dict"
"ea_contrl"
(strcat (vl-princ-to-string (float (nth indx slst)))
"|"
(cadr dlst)
"|"
(last dlst)
)
)
)
(defun $fillhig (/ dlst)
(setq
dlst
(ybl-str-parse (vlax-ldata-get "Ea_dict" "ea_contrl") "|")
)
(set_tile "hig"
(vl-princ-to-string (nth (atoi $value) hlst))
)
(vlax-ldata-put
"Ea_dict"
"ea_contrl"
(strcat (car dlst) "|" (cadr dlst) "|" (get_tile "hig"))
)
)
(defun ea:units (num / lst)
(setq
lst (ybl-str-parse (vlax-ldata-get "Ea_dict" "ea_contrl") "|")
)
(vlax-ldata-put
"Ea_dict"
"ea_contrl"
(strcat (car lst)
(if (= 0 num)
"|0.001|"
"|1.0|"
)
(last lst)
)
)
)
(ea:init)
(setq hlst '(2.0 2.5 3.0 3.5 4.0 4.5 5.0)
slst '(100 200 300 500 1000 1500 2000 3000 5000 10000 25000 50000 100000))
(if (not _easet_id)
(setq _easet_id (load_dialog "scale.dcl"))
)
(if (not (new_dialog "ea_setgloble" _easet_id))
(exit)
)
($do_default)
(action_tile "scal" "(edit_in 1 $value)")
(action_tile "scal_list" "(ea:selst)")
(action_tile "un_m" "(ea:units 0)")
(action_tile "un_h" "(ea:units 1)")
(action_tile "hig" "(edit_in 2 $value)")
(action_tile "hig_list" "($fillhig)")
(start_dialog)
(unload_dialog _easet_id)
(princ)
(princ)
)
(defun ea:init ()
(if (> (atof (getvar "acadver")) 15.)
(vl-load-com)
)
(if (not (vlax-ldata-get "Ea_dict" "ea_contrl"))
(vlax-ldata-put "Ea_dict" "ea_contrl" "1000.|0.001|3.0")
)
(mapcar 'read
(ybl-str-parse (vlax-ldata-get "Ea_dict" "ea_contrl") "|")
)
)
(defun ybl-str-parse (str delimiter / post strlst sl)
(if str
(progn
(setq strlst '()
sl (+ (strlen delimiter) 1)
)
(while (vl-string-search delimiter str)
(setq post (vl-string-search delimiter str))
(setq strlst (append strlst (list (substr str 1 post))))
(setq str (substr str (+ post sl)))
)
(vl-remove "" (append strlst (list str)))
)
)
)
;;检查输入格式
(defun $EADCL_CHECKIN (input format kk /)
(if (and (distof input 2) (> (atof input) 0))
(progn (ybl-dcl-Rs_Error) input)
(progn
(ybl-dcl-do_set_error (strcat "无效的" format "输入"))
(mode_tile kk 2)
nil
)
)
)
(defun ybl-dcl-Rs_Error ()
(set_tile "error" "")
)
(defun YBL-DCL-DO_SET_ERROR (val)
(ybl-dcl-Rs_Error)
(set_tile "error" val)
) lucas_3333 发表于 2015-7-11 08:24 static/image/common/back.gif
也不是真正的源码, 算是伪源码, 用的XDAPI ,
后来想想,其实此方法不科学, 基本没用了
谢了!我学习下
页:
[1]