Hello!
Have hade sombody else the same problem. If I select a block with an attribut and set with grread-coordinates to
attributposition it should move the attribut on cursor, so long I move cursor.
-works fine
Next is if I come with mousecursor to a POLYLINE it should rotate attribut in right direction or parallel to a POLYLINE
-works fine
Sometimes i must in same procedure rotate attribute with 180 degrees
-works find
But here I have my problem, I can´t move attributposition
I get this error and I have seen my attributobject is nil so it´s lost. How can I solve this
error: bad argument type: lentityp nil
(defun c:a (/ ss gr pt ent typ pt end-pt pl-len pt09 pt10 pt11 werte VLAobj )
(princ "\n Attribute freistellen...")
(defun GetVlaObj (ent)
(vlax-ename->vla-object ent)
)
(defun GetDXFObj (ent)
(vlax-vla-object->ename ent)
)
(if (setq ss (ssget "_:E" '((0 . "INSERT"))))
(setq VLAobj (GetVlaObj (cdr (assoc -1 (gettag (ssname ss 0) "NIVÅ")))))
)
(while (and (setq gr (grread t 13 0))
(/= (cadr gr) 13)
(/= (car gr) 25)
(not (eq 3 (car gr)))
)
(cond
(
(eq 5 (car gr))
(redraw)
(if (setq ent (nentselp (cadr gr)))
(setq typ (cdr (assoc 0 (entget (car ent)))))
)
(if
(or
(= "LWPOLYLINE" typ)
(= "LINE" typ)
)
(progn
(setq pt (cadr ent))
(setq end-pt (vlax-curve-getEndPoint ( GetVlaObj (car ent))))
(if (>= (vlax-curve-getDistAtPoint ( GetVlaObj (car ent)) end-pt)
(setq pl-len (vlax-curve-getDistAtPoint ( GetVlaObj (car ent))
(setq pt10 (vlax-curve-getClosestPointTo ( GetVlaObj (car ent)) pt))
)
)
)
(progn
(setq pt11 (if (null (vlax-curve-getPointAtDist ( GetVlaObj (car ent)) (+ pl-len 0.01)))
(vlax-curve-getPointAtDist ( GetVlaObj (car ent)) pl-len)
(vlax-curve-getPointAtDist ( GetVlaObj (car ent)) (+ pl-len 0.01))
)
)
(setq pt09 (if (null (vlax-curve-getPointAtDist ( GetVlaObj (car ent)) (- pl-len 0.01)))
(vlax-curve-getPointAtDist ( GetVlaObj (car ent)) pl-len)
(vlax-curve-getPointAtDist ( GetVlaObj (car ent)) (- pl-len 0.01))
)
)
(setq werte (list ( GetVlaObj (ssname ss 0)) (angle pt09 pt11)))
(vla-put-rotation (car werte) (cadr werte))
(setq a (getstring "\nRotate 180grad / Postion: [r]otate / <c>ontinue"))
(cond
((= a "r")
(vla-put-rotation (car werte) (+ pi (cadr werte)))
(GetDXFObj VLAobj)
)
((or (= a "") (= a "c"))
;;; (princ (vl-princ-to-string gr))
(redraw)
(entmod (subst (cons 10 (cadr gr)) (assoc 10 (entget (GetDXFObj VLAobj))) (entget (GetDXFObj VLAobj))))
)
)
)
)
)
)
(entmod (subst (cons 10 (cadr gr)) (assoc 10 (entget (GetDXFObj VLAobj))) (entget (GetDXFObj VLAobj))))
;;; (vlax-put-property VLAobj 'InsertionPoint (vlax-3d-point (cadr gr)))
)
)
)
)
this is only a selecting methode for attrib in a block
(gettag (ssname ss 0) "NIVÅ")