0 Members and 1 Guest are viewing this topic.
(defun ila(lst nom_dwg / Ouvrir_dessin_dbx cp dbx doc lan lay) (defun Ouvrir_dessin_dbx(dwg / dbx) (vl-load-com) (if (< (atoi (substr (getvar "ACADVER") 1 2)) 16) (setq dbx (vlax-create-object "ObjectDBX.AxDbDocument")) (setq dbx (vlax-create-object (strcat "ObjectDBX.AxDbDocument." (substr (getvar "ACADVER") 1 2)))) ) (vla-open dbx dwg) dbx ) (and (setq nom_dwg (findfile nom_dwg)) (progn (if (vl-catch-all-error-p (setq doc (vl-catch-all-apply 'vla-item (list (vla-get-documents (vlax-get-acad-object)) (strcat (vl-filename-base nom_dwg) (vl-filename-extension nom_dwg)))))) (setq dbx (ouvrir_dessin_dbx nom_dwg) lan T) (setq dbx doc) ) (foreach lay lst (or (vl-catch-all-error-p (setq cp (vl-catch-all-apply 'vla-item (list (vla-get-layers dbx) lay)))) (vla-CopyObjects Dbx (vlax-safearray-fill (vlax-make-safearray vlax-vbObject '(0 . 0)) (list cp) ) (vla-get-layers (vla-get-activedocument (vlax-get-acad-object))) ) ) ) ) ) (and lan (vlax-release-object dbx)) (princ))
(ila '("layer1" "layer2") "c:/file.dwg")
Thanks for the reply. but it doesnt copy xref entity layer to the working drawing.