我已经缩减了所有内容,并尽可能地简化它,现在我正在使用警报框来显示我的结果(稍后将添加导出功能)。
折线长度给了我一些问题,我无法将其添加到列表中,然后显示在警报框中。下一个问题是获取属性设置,我尝试合并BIGAL的建议,但一直得到“AutoCAD变量设置被拒绝:”OSMODE“nil”。现在,我已经将其设置为返回每个项目的句柄,我想让它显示开始和结束块属性“STN”和沟槽细节可见性状态(或将可见性状态作为字段的属性,这是最简单的)
如有任何意见,我们将不胜感激。
干杯
- (defun c:TESTW(/ plObj stBl enBl tren len datLst)
- (vl-load-com)
- (if
- (and
- (setq plObj(vlax-ename->vla-object (car (entsel "\nSelect trench to write > "))))
- (setq stBl(entsel "\nSelect 'start' block > "))
- (setq enBl(entsel "\nSelect 'end' block > "))
- (setq tren(entsel "\nSelect trench detail > "))
- ); end and
- (progn
- (setq
- len (vla-get-length plObj)
- stBl(cdr(assoc 5(entget(car stBl))))
- enBl(cdr(assoc 5(entget(car enBl))))
- tren(cdr(assoc 5(entget(car tren))))
- datLst(list(cons 1 stBl)(cons 2 enBl)(cons 3 tren)
- ;(cons 4 len)
- )
- ); end setq
- (vlax-ldata-put plObj "Trench Data" datLst)
- ); end progn
- );end if
- (princ)
- ); c:TESTW
-
- (defun c:TESTR(/ rObj datLst)
- (vl-load-com)
- (if(and
- (setq rObj(entsel "\nSelect trench to read > "))
- (setq datLst(vlax-ldata-get(car rObj) "Trench Data"))
- ); and
- (alert(strcat "Start block: "(cdr(assoc 1 datLst))
- "\n\nEnd block: "(cdr(assoc 2 datLst))
- "\n\nTrench detail: "(cdr(assoc 3 datLst))
- "\n\nLength: can't get length here?" ))
- (alert "\nNo data found. ")
- ); end if
- (princ)
- ); end of c:TESTR
|