编辑“文本字符串”?
您好,我也是autolisp的新手。。我有一个关于Lisp程序的问题。。正如我之前所说,我是Lisp程序的新手。。
以下是:
(defun C:dd()
;parametreler ayarlaniyor.
(setq dostmode (getvar "osmode"))
(setvar "osmode" 1)
;parametreler ayarlandi.
;layer girisleri yapiliyor.
(command "-layer" "new" "SK_SET" "color" "40" "SK_SET" "")
(command "-layer" "new" "SK_SET_YAZI" "color" "3" "SK_SET_YAZI" "")
;layer girisleri yapildi.
;veriler aliniyor.
(setq point (getpoint "\n Tıkla sıhhat bul..."))
;veriler alindi.
;line objesi hazirlaniyor.
(setq linex (car point))
(setq linex (+ linex 0))
(setq liney (cadr point))
(setq liney (+ liney 23))
(setq linepoint (list linex liney))
;line objesi hazirlandi.
;km hesaplaniyor.
(setq kmx (car point))
(setq kmx (- kmx 1))
(setq kmy (cadr point))
(setq kmy (+ kmy 7))
(setq kmpoint (list kmx kmy))
;;;;;;;;;;;;;;;;;;;;
(setq km (car point))
(setq km (rtos km 2 2))
(setq km (strcat "KM=" km))
(princ km)
;km hesaplandi.
;kot hesaplaniyor.
(setq kotx (car point))
(setq kotx (+ kotx 3))
(setq koty (cadr point))
(setq koty (+ koty 7))
(setq kotpoint (list kotx koty))
;;;;;;;;;;;;;;;;;;;;
(setq kot (cadr point))
(setq kot (/ kot 10))
(setq kot (rtos kot 2 3))
(setq kot (strcat "KOT=" kot))
(princ kot)
;mesafe hesaplandi.
;ve sonuc
(command "-textstyle" "F1")
(command "-style" "F1" "ISOCPEUR.TTF" "2" "" "" "" "" "")
(command "-layer" "make" "SK_SET_YAZI" "")
(command "_text" kmpoint 90 km)
(command "_text" kotpoint 90 kot)
(command "-layer" "make" "SK_SET" "")
(command "donut" "0" "2" point "")
(command "_line" point linepoint "")
;ve sonuc
;parametreler ayarlaniyor.
(setvar "osmode" dostmode)
;parametreler ayarlandi.
)
这对我来说很好,但还有一些不完整的地方。。
例如:
http://img36.imageshack.us/img36/9052/64915961.jpg
此图像是上述lisp的结果。。
---------------------------
但我想要这样:
http://img40.imageshack.us/img40/6483/77057898.jpg
---------------------------
所以
旧:KM=349
通缉:KM=0+349.00
旧:KM=1452.43
通缉:KM=1+452.43
旧:KM=25.4
通缉:KM=0+025.40
这样地
谁能帮我一下吗?
我很抱歉英语不好 这应该是你想要的:
(defunc:dd(/*错误*vl ov pt lpt xpt xStr YPTR*错误*(msg)颜色=红色](ifov(mapcar'setvarvl ov((b](小写msg“*退出*,*退出*”princstrcatff00ff](princ)(setqvl color=DARKRED](“CLAYER”“CMDECHO”“OSMODE”ov(mapcar'getvarvl(“CMDECHO”0)(如果(not(tblsearch“LAYER”“SK#U集合”(35; ff00ff]“_。-层”“_M”“SK_SET”“_C”“40”“SK_SET””“(非(tbl搜索“LAYER”“SK_SET_YAZI”)(命令“.-LAYER”“#M”“SK_SET_YAZI”“u C”“3”“SK_SET_YAZI”如果不是(TBL搜索b]“STYLE”“F1”)(命令“-style”“F1”“ISOCPEUR.TTF”“2”](如果(“\nT?kla s?hhat bul…”progn]0[setqlpt(列表(汽车pt(+()23[=RED])xpt(列表((汽车pt1([]cadrpt7xStr(rtos(pt2=RED])(cond(( 谢谢你的帮助
我正在检查你的Lisp程序
再次出现问题,但我会查找代码,如果我能解决这个问题,这对我来说将是惊人的。。
然后我把结果贴在这里,我希望我能做到
这就是问题所在:
http://img192.imageshack.us/img192/7007/53064667.jpg
谢谢,伙计,干杯
编辑:
伙计,这些代码对于初学者来说太复杂了,所以我无法修复:/
如果“km”值带有“”(即=1100.52),当该值为“1100”时,其工作正常,结果如下:KM=0+0001100
http://img357.imageshack.us/img357/38/87434104.jpg
抱歉浪费了你的时间兄弟:不确定: 我会查的伙计,不要浪费时间 试试这个:
(defun c:dd(/*error*vl ov pt lpt xpt xStr ypt yStr)(defun*error*(msg)(if ov(mapcar'setvar vl ov))(if(not(wcmatch(strcase msg)“*QUIT*,*EXIT*”)(princ(strcat“\n>”)(princ))(setq vl'(“CLAYER”“OSMODE”“CMDECHO”“DIMZIN”)ov(mapcar'getvar vl))(mapcar'setvar(cddr vl)'(0))(if(not(tblsearch“LAYER”“SK\u SET”);)(命令“-LAYER”“\u M”“SK\u SET”“\u c”“40”“SK\u SET”“)(if(not(tblsearch”LAYER“SK\u SET\u YAZI”)(command“-LAYER”“\u M”“SK\u SET\u YAZI”“\u C”“3”“SK\u SET\u YAZI”“)(if(not(tblsearch”STYLE“F1”)(command“-STYLE”“F1”“ISOCPEUR.TTF”“2”“)(if(setq pt(getpoint“\nT?kla s?hhat bul…”)(progn(setvar“OSMODE”0)(setq lpt(list(car pt)(+(cadr pt)23))xpt(list(-car pt)1)(+(cadr pt)7))xStr(rtos(car pt)2 2))(cond(( 这与第一个相同,结果如下:
http://img197.imageshack.us/img197/289/24154525.jpg
抱歉-输入了发布的代码-请重试上述代码 哇!太棒了!它现在工作得很好!伙计,你统治。。
你成就了我的一天,谢谢你,兄弟!
http://img191.imageshack.us/img191/205/beer.jpg
给你的电子啤酒
再次感谢您的努力 Wooowww
很好的啤酒,谢谢
没问题,我很乐意帮忙
如果您对代码本身有任何疑问,因为您可能想自己学习LISP,只要问一下,我会尽力解释
当然,我会学的!我会检查你的Lisp程序,试着理解。。谢谢你的帮助,伙计。。
页:
[1]
2