Author Topic: When to use entmake?  (Read 9592 times)

0 Members and 1 Guest are viewing this topic.

StykFacE

  • Guest
When to use entmake?
« on: March 01, 2013, 11:58:29 AM »
I was digging around in the AutoCAD Developer's section and saw the example they provided with (entmake):
Code: [Select]
(entmake '((0 . "CIRCLE") (62 . 1) (10 4.0 4.0 0.0) (40 . 1.0)))
Does (entmake) only create static objects, or can I use something like (getpoint) to get user input on where to place the object? Also, is using DXF codes a thing of the past or is there more efficient ways on setting each property?

Thanks in advance.

dgorsman

  • Water Moccasin
  • Posts: 2437
Re: When to use entmake?
« Reply #1 on: March 01, 2013, 12:22:46 PM »
(entmake ...) is useful when you don't want to make (command ...) calls, or want to create large numbers of objects.  The arguments are a list of lists, which can be constructed programmatically while iterating over another list e.g. keep the object type, radius, layer, etc. the same while iterating over a list of coordinates; each cycle through builds a new list (or swaps out the coordinate list item) with the appropriate values, and fires it off with the (entmake ...).

DXF coding is still required for (entmake ...).  Personally, I find it useful as an indicator of expected values, and *usually* useful for pulling out specific items with (assoc ...).  The other way would be with Visual LISP, calling (vla-AddCircle ...) with appropriate arguments.  And thats a whole other ball of wax-like substance.
If you are going to fly by the seat of your pants, expect friction burns.

try {GreatPower;}
   catch (notResponsible)
      {NextTime(PlanAhead);}
   finally
      {MasterBasics;}

StykFacE

  • Guest
Re: When to use entmake?
« Reply #2 on: March 01, 2013, 02:31:15 PM »
Thanks dgorsman. By chance, do you have any quick and easy examples? Anything will do, just so I can play with it a bit. <---- (out of context opportunity)

togores

  • Guest
Re: When to use entmake?
« Reply #3 on: March 01, 2013, 05:08:36 PM »
By chance, do you have any quick and easy examples? Anything will do, just so I can play with it a bit.
Hi StykFacE, take a look at my website posts in http://en.togores.net/home-vlisp. There you'll find examples for Xlines, blocks and layers...
Entmake is very powerful. For example, entmaking an entity with a given layer name will not only create an entity, but will also create the layer and place the entity in that layer. See the XLINE example.

Lee Mac

  • Seagull
  • Posts: 12913
  • London, England
Re: When to use entmake?
« Reply #4 on: March 01, 2013, 05:49:15 PM »
Hi Tannar,

The option of whether to use entmake[x] / command calls / ActiveX mostly depends on the application; entmake[x] is the certainly the fastest method for entity generation in AutoLISP, furthermore, many properties (e.g. Layer, Linetype, Lineweight, Colour etc.) may be set simultaneously through their relevant DXF groups in the data supplied to entmake[x], (whereas you would need to modify every property separately if using Visual LISP (vla-put-layer, vla-put-linetype, vla-put-color etc.). I also find it easier to account for changes in UCS when using entmake[x].

Since you were looking for simple examples, here are some simple programs for you to look over:
Code - Auto/Visual Lisp: [Select]
  1. (defun c:myline ( / pt1 pt2 )
  2.     (if (setq pt1 (getpoint "\nSpecify First Point: "))
  3.         (while (setq pt2 (getpoint "\nSpecify Next Point: " pt1))
  4.             (entmake
  5.                 (list
  6.                    '(0 . "LINE")
  7.                     (cons 10 pt1)
  8.                     (cons 11 pt2)
  9.                 )
  10.             )
  11.             (setq pt1 pt2)
  12.         )
  13.     )
  14.     (princ)
  15. )
  16.  
  17. (defun c:mycircle ( / cen rad )
  18.     (if
  19.         (and
  20.             (setq cen (getpoint "\nSpecify Center: "))
  21.             (setq rad (getdist  "\nSpecify Radius: " cen))
  22.         )
  23.         (entmake
  24.             (list
  25.                '(0 . "CIRCLE")
  26.                 (cons 10 cen)
  27.                 (cons 40 rad)
  28.             )
  29.         )
  30.     )
  31.     (princ)
  32. )
  33.  
  34. (defun c:mypoint ( / pt1 )
  35.     (while (setq pt1 (getpoint "\nSpecify Point: "))
  36.         (entmake
  37.             (list
  38.                '(0 . "POINT")
  39.                 (cons 10 pt1)
  40.             )
  41.         )
  42.     )
  43.     (princ)
  44. )
  45.  
  46. (defun c:mypline ( / pt1 pt2 lst )
  47.     (if (setq pt1 (getpoint "\nSpecify First Point: "))
  48.         (progn
  49.             (setq lst (list (cons 10 pt1)))
  50.             (while (setq pt2 (getpoint "\nSpecify Next Point: " pt1))
  51.                 (setq lst (cons (cons 10 pt2) lst)
  52.                       pt1 pt2
  53.                 )
  54.             )
  55.             (entmake
  56.                 (append
  57.                     (list
  58.                        '(000 . "LWPOLYLINE")
  59.                        '(100 . "AcDbEntity")
  60.                        '(100 . "AcDbPolyline")
  61.                         (cons 90 (length lst))
  62.                        '(070 . 0)
  63.                     )
  64.                     (reverse lst)
  65.                 )
  66.             )
  67.         )
  68.     )
  69.     (princ)
  70. )
  71.  

Please note that, to keep things simple, the above programs use the minimum DXF groups to generate the entity (i.e. the entities will be created on the current layer, with colour set to CECOLOR, linetype set to CELTYPE etc.), and the above programs also do not account for changes in the UCS as I didn't want to overwhelm you with information at this stage.

If you have any questions about anything in this post, just ask and I'll be happy to explain.
« Last Edit: March 01, 2013, 05:53:14 PM by Lee Mac »

Lee Mac

  • Seagull
  • Posts: 12913
  • London, England
Re: When to use entmake?
« Reply #5 on: March 01, 2013, 05:56:43 PM »
You might also find this post useful to demonstrate the differences between the various methods:

http://www.theswamp.org/index.php?topic=38964.msg441260#msg441260

DEVITG

  • Bull Frog
  • Posts: 480
Re: When to use entmake?
« Reply #6 on: March 01, 2013, 07:51:04 PM »
Thanks dgorsman. By chance, do you have any quick and easy examples? Anything will do, just so I can play with it a bit. <---- (out of context opportunity)

I have it simple  lisp to get the dxf code for an entity

Code: [Select]
(entget (car (entsel)))
It give the list for any enty , some code can not be stated , like  5 , handle , it is a read only , it can not be assigned, some are redundant

Location @ Córdoba Argentina Using ACAD 2019  at Window 10

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: When to use entmake?
« Reply #7 on: March 01, 2013, 09:33:29 PM »
Here is one to try:
Code - Auto/Visual Lisp: [Select]
  1. (defun c:myentget+ (/ ent elst)
  2.   (if (and (setq ent (car (entsel "\nSelect entity to list.")))
  3.            (setq elst (entget ent '("*"))))
  4.     (progn
  5.       (textscr)
  6.       (princ "\n>>>------>  ")
  7.       (princ (vlax-ename->vla-object ent))
  8.       (mapcar 'print elst)
  9.       (mapcar
  10.         '(lambda(x / slst)
  11.       (if (and (assoc x elst)
  12.                (setq slst (entget (cdr (assoc x elst)))))
  13.         (progn
  14.           (prompt (strcat "\n\n*******  Dump DXF "(itoa x)" listing  *********"))
  15.           (foreach n slst (print n))
  16.         )
  17.       )
  18.            )
  19.         '(330 340)) ; '(320 330 340 350 360))
  20.     )
  21.   )
  22.   (princ)
  23. )
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: When to use entmake?
« Reply #8 on: March 01, 2013, 09:37:07 PM »
This may be of interest too.
----------  Entmake   ----------------------
http://www.theswamp.org/index.php?topic=31145.0  ENTMAKE function by CAB
http://www.theswamp.org/index.php?topic=4814.msg112107#msg112107 
http://www.theswamp.org/index.php?topic=17445.0  Min codes
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

xiaxiang

  • Guest
Re: When to use entmake?
« Reply #9 on: March 02, 2013, 12:21:02 AM »
hi,Lee
It should be more wonderful if you can teach us how to use entmake correctly in the UCS,including insertpoint,rotation,etc
Regards, Xia

David Bethel

  • Swamp Rat
  • Posts: 656
Re: When to use entmake?
« Reply #10 on: March 02, 2013, 08:06:06 AM »
I prefer ( entmake ) for most parametric routines.  It gives you a lot more control.

Some gotchas are the defaults if a group code is missing.

Code: [Select]
                DXFIN        Entmake      Command
   6 Linetype  BYLAYER      CELTYPE      CELTYPE
  39 Thickness  0.0        THICKNESS     THICKNESS
  48 LTScale    1.0        CELTSCALE     CELTSCALE
  62 Color     BYLAYER      CECOLOR       CECOLOR
 210 UCS        WCS           WCS        Current UCS
 

Most of the documentation was made for DXFIN formats

One rule for entmake is that DXF group 0 must the fist listed.

They both have there pluses and drawbacks.  For example (command "_.INSERT" ...) must take into consideration whether the BLOCK has attributes.  Both need to address this, but in totally different methods.

As to the UCS  (cons 210 (trans '(0 0 1) 1 0) would ensure that entity is made in the current UCS.  The problem here is that many entities need WCS values only ( POINTs, LINEs, 3DFACEs, and POLYLINE meshes. And things like 3DFACEs do not have group 210


-David
R12 Dos - A2K

StykFacE

  • Guest
Re: When to use entmake?
« Reply #11 on: March 02, 2013, 09:20:54 AM »
If you have any questions about anything in this post, just ask and I'll be happy to explain.
Wow, such great responses!! Thanks to all. Lee, I will take you up on your offer. First, what's crazy to me, is for some reason I can actually follow the code. I guess me trolling through these forums and monkeying with enough code through the years is beginning to pay off a little. Weird...

Anyways, on to my questions.

Code: [Select]
(cons 10 pt1)(cons) is used to to take the user input from pt1, combine it with 10 to turn it into a dotted pair to generate the necessary syntax for the DXF code, correct? Why no apostrophe when using (cons)?

Code: [Select]
(progn)Reading the documentation I can't follow exactly what this function does. I read it, but just doesn't click for me? Hoping to get more insight from you if you wouldn't mind. ;)

Code: [Select]
(append
  (list
    '(000 . "LWPOLYLINE")
    '(100 . "AcDbEntity")
    '(100 . "AcDbPolyline")
     (cons 90 (length lst))
    '(070 . 0)
  )
  (reverse lst)
)
The (append) function is new to me, but after reading up on the documentation I think I follow. In your other lists from the first three main routines, you used multiple arguments but did not append them. Any particular reason you did on the c:mypline routine? Also, is the (list) function the only argument that (append) handles?

CAB, question for you my friend.
Code: [Select]
(mapcar
  '(lambda (x / slst)

Of all the code through the years I've monkeyed around with, I see the (mapcar) and (lambda) functions used a lot. After reading the documentation I'm assuming that the (lambda) function is just defining a function "on the fly" so to speak? I noticed that the x and slst symbols aren't localized at the beginning of the routine. Is this why the (lambda) function is used? To focus on the spot it's intended to be used, like the documentation states?

One rule for entmake is that DXF group 0 must the fist listed.
David, thank you for the gotcha's and tips. One quick question, is there any area of the documentation that defines the "rules" for properly formatting the DXF codes? I read from a post on another site the other day that DXF codes are to be listed in proper order. Sure enough, I tested Lee Mac's code above last night, mixed the DXF Group Code order in the list and things went wonky on me. The reason I ask is because I see there are common group codes and entity group codes, and I'm not sure on which codes go where when they're combined.

Very big thanks to all! :kewl:
« Last Edit: March 02, 2013, 09:28:12 AM by StykFacE »

StykFacE

  • Guest
Re: When to use entmake?
« Reply #12 on: March 02, 2013, 09:29:36 AM »
By chance, do you have any quick and easy examples? Anything will do, just so I can play with it a bit.
Hi StykFacE, take a look at my website posts in http://en.togores.net/home-vlisp. There you'll find examples for Xlines, blocks and layers...
Entmake is very powerful. For example, entmaking an entity with a given layer name will not only create an entity, but will also create the layer and place the entity in that layer. See the XLINE example.
togores, thanks for your reply also. I have bookmarked your website and plan on reading through it. The XLINE example was very informative.

David Bethel

  • Swamp Rat
  • Posts: 656
Re: When to use entmake?
« Reply #13 on: March 02, 2013, 09:43:11 AM »
Tanner,

I haven't really found any what I would call documentation

There are only certain entity types where the order of the code is imperative.

LWPLOLYLINES
  Group 90 must be stated before group 10s
  Groups 10 41 42 declare the order of the points, so it imperative they are listed in the proper order.


Others would include SPLINEs MLINEs ( if you dare )

In general the group 0 1st is always the case

Here is simple box using parametric values


Code - Text: [Select]
  1. (setq x 20 y 30 z 40)
  2. (entmake (list (cons 0 "POLYLINE")(cons 66 1)(cons 10 (list 0 0 0))(cons 70 16)(cons 71 6)(cons 72 3)))
  3. (entmake (list (cons 0 "VERTEX")(cons 10 (list x 0 z))(cons 70 64)))
  4. (entmake (list (cons 0 "VERTEX")(cons 10 (list x 0 0))(cons 70 64)))
  5. (entmake (list (cons 0 "VERTEX")(cons 10 (list x 0 0))(cons 70 64)))
  6. (entmake (list (cons 0 "VERTEX")(cons 10 (list 0 0 z))(cons 70 64)))
  7. (entmake (list (cons 0 "VERTEX")(cons 10 (list 0 0 0))(cons 70 64)))
  8. (entmake (list (cons 0 "VERTEX")(cons 10 (list 0 0 0))(cons 70 64)))
  9. (entmake (list (cons 0 "VERTEX")(cons 10 (list 0 y z))(cons 70 64)))
  10. (entmake (list (cons 0 "VERTEX")(cons 10 (list 0 y 0))(cons 70 64)))
  11. (entmake (list (cons 0 "VERTEX")(cons 10 (list 0 0 0))(cons 70 64)))
  12. (entmake (list (cons 0 "VERTEX")(cons 10 (list x y z))(cons 70 64)))
  13. (entmake (list (cons 0 "VERTEX")(cons 10 (list x y 0))(cons 70 64)))
  14. (entmake (list (cons 0 "VERTEX")(cons 10 (list x 0 0))(cons 70 64)))
  15. (entmake (list (cons 0 "VERTEX")(cons 10 (list x y z))(cons 70 64)))
  16. (entmake (list (cons 0 "VERTEX")(cons 10 (list x y z))(cons 70 64)))
  17. (entmake (list (cons 0 "VERTEX")(cons 10 (list x 0 z))(cons 70 64)))
  18. (entmake (list (cons 0 "VERTEX")(cons 10 (list 0 y z))(cons 70 64)))
  19. (entmake (list (cons 0 "VERTEX")(cons 10 (list 0 y z))(cons 70 64)))
  20. (entmake (list (cons 0 "VERTEX")(cons 10 (list 0 0 z))(cons 70 64)))
  21. (entmake (list (cons 0 "SEQEND")))
  22.  

You could change the order of any of the header values save group 0.

Simply change to x y & z values as needed

I wouldn't want to try making this on a command sequence.

Have fun!  -David

R12 Dos - A2K

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Lee Mac

  • Seagull
  • Posts: 12913
  • London, England
Re: When to use entmake?
« Reply #15 on: March 02, 2013, 11:04:26 AM »
You're very welcome Tannar, I'll to try to explain as best I can:

Code: [Select]
(cons 10 pt1)
(cons) is used to to take the user input from pt1, combine it with 10 to turn it into a dotted pair to generate the necessary syntax for the DXF code, correct?

Almost. cons is indeed combining the point input assigned to the variable pt1 with the DXF Group 10 integer code, however, in this case a dotted pair is not returned since the second argument of the cons function is a list, not an atom.

Consider the following examples:
Code: [Select]
_$ (cons 1 2)
(1 . 2)
_$ (cons "a" "b")
("a" . "b")
_$ (cons 1 '(2 3 4))
(1 2 3 4)
_$ (cons '(1 2 3) 4)
((1 2 3) . 4)
_$ (cons '(1 2 3) '(4 5 6))
((1 2 3) 4 5 6)

Notice that a dotted pair is only returned if the second cons argument is an atom (excluding nil, since although nil is considered both an atom and an empty list, cons considers nil an empty list).

If the second argument supplied to cons is a list, the first argument is added to the front of the list - you see this a lot when constructing a list within a loop, e.g.:
Code: [Select]
(foreach x '(0 1 2 3 4 5)
    (setq lst (cons x lst))
)
_$ lst
(5 4 3 2 1 0)

Why no apostrophe when using (cons)?

The apostrophe (or quote) is used to mark an expression or symbol as a literal, to be taken at 'face-value' and not evaluated. In this case we need to evaluate the variable pt1 to obtain the point value assigned to the symbol, and so cons must be used. If the apostrophe is used instead, the pt1 symbol is not evaluated:
Code: [Select]
_$ (setq pt1 '(1 2 3))
(1 2 3)
_$ (cons 10 pt1)
(10 1 2 3)
_$ '(10 . pt1)
(10 . PT1)

For a more in-depth explanation of the apostrophe, see here.

Code: [Select]
(progn)Reading the documentation I can't follow exactly what this function does. I read it, but just doesn't click for me? Hoping to get more insight from you if you wouldn't mind. ;)

The progn function in itself doesn't actually do all that much, it simply evaluates every expression passed to it and returns the result of the last evaluation, e.g.:
Code: [Select]
_$ (progn (setq a 10.0 b 6.0) (/ a b))
1.66667

However, progn provides us with a convenient 'wrapper' in which we can evaluate multiple expressions and pass the set of expressions to be evaluated as a single argument to another function. Think of progn as creating a 'block' of code, which can then be passed to another function to be evaluated.

In my example:
Code: [Select]
(defun c:mypline ( / pt1 pt2 lst )
   (if (setq pt1 (getpoint "\nSpecify First Point: "))
       (progn
           (setq lst (list (cons 10 pt1)))
           (while (setq pt2 (getpoint "\nSpecify Next Point: " pt1))
               (setq lst (cons (cons 10 pt2) lst)
                     pt1 pt2
               )
           )
           (entmake
               (append
                   (list
                      '(000 . "LWPOLYLINE")
                      '(100 . "AcDbEntity")
                      '(100 . "AcDbPolyline")
                       (cons 90 (length lst))
                      '(070 . 0)
                   )
                   (reverse lst)
               )
           )
       )
   )
   (princ)
)

Here, if the user has correctly specified a valid point at the getpoint prompt, we then want to evaluate multiple expressions within the 'then' argument for the if function.

However, the 'then' argument will only accept a single expression to be evaluated, so the set of expressions to be evaluated are grouped within the progn function, and this single expression (the progn expression) may then be passed to the if function as a single argument.

If progn was not present, the setq expression would be taken as the 'then' argument, the while expression would be the 'else' argument, and the entmake expression would cause the if function to error with too many arguments.

Note that other functions which accept multiple arguments could equally be used as such a 'wrapper', however, other such functions will come with certain restrictions and will exhibit different behaviour, for example, although and will accept any expression, this function will cease evaluation when an expression returns a nil value (which may be unsuitable for some situations, but perhaps suitable for others); the + function could be used if all expressions to be evaluated return a numerical value... etc.

However, progn is useful in that it will accept any expression, and will simply evaluate all supplied expressions regardless of their returned value, and returning the value of the last expression evaluated.

I describe progn some more in this post.

Code: [Select]
(append
  (list
    '(000 . "LWPOLYLINE")
    '(100 . "AcDbEntity")
    '(100 . "AcDbPolyline")
     (cons 90 (length lst))
    '(070 . 0)
  )
  (reverse lst)
)
The (append) function is new to me, but after reading up on the documentation I think I follow. In your other lists from the first three main routines, you used multiple arguments but did not append them. Any particular reason you did on the c:mypline routine?

In the other programs, the number of parameters is known and fixed: to create the Line we have two point variables; for the Circle we have a point variable and a numerical variable; for the Point we have a single point variable; however, for the LWPolyline, the number of parameters is unknown since the while loop allows the user to continuously pick points in the drawing.

Hence, rather than assigning every picked point to a separate variable, it is far easier and convenient to collect the points into a list and then append this list to the DXF data list supplied to entmake.

Also, is the (list) function the only argument that (append) handles?

Note that the list function is not being passed to the append function as an argument; the result of evaluating the list function forms the argument for the append function.

append will accept any number of list arguments and will return the result of appending the supplied lists into a single list. Whether the supplied lists are constructed using list, cons (not dotted pair), vl-list*, or are a quoted literal list makes no difference, since a list argument is supplied in all cases.
« Last Edit: March 02, 2013, 11:11:06 AM by Lee Mac »

snownut2

  • Swamp Rat
  • Posts: 971
  • Bricscad 22 Ultimate
Re: When to use entmake?
« Reply #16 on: March 02, 2013, 10:28:47 PM »
Not to Hi-Jack this thread, just let me know if I should start a new one. 
With ENTMAKE "INSERT", how do I get a block w/ATTRIBUTES to place the attributes in the proper location and Rotation Angle as the rest of the line work etc.

It seems the ATTRIBUTES like to stay where they where created.....

See the following code, for the method I am using.


Code - Auto/Visual Lisp: [Select]
  1.  (defun ABLKInsert (BlockName / Ename NextEnt Data Attdefs)
  2.   (cond
  3.     ((setq Ename (tblobjname "block" BlockName))        ;; get Parent entity name
  4.      (setq NextEnt (entnext Ename))                     ;; first sub entity
  5.  
  6.      (while NextEnt                                     ;; get ATTDEF subentities
  7.        (setq Data (entget NextEnt))
  8.        (if (= "ATTDEF" (cdr (assoc 0 Data)))
  9.          (setq Attdefs (cons Data Attdefs))
  10.          )
  11.        (setq NextEnt (entnext NextEnt))
  12.        )
  13.      (setq attblk (if (= nil attdefs) 0 1))
  14.      (and
  15.        (entmake (list '(0 . "INSERT")
  16.                       '(100 . "AcDbBlockReference")
  17.                        (cons  8 Lname    )              ;; layer name
  18.                        (cons 66 attblk   )
  19.                        (cons  2 BlockName)
  20.                        (cons 10 blkIP)          ;; Insert Point
  21.                        (cons 41 1.0)
  22.                        (cons 42 1.0)
  23.                        (cons 43 1.0)
  24.                        (cons 50 0  )))          ;; Rotation angle default = 0
  25.      (foreach x (reverse Attdefs)               ;; entmake ATTRIBs based on ATTDEFS
  26.        (entmake
  27.          (list  '(0 . "ATTRIB")
  28.                 (assoc  8 x)
  29.                 (assoc 10 x)
  30.                 (assoc 40 x)
  31.                 (assoc  1 x)
  32.                 (assoc 50 x)
  33.                 (assoc 41 x)
  34.                 (assoc 51 x)
  35.                 (assoc  7 x)
  36.                 (assoc 11 x)
  37.                 (assoc  2 x)
  38.                 (assoc 70 x)
  39.                 (assoc 71 x)
  40.                 (assoc 72 x)
  41.                 (assoc 73 x)
  42.                 (assoc 74 x)
  43.                 ))
  44.        )
  45.        (entmake '((0 . "SEQEND")(8 . "0")))    ;; entmake SEQEND
  46.        )
  47.      )
  48.     (T nil)
  49.     )
  50.   (setq ent (entlast))
  51.   )

With this one function plain blocks or blocks with multiple attributes can be inserted.  However the attribute's inserted location is not correct.

« Last Edit: March 02, 2013, 10:31:56 PM by snownut2 »

togores

  • Guest
Re: When to use entmake?
« Reply #17 on: March 03, 2013, 05:31:33 AM »
There are only certain entity types where the order of the code is imperative.
LWPLOLYLINES
  Group 90 must be stated before group 10s
  Groups 10 41 42 declare the order of the points, so it imperative they are listed in the proper order.
Others would include SPLINEs MLINEs ( if you dare )
You have the MESH also.
For a detailed explanation on entmaking mesh entities you can see my class at Autodesk University 2012:
http://au.autodesk.com/?nd=class&session_id=10671
You have to register to watch the class. There are a handout and a dataset that can be downloaded.
It is composed by 8 Video Modules, explanation starts from scratch.
By the way I believe it is the first time this has been documented and published, enjoy!

David Bethel

  • Swamp Rat
  • Posts: 656
Re: When to use entmake?
« Reply #18 on: March 03, 2013, 06:22:14 AM »
It seems the ATTRIBUTES like to stay where they where created.....

Getting an ATTRibute correct is a VERY complex  procedure

You will need to take into consideration :

FROM THE BLOCK TABLE
  • INSBASE of the block - group 10 of the BLOCK table definition
  • groups 10 & 11 of the ATTDEF
  • group 41 of the ATTDEF
  • group 50 of the ATTDEF
  • groups 72 & 74 of the ATTDEF
FROM THE INSERT:
  • the insert point of the INSERT
  • the rotation of the INSERT
  • the X Y & Z scales of the INSERT
  • the UCS of the INSERT
The correct point would be the translation of all of these factors.  Not something that I would want to consider, so here the (command) sequence makes a lot more sense. 

Even if you force the ATTRbute to "'", you can go back with (entlast) and the populate the values.

My $0.02  -David


Oh I forgot !
  • UCS group 210 of the ATTDEF
« Last Edit: March 03, 2013, 08:14:40 AM by David Bethel »
R12 Dos - A2K

pBe

  • Bull Frog
  • Posts: 402
Re: When to use entmake?
« Reply #19 on: March 03, 2013, 07:32:50 AM »


The option of whether to use entmake[x] / command calls / ActiveX mostly depends on the application; entmake[x] is the certainly the fastest method for entity generation in AutoLISP,


I concur and its AutoCAD Mac versions friendly. (pun intended)  :)


Lee Mac

  • Seagull
  • Posts: 12913
  • London, England
Re: When to use entmake?
« Reply #20 on: March 04, 2013, 12:09:23 PM »
Were my explanations comprehensible Tannar?  :-)

StykFacE

  • Guest
Re: When to use entmake?
« Reply #21 on: March 04, 2013, 12:12:42 PM »
Were my explanations comprehensible Tannar?  :-)
Absolutely!! I'm still tinkering with things but your explanations were VERY helpful. CAB's homework links also were super beneficial, too.

I've already got some more questions jotted down but want to muscle through some trial and error of my own first. :kewl:

Lee Mac

  • Seagull
  • Posts: 12913
  • London, England
Re: When to use entmake?
« Reply #22 on: March 04, 2013, 12:39:05 PM »
Excellent  8-)

Ask away if you get stuck or don't understand something - it's great to see you finally plunge into the rabbit hole that is LISP  :lol: