Hi
For the moment I have it like this! It works perfect.
I just need one more little thing!
I want the original block not only to change the layer, i also want to change the textstyle of the Attribute.
Is that possible?
(defun Punktkopie ( / ent obj att fieldcode gesch)
(defun LM:getattributevalue ( blk tag / enx )
(if (and (setq blk (entnext blk)) (= "ATTRIB" (cdr (assoc 0 (setq enx (entget blk))))))
(if (= (strcase tag) (strcase (cdr (assoc 2 enx))))
(cdr (assoc 1 (reverse enx)))
(LM:getattributevalue blk tag)
)
)
)
(while
(if (and (setq ent (entsel "\nGeoreferenzierter Punkt wählen: "))
(= (vla-get-ObjectName (setq obj (vlax-ename->vla-object (car ent)))) "AcDbBlockReference")
(= (vla-get-EffectiveName obj) "SPI-Datenextraktionspunkt-CM")
(setq att (nentselp (cadr ent)))
(= (vla-get-ObjectName (setq att (vlax-ename->vla-object (car att)))) "AcDbAttribute")
)
(progn
(command "_.-layer" "_m" "-I-Hilfslinien" "_co" "_t" "153,115,0" "-I-Hilfslinien" "_p" "_n" "-I-Hilfslinien" "")
(vla-put-Layer obj "-I-Hilfslinien")
(command "_.-LAYER" "_m" "-I-Koordinatenpunkte-Kopie" "_co" "2" "-I-Koordinatenpunkte-Kopie" "")
(setq fieldcode (strcat "%<\\AcObjProp Object\(%<\\_ObjId " (itoa (vla-get-objectid att)) ">%\).TextString>%"))
(setq gesch (LM:GetAttributeValue (car ent) "01" ))
(setq pt (getpoint (strcat "\nEinfügepunkt für Punktkopie von " gesch " angeben: ")))
(setq blk (vlax-invoke
(vlax-get
(vla-get-ActiveLayout
(vla-get-activedocument
(vlax-get-acad-object)))
'Block)
'InsertBlock (trans pt 1 0)
"SPI-Punktkopie.dwg" 1 1 1 (- (getvar 'viewtwist))))
(setq atb (Car (vlax-invoke blk 'Getattributes)))
(vla-put-textstring atb fieldcode)
(princ "\nTextposition angeben: ")
(Textmove (trans (vlax-get atb 'TextAlignmentPoint) 0 1) atb)
(setq inserted (cons blk inserted))
)
) ; end of if
) ; end of while
) ; end of defun
Thank you in advance...