Jump to content

Need Explaination (DXF Codes)


guitarguy1685

Recommended Posts

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?

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

  • 8 years later...
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

 

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...