Page 1 of 1

Entmake

Posted: Fri Nov 16, 2001 2:12 am
by BoganS
Does anyone know how to make a block using the entmake command, but rather than explicitly entering it eg.(entmake '((0 . "BLOCK")(2 . "BLOCK_NAME")(10 0.0 0.0 0.0).. I would like to use a variable for the block name. I've tried CONS but it didn't seem to work.

Any help would be greatly appreciated.

Sean

Posted: Fri Nov 16, 2001 5:05 am
by avaernes
You should have no problem using CONS if you are otherwise creating it correctly. Creating a complex entity using entmake is complicated - have a look at this page:

http://www.autodesk.co.kr/support/techd ... 38,00.html

Posted: Wed Nov 28, 2001 1:18 am
by BoganS
Thanks Avaernes but that URL didn't quite explain how to solve my problem. I think I did figure it out though (at least it works). It seems entmake won't allow the use of variables in the association list that follows, but it will however allow one variable which contains the entire list of the entity your making. So first you create the list assigned to a variable eg: (setq my_new_entity (list (cons 0 "INSERT")(cons 2 my_variable_for_block_name)(cons 10 PkPnt_1)(cons 41 Size)(cons 42 Size)(cons 50 Angle3)). Now you (entmake my_new_entity). I don't know if my theory is correct but it works like a charm.

Posted: Wed Nov 28, 2001 1:05 pm
by avaernes
You have to explain to me what it is that works. A block as I know it is a complex entity (holding one or more subentities). A single entmake call won't create a complex entity, just a simple entity (a layer, a line, a circle etc.) I don't understand what you are creating using a simple entmake statement to create a block. Where are the entities in the block???

Posted: Sun Dec 02, 2001 10:18 pm
by BoganS
Sorry for leaving you in a state of bewilderment like that avaernes. Your right the initial entmake should have (cons 70 64) at the end to indicate that elements follow, then a series of entmake statements for each element, ending with (entmake '((0 . "SEQEND")))(entmake '((0 . "ENDBLK"))). I was just too lazy to type it all out.

What I'm trying to do is a door creation program that allows the user to define some of the characteristics of the door (size, cw or ccw, steel, wood, glass etc.) in a dialogue box and name the block using STRCAT based on the selected items. I have no idea what the name of the block will eventually be because of the number of possibilties, so my problem was, I was trying to entmake something I didn't know the name of.

I'm hoping that once this works I can later (some time before the end of the decade) make a Door Schedule Creation program whereby I can use the name of the block to fill in most of the schedule information.

Cheers,

Sean

Posted: Mon Dec 03, 2001 1:32 am
by JLi
Hi,

Her is probably what your looking for:

;------------------------------------------------------------------+
; JLi, 2.12.2001
; Block example.
;------------------------------------------------------------------+

(defun *error* (msg)
(princ "\nerror: ")
(princ msg)
(terpri)
)

(defun c:blokk_test ()

(setvar "cmdecho" 0)
(setq st_pt(getpoint "\nStart Point > "))

(setq pt2(polar st_pt 0 10))
(setq sset1 (ssadd))

; Just some graphics
(repeat 4
(setq pt3 "@10<90")
(setq pt4 "@10<180")
(command "pline" st_pt pt2 pt3 pt4 "close")
; Adding enities
(ssadd (entlast) sset1)
(setq st_pt pt2)
(setq pt2(polar st_pt 0 10))
)


; Block name: block_1, block_2, block_3 etc.
(setq no_i 1)
(setq block_name (strcat "block_" (itoa no_i)) )

(if (= (tblsearch "BLOCK" block_name) nil) (progn
(setq block_name (strcat "block_" (itoa no_i)))
)(progn
(while (/= (tblsearch "BLOCK" block_name) nil)
(setq no_i (+ no_i 1))
(setq block_name (strcat "block_" (itoa no_i)))
); end while
)
);end if

; Making block
(command "block" block_name "0,0" sset1 "")
; Inserting block
(command "insert" block_name "0,0" "" "" "")

(setvar "cmdecho" 1)
(princ)
)

JLi.

Posted: Mon Dec 03, 2001 2:10 am
by avaernes
I have written a door creation program which is already available at this site. It creates blocks which are named according to the characteristics of the door created. Have a look at it, maybe it can save you some programming time. I believe it could also serve as a starting point for the door schedule program you mention.

DDMDOOR v2.1

Or go to the Bonus section of this forum, select "all topics" to see a screenshot of the program.

Posted: Wed Dec 05, 2001 7:47 pm
by BoganS
Thanks avaernes I haven't tried it out yet, but from the looks of the interface you obviously put a lot of thought into this. It does everything I wanted to do and more (I just hope it does metric). Nice job
Cheers,
Sean

Posted: Thu Dec 13, 2001 7:02 pm
by BoganS
avaernes I finally had a chance to try out your door creation program. WOW! You are definitely the Grand Wazoo of door creation programs. I think you covered just about everything possible, except maybe a selectable option for a header to be shown on the ceiling plan. I think the program would have been about twice the size if you had used the entmake route (which I was speaking of), so maybe its not such a good idea to use it in some cases.

Before I can start writing my Nobel award winning door schedule creator program I need to know your block naming scheme. Here's a sample:

D1020100-690-00

I presume the D is for door and the 690 is the leaf size but I'm not certain what the code in between is or the last two numbers. If you could give me a hint I'd be very appreciative.

With the amount of information you've included with each door it should be possible to create a program to automate production of an elevation or even a 2D to 3D generator, and possibly include an updateable selection of door leaf templates. Anyway...just an idea.

Thanks again. Its hard to believe you let this go for free.
Sean

Posted: Fri Dec 14, 2001 3:20 pm
by avaernes
The block name is constructed the following way:

D1020100-690-00

D=Door
1=Type (integer 1-4 representing the available types)
0=Gap size (any integer, in this case 0)
2=Mode (integer 1-4 repesenting available modes)
0=Detail option 1 (0/1 = on/off)
1=Detail option 2 (0/1 = on/off)
0=Detail option 3 (0/1 = on/off)
0=Detail option 4 (0/1 = on/off)
-
690=Door size
-=Decimal separator (. not allowed in block names)
00=Decimal places (not generally needed, but you never know...)

The point of this level of detail is of course to avoid door blocks to update other door blocks when they are not supposed to.

The template files are completely configureable. Look for the file "ddmdoor.txt", it has a brief description of how this is done.