这将删除空格:
- (defun lcoord (/ lEnt bEnt vEnt sPt ePt aEnt aEntLst)
- (command "pickbox" "8")
- (vl-load-com)
- (if (and (setq lEnt
- (car
- (entsel
- "\nSelect Line, Polyline, LWPolyline, Spline or Arc to fill out the PT1 and PT2 attributes of the
- Footage block > " )))
- (member (cdr (assoc 0 (entget lEnt))) '("LINE" "POLYLINE" "LWPOLYLINE" "SPLINE" "ARC"))
- (setq bEnt (car (entsel "\nSelect Destination Block > ")))
- (= (cdr (assoc 0 (entget bEnt))) "INSERT")
- (= (cdr (assoc 66 (entget bEnt))) 1))
- (progn
- (setq vEnt (vlax-ename->vla-object lEnt)
- sPt (vlax-curve-getStartPoint vEnt)
- ePt (vlax-curve-getEndPoint vEnt)
- aEnt (entnext bEnt))
- (while (/= "SEQEND" (cdr (assoc 0 (setq aEntLst (entget aEnt)))))
- (cond ((= "PT1" (cdr (assoc 2 aEntLst)))
- (setq aEntLst (subst (cons 1
- (strcat (in2ft (car sPt))
- ; (chr 32)
- ","
- ; (chr 32) (in2ft (cadr sPt)) (chr 32) ","
- ; (chr 32) (in2ft (caddr sPt))))
- ; (chr 32)
- (in2ft (cadr ePt))))
- (assoc 1 aEntLst)
- aEntLst))
- (entmod aEntLst))
- ((= "PT2" (cdr (assoc 2 aEntLst)))
- (setq aEntLst (subst (cons 1
- (strcat (in2ft (car ePt))
- ; (chr 32)
- ","
- ; (chr 32) (in2ft (cadr ePt)) (chr 32) ","
- ; (chr 32) (in2ft (caddr ePt))))
- ; (chr 32)
- (in2ft (cadr ePt))))
- (assoc 1 aEntLst)
- aEntLst))
- (entmod aEntLst)))
- (setq aEnt (entnext aEnt)))))
- (command "pickbox" "4")
- (command "vbarun" "twcstartend")
- (princ))
顺便问一下,你知道对于属性标记PT1,它被改变的方式意味着你得到起点的x坐标和端点的y坐标-这是你想要的吗? |