Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 09/03/2019 in all areas

  1. Try this. The block "layerSample" must be present in the drawing. (defun c:test (/ *error* sv_lst sv_vals c_doc c_spc c_lyrs lyr_lst pt n_obj) (defun *error* ( msg ) (mapcar 'setvar sv_lst sv_vals) (if (not (wcmatch (strcase msg) "*BREAK*,*CANCEL*,*EXIT*")) (princ (strcat "\nOops an Error occurred : " msg))) (princ) );end_defun *error* (setq sv_lst (list 'cmdecho 'osmode) sv_vals (mapcar 'getvar sv_lst) c_doc (vla-get-activedocument (vlax-get-acad-object)) c_spc (vlax-get-property c_doc (if (= 1 (getvar 'cvport)) 'paperspace 'modelspace)) c_lyrs (vla-get-layers c_doc) );end_setq (mapcar 'setvar sv_lst '(0 0)) (vlax-map-collection c_lyrs '(lambda (x) (setq lyr_lst (cons (vlax-get-property x 'name) lyr_lst)))) (setq pt (getpoint "\nSelect Insertion point : ") lyr_lst (vl-sort lyr_lst '<) );end_setq (foreach lyr lyr_lst (setq n_obj (vla-insertblock c_spc (vlax-3d-point pt) "layerSample" 1 1 1 0)) (vlax-put-property n_obj 'layer lyr) (setq pt (mapcar '+ pt '(0.0 -300.5 0.0))) );end_foreach (vla-regen c_doc acallviewports) (mapcar 'setvar sv_lst sv_vals) (princ) );end_defun
    1 point
  2. Sure .. something like this: (defun c:foo (/ el) (vlax-for l (vla-get-layers (vla-get-activedocument (vlax-get-acad-object))) (setq el (entget (vlax-vla-object->ename l))) (vl-catch-all-apply 'vla-put-name (list l (strcat (vla-get-name l) "_" (if (minusp (vla-get-lineweight l)) "Default" (itoa (vla-get-lineweight l)) ) "_" (vl-princ-to-string (cond ((cdr (assoc 430 el))) ((assoc 420 el) (mapcar '(lambda (x) (vlax-get (vla-get-truecolor l) x)) '(red green blue)) ) ((cdr (assoc 62 el))) ) ) ) ) ) ) ) (vl-load-com)
    1 point
×
×
  • Create New...