Bill Tillman Posted July 21, 2016 Posted July 21, 2016 I'm using this small routine to add some new layers to a drawing: defun fLayer (fName fColor Ltype fPlot) (entmake (list (cons 0 "LAYER") (cons 100 "AcDbSymbolTableRecord") (cons 100 "AcDbLayerTableRecord") (cons 2 fName) (cons 6 LType) (cons 62 fColor) (cons 70 0) (cons 290 fPlot) ) ) (princ) ); end Layer functions And it works great if the value I send for the color is a number like 3, 2 or 1. But if I send it text like "White" or "Green" it will not work. I tried using the DXF code of 420 in lieu of 62 as well but still get the same results. Quote
Bill Tillman Posted July 21, 2016 Author Posted July 21, 2016 Okay I found the solution was to use another routine with 430 as the DXF code instead of 62. Was hoping to use only one routine for this. Ooops, actually that didn't resolve it. The colors all default to "White" using 430 and send it something like "Magenta" or "Cyan". Quote
iconeo Posted July 21, 2016 Posted July 21, 2016 You could just convert white to 7, etc. Sent from my SM-G920T using Tapatalk Quote
Tharwat Posted July 21, 2016 Posted July 21, 2016 (defun _pick:colour (clr / clrs pos) ;; Tharwat - 22.Jul.2016 ;; (setq clrs '("red" "yellow" "green" "cyan" "blue" "magenta" "white")) (if (and (= (type clr) 'STR) (setq pos (member (strcase clr t) clrs))) (1+ (vl-position (car pos) clrs)) (if (and (numberp clr) (< 0 clr 257)) clr ) ) ) Quote
BIGAL Posted July 22, 2016 Posted July 22, 2016 Or use a cond before entmake (cond ((= (strcase fcolor) "RED") (setq fcolor 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.