(entmake '((0 . "CIRCLE") (62 . 1) (10 4.0 4.0 0.0) (40 . 1.0)))
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 (http://en.togores.net/home-vlisp). There you'll find examples for Xlines, blocks and layers...
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)
(entget (car (entsel)))
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
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...
(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)?(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. ;)(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? (mapcar
'(lambda (x / slst)
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.
togores, thanks for your reply also. I have bookmarked your website and plan on reading through it. The XLINE example was very informative.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 (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.
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?
_$ (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)
(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)?
_$ (setq pt1 '(1 2 3))
(1 2 3)
_$ (cons 10 pt1)
(10 1 2 3)
_$ '(10 . pt1)
(10 . PT1)
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. ;)
_$ (progn (setq a 10.0 b 6.0) (/ a b))
1.66667
(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)
)
Code: [Select](append
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?
(list
'(000 . "LWPOLYLINE")
'(100 . "AcDbEntity")
'(100 . "AcDbPolyline")
(cons 90 (length lst))
'(070 . 0)
)
(reverse lst)
)
Also, is the (list) function the only argument that (append) handles?
There are only certain entity types where the order of the code is imperative.You have the MESH also.
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 )
It seems the ATTRIBUTES like to stay where they where created.....
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,
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.