Dayananda Posted November 21, 2019 Posted November 21, 2019 (setq adoc (vla-get-activedocument (vlax-get-acad-object)) blocks (vla-get-blocks adoc) lays (vla-get-layers adoc) color (acad_colordlg 256) ) Can someone to convert above code to AutoLisp. Quote
BIGAL Posted November 21, 2019 Posted November 21, 2019 (edited) Explain more what it is your trying to do. You can tblsearch for blocks and layers. Edited November 21, 2019 by BIGAL 1 Quote
Dayananda Posted November 21, 2019 Author Posted November 21, 2019 Visual lisp doesn't work with Autocad MAC. It works only with Autolisp. So I am trying to convert to some codes to work with MAC. Quote
Emmanuel Delay Posted November 21, 2019 Posted November 21, 2019 Here is a way to make a list of layers and blocks. You probably don't need adoc (not sure, if you need it, show us in what context) And I don't know why you need (acad_colordlg ). Can you do without? Or any suggestion how else to get this (example pick an object, return the color of its layer... ) (defun layers_table ( / res) (setq res (list)) (while (setq lay (tblnext "LAYER" (not lay))) (setq res (append res (list (cdr (assoc 2 lay))))) ) res ) (defun blocks_table ( / res) (setq res (list)) (while (setq blk (tblnext "BLOCK" (not blk))) (setq res (append res (list (cdr (assoc 2 blk))))) ) res ) (defun c:test ( / blocks lays) (setq ;; you probably don't need adoc blocks (blocks_table) lays (layers_table) ;; color (acad_colordlg 256) ) (princ "\n -- BLOCKS -- \n") (princ blocks) (princ "\n -- LAYERS -- \n") (princ lays) (princ) ) 1 Quote
Dayananda Posted November 21, 2019 Author Posted November 21, 2019 8 hours ago, Emmanuel Delay said: Here is a way to make a list of layers and blocks. You probably don't need adoc (not sure, if you need it, show us in what context) Thanks . Your codes are good enough to start . 1 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.