ENTMAKE-ing Non-Graphical Objects




From comp.cad.autocad Newsgroup:

Benoit Bissonnette wrote:

> > Hi, I'm wondering if it's possible to create/modify a layer, a > dimstyle or textstyle with an entmake call. I tried the following and, > of course, it doesn't work: > > (entmake '((100 . "AcDbSymbolTableRecord") > (0 . "LAYER") > (2 . "TEST_1") > (70 . 64) > (62 . 5) > (6 . "CONTINUOUS") > ) > ) ;entmake > > Any help would be appreciated. Thanks! > > Benoit Bissonnette

The question is an interesting one. I hadn't tried it yet. So I looked things up a little. Here's the answer I posted:

Been looking up my entmakes. Yup, you can entmake layers all right. You must get your pattern with entget, using the table object name as argument. This table object name can be retrieved with the tblobjname function:

(entget (tblobjname "LAYER" "WHATEVER_LAYER_NAME"))

THIS ROUTINE WILL CREATE A LAYER WITH ANY NAME YOU TYPE:

(defun c:mlay () (setq laynam (getstring "\nLayer name: ")) (entmake (list '(0 . "LAYER") '(5 . "28") '(100 . "AcDbSymbolTableRecord") '(100 . "AcDbLayerTableRecord") (cons 2 laynam) '(70 . 64) '(62 . 7) '(6 . "CONTINUOUS") ) ) )

Your code seems to be lacking the '(100 . "AcDbLayerTableRecord") list:

> (entmake '((100 . "AcDbSymbolTableRecord") > (0 . "LAYER") > (2 . "TEST_1") > (70 . 64) > (62 . 5) > (6 . "CONTINUOUS") > ) > )

Hope you find this useful!


Comments