Message 1 of 2
program to map layes color
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi
Im writing a program that manipulate layers by a given text file
The text file might look something like :
window,11
wall,144
(defun c:samifox ( / actDoc fn-data-file fp-data-file data-list ) (vl-load-com) (setq actDoc (vla-get-activedocument (vlax-get-acad-object));; get acad refernce fn-data-file (findfile "map.txt"));; look for file (cond ((null fn-data-file);;if file return nil (princ "\nData file map.txt not found")) ((not (setq fp-data-file (open fn-data-file "r"))) (princ "\nUnable to read from map.txt")) (t (while (setq data (read-line fp-data-file)) (if (setq pos (vl-string-position (ascii ",") data)) (setq data-list (cons (cons (substr data 1 pos) (substr data (+ 2 pos))) data-list)) ) ) ) ) ; data integrity test (cond ((not (vl-consp data-list)) (princ "\nNo usable layer data was found")) (t (mapcar 'setLayColor (car data-list) (cdr data-list))) ) (princ) ) (setq setLayColor(lay col / l) (if (tblsearch "layer" lay) (if (setq l (tblobjname "LAYER" lay)) (progn (setq l (vlax-ename->vla-object l)) (vlax-put-property l 'Color col)) ) ) (princ) )
; error: bad argument type: listp "A-DOOR-WINDOW"
why do i get this error?
Thanks
Shay
Using Autocad 2018, Autocad Architecture.
Please accept as solution if i solved your problem
Please accept as solution if i solved your problem