非常有用,强烈支持。
不过在对付复杂程序还是有问题,错误: 参数类型错误: stringp nil
使用有些麻烦,如果能做成函数更好。
例如:(fvl 文件名 函数名) 返回值: 函数包括变量和完整程序
在下面程序使用出现错误
- (defun get_ltscale(elist / old-elist *error* entltype pattern_length ltscale old-elist pt0 pt1 boolean motion code
- ltscale eltscale new_eltscale n dimdec fawn)
- (defun *error* (msg)
- (if (and (/= msg "Function cancelled")(/= msg "函数被取消"))
- (princ (strcat "<动态线型比例>功能" msg "\n"))
- (if motion(progn(fa-grdraw)(entmod hatch-elist)(setq hatch-elist nil)(ddmodify ename)))
- )
- (princ)
- );;(redraw)
- (defun fa-grdraw()
- (if(= 'list(type pt1))
- (grdraw pt1 pt0 -1)
- )
- )
- (setq auto_ltscale nil)
- (setq entltype(strcase(if(= eltype "BYLAYER")(cdr(assoc 6(tblsearch "layer" elayer)))eltype)))
- (if(not ltnmlst)(make_lt_lists))
- (setq n (vl-position eltype ltnmlst)leng (1- (length ltnmlst))dimdec(getvar"dimdec")
- ltscale (getvar "LTSCALE") old-elist elist pt0 (cadr (grread T 5 0)) boolean T
- pattern_length(cdr (assoc 40 (tblsearch "ltype" entltype))))
- (if(= pattern_length 0.0)(setq pattern_length 1))
- (if(setq pt1 (osnap pt0 "nea"))(setq pt0 pt1 pt1 nil))
- ;;(setq VIEWCTR(getvar"VIEWCTR")VIEWSIZE (getvar"VIEWSIZE")VSMAX(getvar"VSMAX")VSMIX(getvar"VSMIN"))
- (princ"\n动态线型,按 +、- 切换填充图案:")
- (setq motion (grread T 15 0)) ;;动态绘图
- (setq code(car motion))
- (setq pt1(car (cdr motion)))
- (fa-grdraw)
- (setq fawn T)
- (while boolean
- (setq motion (grread T 15 0)) ;;动态绘图
- (redraw)
- (setq code(car motion))
- (setq pt1(car (cdr motion)))
- (fa-grdraw)
- (cond ((= code 5) ;鼠标移动
- (setq new_eltscale (atof(rtos (/(distance pt1 pt0) pattern_length ltscale) 1 dimdec)))
- (if (/= eltscale new_eltscale)
- (progn
- (setq eltscale new_eltscale)
- (emod eltscale 48);;修改对象数据
- (entmod elist);;修改对象图形显示
- )))
- ((= code 3)(setq eltscale new_eltscale)(setq boolean nil))
- ;鼠标左键按下;;保存线型比例eltype;;退出循环
- ((or(and (= code 2)(= 13 (car (cdr motion))))(= code 11)(= code 25))(setq boolean nil))
- ;;;回车键按下 或者;鼠标右键按下,有的鼠标设置为code = 25;;退出循环
- ((and (= code 2)(or(= 45 pt1)(= 43 pt1)(= 61 pt1))) ;- +
- (setq n(if(= 45 pt1)(if(= n 0)leng (1- n))(if(= n leng)0 (1+ n)))eltype(nth n ltnmlst))
- (emod eltype 6)
- (entmod elist);;修改对象图形显示
- (princ(strcat"\n线型名称:"eltype))
- )
- )
- )
- (fa-grdraw)
- (if(/= code 3)(entmod old-elist));;还原图形显示
- )
|