这里有一些东西要看,它需要相当多的工作,但我纠正了块角度,使其正常工作,并删除了额外编码的需要,它需要发挥文字位置和可读性检查。我仍然认为没有必要先插入块,而不是在末尾添加。
- (defun stend ( / d1 d2 temp)
- (setq stpt (vlax-curve-getstartPoint Obj)
- endpt (vlax-curve-getEndPoint Obj)
- d1 (distance stpt pt)
- d2 (distance endpt pt)
- )
- (if (> d1 d2)
- (progn
- (setq temp stpt)
- (setq stpt endpt)
- (setq endpt temp)
- )
- )
- )
- (defun ispline ( / co-ordsxy I xy co-ords numb len ang1 ang2)
- (stend)
- (setq co-ords (vlax-safearray->list (vlax-variant-value (vlax-get-property
- obj "Coordinates" ) ) )
- )
- (setq len (length co-ords))
- (setq numb (/ len 2))
- (setq I 0)
- (repeat numb
- (setq xy (list (nth i co-ords)(nth (+ I 1) co-ords) ))
- (setq co-ordsxy (cons xy co-ordsxy))
- (setq I (+ I 2))
- )
- (alert"check direction here")
- (setq ang1 (angle (nth 1 co-ordsxy)(nth 0 co-ordsxy)))
- (if (= numb 2)
- (setq ang2 ang1)
- (setq ang2 (angle (nth (- numb 1) co-ordsxy)(nth (- numb 2) co-ordsxy)))
- )
- (command "-insert" "att1" endpt 1 "" ang1 (rtos (car stpt) 2 2 ))
- (command "-insert" "att2" stpt 1 "" ang2 (rtos (cadr stpt) 2 2 ))
- )
- (defun isline ( / ang)
- (stend)
- (setq ang (angle stpt endpt))
- (command "-insert" "att1" stpt 1 "" ang (rtos (car stpt) 2 2 ))
- (command "-insert" "att2" endpt 1 "" ang (rtos (car stpt) 2 2 ))
- )
- (defun isarc ( / )
- (alert "Non supported item at this time")(exit)
- )
- (defun iscirc ( / )
- (alert "Non supported item at this time")(exit)
- )
- ;;;; starts here
- (defun endptlabel1 ( / ent)
- (setq ent (entsel "pick object near end for start"))
- (SETQ ANGBASEE (GETVAR "ANGBASE"))
- (SETQ ANGDIRR (GETVAR "ANGDIR"))
- (SETQ AUNITSS (GETVAR "AUNITS"))
- (SETVAR "ANGBASE" 0.0)
- (SETVAR "ANGDIR" 0)
- (SETVAR "AUNITS" 3)
- (setq pt (cadr ent))
- (setq obj (vlax-ename->vla-object (car ent)))
- (setq objname (vla-get-objectname obj))
- (setvar 'attdia 0)
- (cond
- ((= objname "AcDbPolyline")(ispline))
- ((= objname "AcDbLine")(isline))
- ((= objname "acDbArc")(isarc))
- ((= objname "AcDbCircle" )(iscircle))
- )
- (SETVAR "ANGBASE" angbasee)
- (SETVAR "ANGDIR" angdirr)
- (SETVAR "AUNITS" aunitss)
- (princ)
- )
- (defun c:aaa ()
- (endptlabel1)
- )
- (defun c:bbb ()
- (endptlabel2)
- )
|