guitarguy1685 Posted December 23, 2009 Share Posted December 23, 2009 So I saw this lisp to explode Groups on these forums. It works great and I wanted to learn how it was done. I understand all the functions but the DXF codes really leave me lost. (defun c:GX (/ entg grp grpent grpname) (setq entg (entget (car (entsel "\nSelect an entity grouped: ")))) (setq grp (entget (cdr (assoc 330 entg)))) ;;;extracts entity data (setq grpent (entget (cdr (assoc 330 grp)))) ;;;selects group object (setq grpname (handent (cdr (assoc 5 grp)))) ;;;gets entity group name (entdel grpname);explodes the group (princ) ) This is how I understand it so far. line 1: entsel will select an entity. car will retieve the name of the entity, enget will retrieve all the dxf codes associated with the entity name. Finally all the dxf codes will be saved as variable ENTG the value of entg looks likethis ((-1 . <Entity name: 7ef03488>) (0 . "LWPOLYLINE") (5 . "171") (102 . "{ACAD_REACTORS") ([color=Red]330 . <Entity name: 7ef03698>[/color]) (102 . "}") (330 . <Entity name: 7ef01cf8>) (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 . "0") (100 . "AcDbPolyline") (90 . 4) (70 . 1) (43 . 0.0) (38 . 0.0) (39 . 0.0) (10 9.84165 9.44988) (40 . 0.0) (41 . 0.0) (42 . 0.0) (10 11.2882 9.44988) (40 . 0.0) (41 . 0.0) (42 . 0.0) (10 11.2882 7.64769) (40 . 0.0) (41 . 0.0) (42 . 0.0) (10 9.84165 7.64769) (40 . 0.0) (41 . 0.0) (42 . 0.0) (210 0.0 0.0 1.0)) line 2: This is where I'm lost. I see (assoc 330 entg) I'm assuming this value (330) is the name of the group that it belongs to? How am I supposed to know that? Moving on, I understand that cdr will produce the entity name of 330. then again entget will produce the DXF codes of entity name of 330 and save it to variable GRP. Value of GRP looks like this. ((-1 . <Entity name: 7ef03698>) (0 . "GROUP") (5 . "1B3") (102 . "{ACAD_REACTORS") ([color=Red]330 . <Entity name: 7ef01c68>[/color]) (102 . "}") ([color=Red]330 . <Entity name: 0>[/color]) (100 . "AcDbGroup") (300 . "") (70 . 1) (71 . 1) (340 . <Entity name: 7ef03498>) (340 . <Entity name: 7ef03490>) (340 . <Entity name: 7ef03488>)) Notice there are 2 values for code #330. Why? I understand the majority of the lisp except for using those DXF Codes. I feel I could make some useful lisp using entity selection function if I just know what those damn codes mean. Can anyone explain? Quote Link to comment Share on other sites More sharing options...
SteveK Posted December 23, 2009 Share Posted December 23, 2009 I find I've been able to do many things with lisp without knowing all the dxf codes. My novice advice, just read up on the dxf codes you'll want to use, ie colour, size, type, etc and don't worry about the rest. I did have a great link to dxf codes but it's a work unfortunately. This site's quite helpful. And there's http://www.afralisp.net/lispa/dxf.htm Quote Link to comment Share on other sites More sharing options...
JohnM Posted December 23, 2009 Share Posted December 23, 2009 Learning DXF codes will help you to be a better programmer. In AutoCAD click the help menu and select Developers help then research DXF Group Codes. A lot of entities share common DXF codes like code 8 = layer . there is a page in the help files that you can select a entity type like LINE and it will display the DXF codes with explanation. Learning how to navigate the help files and saving favorite links in help will get you there faster. I always have to refer to my DXF reference links when I program Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted December 23, 2009 Share Posted December 23, 2009 I suppose it depends what way you want to tackle a problem, many problems are approachable via Visual LISP methods, but can also be accoplished using DXF code changes. Quote Link to comment Share on other sites More sharing options...
CAB Posted December 25, 2009 Share Posted December 25, 2009 You may find this of interest: http://www.autodesk.com/techpubs/autocad/acad2000/dxf/index.htm Oops, looks like Steve had that covered. Quote Link to comment Share on other sites More sharing options...
guitarguy1685 Posted December 30, 2009 Author Share Posted December 30, 2009 thx i'll take a look Quote Link to comment Share on other sites More sharing options...
derek2032 Posted November 30, 2018 Share Posted November 30, 2018 On 12/23/2009 at 9:51 AM, SteveK said: I find I've been able to do many things with lisp without knowing all the dxf codes. My novice advice, just read up on the dxf codes you'll want to use, ie colour, size, type, etc and don't worry about the rest. I did have a great link to dxf codes but it's a work unfortunately. This site's quite helpful. And there's http://www.afralisp.net/lispa/dxf.htm Just wanted to update Steve K's Link to Afralisp dxf Codes. https://www.afralisp.net/reference/dxf-group-codes.php Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.