|
Welcome, Guest.
|
||||||
| AutoLISP AutoLISP or Visual LISP, learn both here! |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Member
Join Date: 2001-12
Posts: 29
![]() |
Can someone give me an example on how to create a block with attributes using entmake.
I can create a block, but when I entmake to create the attribute, it returns nil. I am not sure which dotted pair is required for the (0 . "ATTRIB") Any assistance would be appreciated |
|
|
|
|
|
#2 |
|
Active Member
Join Date: 2000-12
Location: Yorkshire
Posts: 81
![]() ![]() ![]() ![]() ![]() ![]() |
Hi vlee
Here's a very simple example which creates a block called "revmk", with a single attribute. Make sure the text style called by the attribute derfinition (romans in this case) exists in the drawing before running the code. ;code start Code:
(entmake '((0 . "block")
(2 . "revmk")
(10 0.0 0.0 0.0)
(70 . 2)
)
)
(entmake '((0 . "attdef")
(8 . "revision")
(10 0.0 0.0 0.0)
(40 . 2.5)
(41 . 0.8)
(72 . 4)
(73 . 2)
(1 . "rev")
(7 . "romans")
(3 . "Enter revision")
(2 . "rev")
(70 . 4)
)
)
(entmake '((0 . "line")
(8 . "revision")
(62 . 1)
(10 -3.5 -2.0207 0.0)
(11 3.5 -2.0207 0.0)
)
)
(entmake '((0 . "line")
(8 . "revision")
(62 . 1)
(10 3.5 -2.0207 0.0)
(11 0.0 4.0415 0.0)
)
)
(entmake '((0 . "line")
(8 . "revision")
(62 . 1)
(10 0.0 4.0415 0.0)
(11 -3.5 -2.0207 0.0)
)
)
(entmake '((0 . "endblk")))
__________________
Regards, David Last edited by Glenndp : 2004-06-30 at 04:29 PM. Reason: Placed routine in code tags |
|
|
|
|
|
#3 |
|
Vice President / Director
Join Date: 2000-09
Location: Kenosha Wisconsin
Posts: 375
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Just for the other way of doing this...
Code:
(defun C:AddNewBlock (/ objNewBlock)
(setq objNewBlock (vla-add
(vla-get-blocks
(vla-get-activedocument
(vlax-get-acad-object)
)
)
(vlax-3d-point (list 0.0 0.0 0.0))
"MyNewBlock"
)
)
(print "x")
(vla-addattribute objNewBlock
(/ (getvar "dimscale") 10.0)
8
"UserPrompt"
(vlax-3d-point (list 0.0 0.0 0.0))
"UserTagString"
"UsertTextValue"
)
)
|
|
|
|
|
|
#4 |
|
Member
Join Date: 2001-12
Posts: 29
![]() |
Thank you for you responses. Works great.
|
|
|
|
![]() |
|
||||||
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Multiview Block edit | BCrouse | ACA Wish List | 6 | 2004-11-25 04:42 AM |
| Block Changes | cgraham | ACA General | 2 | 2004-06-30 01:17 PM |
| Adding layer intelligence to a Block | cadconcepts | AutoLISP | 4 | 2004-06-22 07:56 PM |
| Scaling Points in Block | jcronburg | ACA General | 3 | 2004-06-10 07:21 PM |
| glass block and view range | sfaust | Revit Architecture - Families | 2 | 2004-04-09 03:18 AM |