TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: TimSpangler on February 26, 2009, 03:27:04 PM

Title: Entmake Insert + attrib
Post by: TimSpangler on February 26, 2009, 03:27:04 PM
Driving me crazy.

I have created a block using entmake including attrdef's but when I try to create the insert based on that block with attrib's I get unexpected results.

Am I doing something wrong?
Title: Re: Entmake Insert + attrib
Post by: T.Willey on February 26, 2009, 03:29:57 PM
Hard to tell without code.   :wink:

Here is how I add extra attributes to blocks, which recreates the insert and all attributes, so I think it will show you a way to do it.

[ http://www.theswamp.org/index.php?topic=8037.0 ]
Title: Re: Entmake Insert + attrib
Post by: TimSpangler on February 26, 2009, 03:34:01 PM
Sorry 'bout that:

Code: [Select]
(defun FRAM_BUBBLE (/)

;; Create framing marker block
;; Check for the block if it is not there, create it
(if (not (tblsearch "block" "ID1"))
(progn
(entmake
(list
(cons 0 "BLOCK")
(cons 2 "ID1")
(cons 4 "Framing ID marker")
(cons 70  2)
(cons 10 (list 0.0 0.0 0.0))
(cons 8  "11T")
)
)
;; STDLIB_LAKEPLINE <POINTLIST> <LAYER> <LINETYPE> <COLOR> <CLOSE>
(STDLIB_MAKECIRC (list 0.0 0.0 0.0) 7.0 "11T" "Continuous")
(entmake
(list
(cons 0 "ATTDEF") ;; Entity type
(cons 1 "") ;; Attrib Value
(cons 2 "RTAG1") ;; Attrib Tag
(cons 3 "ID") ;; Attrib Prompt
(cons 7 "1T14") ;; Textstyle
(cons 8 "11T") ;; Layer
(cons 10 (list 0 0 0)) ;; First alignment point
(cons 11 (list 0 0 0)) ;; Second alignment point
(cons 40 4.0) ;; Text height
(cons 70 2) ;; Attribute flags
(cons 71 0) ;; Text generation flags
(cons 72 1) ;; Horizontal text justification type
(cons 74 2) ;; Vertical text justification type
)
)
(entmake
(list
(cons 0 "ENDBLK")
)
)
)
)
(princ)
)
^^ Code to create the block

Code: [Select]
(defun FRAM_INSERT_BUBBLE (InsPoint Value /)

;; Insert block framing marker
(entmake
(list
(cons 0 "INSERT") ;; Entity type
(cons 2 "ID1")
(cons 8 "0")
(cons 10 InsPoint)
(cons 50 0.0)
(cons 70 0)
(cons 66 1) ;; Attribute follow
)
)
(entmake
(list
(cons 0 "ATTRIB") ;; Entity type
(cons 1 Value) ;; Attrib Value
(cons 2 "RTAG1") ;; Attrib Tag
(cons 7 "1T14") ;; Textstyle
(cons 8 "11T") ;; Layer
(cons 10 InsPoint) ;; First alignment point
(cons 11 InsPoint) ;; Second alignment point
(cons 40 4.0) ; Text height
(cons 70 0) ;; Attribute flags: 8
(cons 71 0) ;; Text generation flags
(cons 72 1) ;; Horizontal text justification type
(cons 74 2) ;; Vertical text justification type
)
)
(entmake
(list
(cons 0 "SEQEND") ;; Entity type
(cons 8 "0") ;; Layer
)
)
)
^^Code to create the insert


Everything works except when i try to edit the insert there is no "Prompt"

Why?  What am I doing wrong
Title: Re: Entmake Insert + attrib
Post by: T.Willey on February 26, 2009, 04:16:03 PM
I don't know how the command knows about the prompt, as I haven't figured that part out yet.  Maybe someone will be able to chime in, and enlighten us both.  Sorry Tim.
Title: Re: Entmake Insert + attrib
Post by: TimSpangler on February 26, 2009, 04:49:44 PM
Worst part is that if the block is already in the dwg (from the library) everything works as expected...

Hope someone can shed some light on this for me. (us)
Title: Re: Entmake Insert + attrib
Post by: MP on February 26, 2009, 04:58:32 PM
My guess is that your code that defines the block def fails to make the attdef, tho it does succeed at making the block def.

While your call to make the insert, c/w attribute succeeds, there is no corresponding attdef entry in the block definition, so it cannot find the associated prompt.
Title: Re: Entmake Insert + attrib
Post by: gile on February 26, 2009, 05:37:27 PM
Hi,

In the attdef entmake, change (cons 70 2) -constant attribute- to (cons 70 8 ) -predefined attribute-
Title: Re: Entmake Insert + attrib
Post by: kdub_nz on February 26, 2009, 06:55:16 PM

Just a general note about comments ...
Tim, If you had made the comments for the 70,71, 72, 74 keys explicit the 'error' may have become apparent.  :-)


Title: Re: Entmake Insert + attrib
Post by: TimSpangler on February 27, 2009, 07:30:50 AM
Hi,

In the attdef entmake, change (cons 70 2) -constant attribute- to (cons 70 8 ) -predefined attribute-

That did the trick....Thanks