Attdef Not Usable From Entmake

Attdef Not Usable From Entmake

mgorecki
Collaborator Collaborator
853 Views
3 Replies
Message 1 of 4

Attdef Not Usable From Entmake

mgorecki
Collaborator
Collaborator

Hello,

I have the following code that creates a block (lwpolyline and attribute).  It seems to work just fine, in that the block gets created and inserted.  The problem is that the block gets inserted, but it doesn't ask for attribute information.  When I enter the attdef command and pick the block, I get, "Select block reference:  That block has no editable attributes."

Any ideas as to why the block attribute is not working?

 

(entmake (list '(0 . "BLOCK")
      '(100 . "AcDbEntity")
      '(67 . 0)
      '(8 . "0")
      '(100 . "AcDbBlockReference")
      (cons 2 blockName)
      '(10 0 0 0)
      '(70 . 0)
      )
     )
     (entmake
      (apply
       (function append)
       (cons (list '(0 . "LWPOLYLINE")
                   '(100 . "AcDbEntity")
                   '(67 . 0)
                   '(410 . "Model")
                   (cons 8 objLayer)
                   '(100 . "AcDbPolyline")
                   (cons 90 (length newPointList)) ; Vertices
                   '(70 . 0)
                   '(70 . 1) ; Closed
             )
             (mapcar (function list)
                     (mapcar (function (lambda (a) (cons 10 a))) newPointList)                    
                     (mapcar (function (lambda (b) (cons 42 b))) objBulgeList)
             )
        )
      )
     )
     (entmake
      (list '(0 . "ATTDEF")
            '(100 . "AcDbEntity")
            '(100 . "AcDbText")
            (cons 8 objLayer)
            '(10 0.0 0.0 0.0)
            (cons 40 attTextHgt)
            '(1 . "")
            '(100 . "AcDbAttributeDefinition")
            '(3 . "Enter Pad Number")
            '(2 . "PAD_NUM")
            '(70 . 0)
      )
     )
     (entmake (list '(0 . "ENDBLK")
      '(100 . "AcDbBlockEnd")
      '(8 . "0")
      )
     )

 

Thanks,

Mark

0 Likes
Accepted solutions (1)
854 Views
3 Replies
Replies (3)
Message 2 of 4

Ranjit_Singh
Advisor
Advisor
Accepted solution

This works for me

(entmake (list '(0 . "BLOCK")
               '(100 . "AcDbEntity")
               '(100 . "AcDbBlockBegin")
               '(8 . "0")
               '(10 0.0 0.0 0.0)
               (cons 2 blockName)
               '(70 . 2)))
(entmake (apply (function append)
                (cons (list '(0 . "LWPOLYLINE")
                            '(100 . "AcDbEntity")
                            '(67 . 0)
                            '(410 . "Model")
                            (cons 8 objLayer)
                            '(100 . "AcDbPolyline")
                            (cons 90 (length newPointList)) ; Vertices
                            '(70 . 0)
                            '(70 . 1) ; Closed
                            )
                      (mapcar (function list)
                              (mapcar (function (lambda (a) (cons 10 a))) newPointList)
                              (mapcar (function (lambda (b) (cons 42 b))) objBulgeList)))))
(entmake (list '(0 . "ATTDEF")
               '(100 . "AcDbEntity")
               '(100 . "AcDbText")
               (cons 8 objLayer)
               '(10 0.0 0.0 0.0)
               (cons 40 attTextHgt)
               '(1 . "")
               '(100 . "AcDbAttributeDefinition")
               '(3 . "Enter Pad Number")
               '(2 . "PAD_NUM")
               '(70 . 0)))
(entmake (list '(0 . "ENDBLK")
               '(100 . "AcDbEntity")
               '(100 . "AcDbBlockEnd")))
0 Likes
Message 3 of 4

mgorecki
Collaborator
Collaborator

Hello Ranjit,

Thank you for your help.  I see that I had '(70 . 0) for my block.  I changed it to '(70 . 2) and that seems to work.

 

Best regards,

Mark

0 Likes
Message 4 of 4

Ranjit_Singh
Advisor
Advisor

Youa re welcome. Glad it worked for you.

0 Likes