我正在修改Lee写的LISP,我想做的是遍历一个对象列表,让用户根据美学来移动每个对象。
具体来说,我有100个门标识图标,希望放大每个图标,决定是否需要移动图标,如果需要,请移动,然后转到下一个图标。
- (defun c:zmblk (/ file nl lst Minp Maxp pts elst BPNT DPNT)
- (vl-load-com)
- (if (setq file
- (getfiled "Select Text File"
- (if *load *load "") "txt" )
- (progn
- (setq *load file file (open file "r"))
-
- (while (setq nl (read-line file))
- (princ nl)
- (setq lst (cons (car (StrBrk nl 9)) lst)))
- (close file)
- (princ "\n<< Closed file >>")
- (if (setq elst (vl-remove-if 'null
- (mapcar 'handent
- (mapcar
- (function
- (lambda (x)
- (substr x 2))) (reverse lst)))))
- (foreach Obj (mapcar 'vlax-ename->vla-object elst)
- (vla-getBoundingBox Obj 'Minp 'Maxp)
- (setq pts (mapcar 'vlax-safearray->list (list Minp Maxp)))
- (vla-ZoomCenter
- (vlax-get-acad-object)
- (vlax-3D-point
- (polar (car pts)
- (apply 'angle pts)
- (/ (apply 'distance pts) 2.)))
- 400.)
- [color=Red] (command "_MOVE" Obj (SETQ BPNT (GETPOINT "\nPick base point: ")) (SETQ DPNT (GETPOINT "\nPick destination point: ")))
- [/color] )))
- (princ "\n<< No File Selected >>"))
- (princ))
- (defun StrBrk (str chrc / pos lst)
- (while (setq pos (vl-string-position chrc str))
- (setq lst (cons (substr str 1 pos) lst)
- str (substr str (+ pos 2))))
- (reverse (cons str lst)))
我需要有关对象实际移动的帮助,李的代码已经放大了对象,所以我认为我应该能够使用该对象和move命令,选择基点和目标点,然后转到下一个对象。但很明显我做错了什么。
提前感谢,
格伦 |