How to draw ellipse with DXF format in AutoCAD

How to draw ellipse with DXF format in AutoCAD

Anonymous
Not applicable
2,477 Views
15 Replies
Message 1 of 16

How to draw ellipse with DXF format in AutoCAD

Anonymous
Not applicable

I want to draw ellipses in DXF format in AutoCAD

However, I encountered a problem. I used the oval group code to draw a graph, which showed "invalid graph, undefined group"

I write the group code as follows, please help to see where there is a problem, thank you very much!

0
SECTION
2
ENTITIES
0
ELLIPSE
8
0
10
0.5
20
0.0
30
0.0
11
0.5
21
0.0
31
0.0
210
0.0
220
0.0
230
1.0
40
0.5
41
-1.570796326794896
42
4.712388980384689
0
ENDSEC
0
EOF

cad.png

0 Likes
2,478 Views
15 Replies
Replies (15)
Message 2 of 16

Kent1Cooper
Consultant
Consultant

Study the DXF codes for Ellipses, >here<.  Some that I notice that don't look right for your image:

 

10/20/30 are the X/Y/Z coordinates of the center, so:

10
2.5

11/21/31 are X/Y/Z of a major axis endpoint relative to the center, so:

11
2.5

40 is the ratio of the minor axis to the major axis, so:

40

0.2

Kent Cooper, AIA
0 Likes
Message 3 of 16

Anonymous
Not applicable

Yes, 10 / 20..... 11 / 21..... 210 / 220..... 40/41/42... the meaning of these numbers is correct. I also set the ellipse according to the meaning of these numbers, but after I write these in order, it will show "object undefined group 10, line 12. Invalid or incomplete DXF input - drawing aborted. "

I don't know how to modify it, and I don't know where the problem is. What's wrong with my code? Thank you very much!

The order of the numbers is as follows:

0
SECTION
2
ENTITIES
0
ELLIPSE
8
0
100
AcDbEllipse
10
2.499999999999999
20
0.0
30
0.0
11
-2.499999999999999
21
0.0
31
0.0
210
0.0
220
0.0
230
1.0
40
0.2
41
0.0
42
6.283185307179586
0
ENDSEC
0
EOF

0 Likes
Message 4 of 16

hosneyalaa
Advisor
Advisor

 

( Entmakex ' ( ( 0  .  "Ellipse" ) 
	       ( 100  .  "Acdbentity" ) 
	       ( 67  .  0 ) 
	       ( 8  .  "0" ) 
	       ( 100  .  "Acdbellips A" ) 
	       ( 10  6745.944 2889.74  0.0 ) 
	       ( 11  - 2.5  0.0  0.0 ) 
	       ( 40  .  0.2 ) 
	       ( 41  .  0.0) 
	       ( 42  .  6.283185307179587 ) 
	       ) 
    )

 

 

 

التقاط.PNG

0 Likes
Message 5 of 16

8XXXNNJH7KT6
Autodesk
Autodesk
Based on the error you show, you are trying to read your data in as a dxf file. Is what you show in your original message your complete dxf file? If so, then that won't work because that is an entities only dxf file and AutoCAD will always treat those as R12 format files and the R12 format does not support ellipses nor does it support the group code 100.
0 Likes
Message 6 of 16

diagodose2009
Collaborator
Collaborator

Please you help me, 

How to extract block-name from

" C:\DOCUME~1\adruianb\LOCALS~1\Temp\dfn_b053.dxf"?

 

 

insert Enter block name or [?]: C:\DOCUME~1\adruianb\LOCALS~1\Temp\dfn_b053.dxf
Updating handle seed.
Units: Unitless   Conversion:   25.4000
Specify insertion point or [Basepoint/Scale/X/Y/Z/Rotate]:
Enter X scale factor, specify opposite corner, or [Corner/XYZ] <1>: X Specify X 
scale factor or [Corner] <1>: 1.0 Enter Y scale factor <use X scale factor>: 
1.0 Specify Z scale factor or <use X scale factor>: 1.0
Specify rotation angle <0.0000g>: 0.0
Command:
_.rename Enter object type to rename
[Block/Dimstyle/LAyer/LType/Material/Style/Tablestyle/Ucs/VIew/VPort]: B
Enter old block name: dfn_block_dxfrep

 

 

After

You convert anyDXF to AutoLisp, full-automatically,

---then you save this listDXF-strings to temp%file%

 

 

 

 

$rr (dfn_file_list2file nume dxfu))

 

 

 

 

You must control command-line using "(defun dfn_cmd_canceld( / $rr cx dx ch)", you search broken-input from (command-s or (command 

 

 

(defun dfn_cmd_canceld( / $rr cx dx ch)

 

 

 

 

You can insert anyDXF to list of strings or one-string-inside AutoLisp.

 

 

 

 

(Defun dfn_block_dxfrepernivelmentInit (/ rr s)
  (setq s nil)
  (if (equal dfn_block_dxfrepernivelmentS nil)
   (progn
    
;;(T206:00006600)
(setq s  ""
s  (strcat s   "\n\n\n\n  0\nSECTION\n  2\nHEADER\n  9\n$ACADVER\n  1\nAC1009\n  9\n$INSBASE\n 10\n0.00\n 20\n0.00\n 30\n0.0\n  9\n$EXTMIN\n 10\n-26.287839\n 20\n-29.278888\n 30\n0.0\n  9\n$EXTMAX\n 10\n53.731115\n 20\n45.597282\n 30\n0.0\n  9\n$LIMMIN\n 10\n0.0\n 20\n0.0\n  9\n$LIMMAX\n 10\n420.0\n 20\n297.0\n  9\n$ORTHOMODE\n 70\n     0\n  9\n$FILLMODE\n 70\n     1\n  9\n$QTEXTMODE\n 70\n     0\n  9\n$LTSCALE\n 40\n1.0\n  9\n$OSMODE\n 70\n     1\n  9\n$ATTMODE\n 70\n     ")
s  (strcat s   "1\n  9\n$TEXTSIZE\n 40\n2.5\n  9\n$TRACEWID\n 40\n1.0\n  9\n$TEXTSTYLE\n  7\nSTANDARD\n  9\n$CLAYER\n  8\n0\n  9\n$CELTYPE\n  6\nBYLAYER\n  9\n$CECOLOR\n 62\n     7\n  9\n$DIMSCALE\n 40\n1.0\n  9\n$DIMASZ\n 40\n0.18\n  9\n$DIMTAD\n 70\n     0\n  9\n$DIMZIN\n 70\n     0\n  9\n$DIMTVP\n 40\n0.0\n  9\n$DIMSTYLE\n  2\nSTANDARD\n  9\n$DIMCLRD\n 70\n     0\n  9\n$LUNITS\n 70\n     2\n  9\n$LUPREC\n 70\n     4\n  9\n$FILLETRAD\n 40\n0.0\n  9\n$AUNITS\n 70\n     2\n  9\n$AUPREC\n 70\n     4\n  9\n")
s  (strcat s   "$MENU\n  1\n.\n  9\n$ELEVATION\n 40\n0.0\n  9\n$PELEVATION\n 40\n0.0\n  9\n$THICKNESS\n 40\n0.0\n  9\n$LIMCHECK\n 70\n     0\n  9\n$TDCREATE\n 40\n2452237.06\n  9\n$TDUPDATE\n 40\n2454258.030577\n  9\n$TDINDWG\n 40\n0.028332\n  9\n$TDUSRTIMER\n 40\n0.028331\n  9\n$USRTIMER\n 70\n     1\n  9\n$ANGBASE\n 50\n270.0\n  9\n$ANGDIR\n 70\n     1\n  9\n$PLINEWID\n 40\n0.0\n  9\n$COORDS\n 70\n     0\n  9\n$SPLFRAME\n 70\n     0\n  9\n$SPLINETYPE\n 70\n     6\n  9\n$SPLINESEGS\n 70\n     8\n  9\n")
s  (strcat s   "$ATTDIA\n 70\n     0\n  9\n$ATTREQ\n 70\n     1\n  9\n$HANDLING\n 70\n     1\n  9\n$HANDSEED\n  5\n139\n  9\n$UCSNAME\n  2\n\n  9\n$UCSORG\n 10\n0.0\n 20\n0.0\n 30\n0.0\n  9\n$UCSXDIR\n 10\n1.0\n 20\n0.0\n 30\n0.0\n  9\n$UCSYDIR\n 10\n0.0\n 20\n1.0\n 30\n0.0\n  9\n$PUCSNAME\n  2\n\n  9\n$PUCSORG\n 10\n0.0\n 20\n0.0\n 30\n0.0\n  9\n$PUCSXDIR\n 10\n1.0\n 20\n0.0\n 30\n0.0\n  9\n$PUCSYDIR\n 10\n0.0\n 20\n1.0\n 30\n0.0\n  9\n$USERI1\n 70\n     0\n  9\n$USERR1\n 40\n200.0\n  9\n$WORLDVIEW\n ")
s  (strcat s   "70\n     1\n  9\n$TILEMODE\n 70\n     1\n  9\n$MAXACTVP\n 70\n    48\n  9\n$PLIMCHECK\n 70\n     0\n  9\n$PEXTMIN\n 10\n1.0E+020\n 20\n1.0E+020\n 30\n1.0E+020\n  9\n$PEXTMAX\n 10\n-1.0E+020\n 20\n-1.0E+020\n 30\n-1.0E+020\n  9\n$PLIMMIN\n 10\n0.0\n 20\n0.0\n  9\n$PLIMMAX\n 10\n420.0\n 20\n297.0\n  9\n$UNITMODE\n 70\n     0\n  9\n$VISRETAIN\n 70\n     1\n  9\n$PLINEGEN\n 70\n     0\n  9\n$PSLTSCALE\n 70\n     1\n  0\nENDSEC\n  0\nSECTION\n  2\nTABLES\n  0\nTABLE\n  2\nLTYPE\n 70\n     1\n")
s  (strcat s   "  0\nLTYPE\n  2\nCONTINUOUS\n 70\n     0\n  3\nSolid line\n 72\n    65\n 73\n     0\n 40\n0.0\n  0\nENDTAB\n  0\nTABLE\n  2\nLAYER\n 70\n     1\n  0\nLAYER\n  2\n0\n 70\n     0\n 62\n     7\n  6\nCONTINUOUS\n  0\nENDTAB\n  0\nTABLE\n  2\nSTYLE\n 70\n     1\n  0\nSTYLE\n  2\nSTANDARD\n 70\n     0\n 40\n0.0\n 41\n1.0\n 50\n0.0\n 71\n     0\n 42\n2.5\n  3\nTXT\n  4\n\n  0\nENDTAB\n  0\nENDSEC\n  0\nSECTION\n  2\nENTITIES\n  0\nCIRCLE\n  5\n71\n  8\n0\n 10\n0.0\n 20\n0.0\n 30\n0.0\n 40\n1.0\n")
s  (strcat s   "  0\nPOLYLINE\n  5\n74\n  8\n0\n 66\n     1\n 10\n0.0\n 20\n0.0\n 30\n0.0\n 40\n1.0\n 41\n1.0\n  0\nVERTEX\n  5\n258\n  8\n0\n 10\n0.3535533905932737\n 20\n-0.3535533905932744\n 30\n0.0\n 42\n0.4142135623730951\n  0\nVERTEX\n  5\n259\n  8\n0\n 10\n0.3535533905932738\n 20\n0.3535533905932731\n 30\n0.0\n  0\nSEQEND\n  5\n25A\n  8\n0\n  0\nPOLYLINE\n  5\n79\n  8\n0\n 66\n     1\n 10\n0.0\n 20\n0.0\n 30\n0.0\n 40\n1.0\n 41\n1.0\n  0\nVERTEX\n  5\n25B\n  8\n0\n 10\n-0.3535533905932737\n 20\n")
s  (strcat s   "0.3535533905932731\n 30\n0.0\n 42\n0.4142135623730951\n  0\nVERTEX\n  5\n25C\n  8\n0\n 10\n-0.3535533905932738\n 20\n-0.3535533905932743\n 30\n0.0\n  0\nSEQEND\n  5\n25D\n  8\n0\n  0\nENDSEC\n  0\nEOF\n\n\n\n#endregion\n"))
;;(/T206:00009687)

    (setq dfn_block_dxfrepernivelmentS s)
    (setq s "")
    )
  )
)

 

 

 

 

 

0 Likes
Message 7 of 16

Anonymous
Not applicable

Hello, what format do you need to write this? I'm not familiar with this part. Do 0 and "ellipse" need to be on the same line?

0 Likes
Message 8 of 16

Anonymous
Not applicable

Hello, I write the DXF code of the circle directly according to this format, then save it, change the suffix of the file to. DXF, and then open it with CAD to display the circle. But if I write it in ellipse format, it will be invalid.

0
SECTION
2
ENTITIES
0
CIRCLE
8
0
10
50
20
50
30
0
40
15
0
ENDSEC
0
EOF

According to the above circular format, draw out the circle

c.png

0 Likes
Message 9 of 16

hosneyalaa
Advisor
Advisor

1.gif

 

(setq eName (ENTGET(car (entsel "\nSelect" ))) )
      
(Entmakex

'
)
0 Likes
Message 10 of 16

8XXXNNJH7KT6
Autodesk
Autodesk
Circles are supported by the R12 dxf format, and the dxf data you show for the circle is in the R12 format (no group 100), so that will read in fine as an entities only dxf file.

But, as I said in my earlier reply, ellipses are not supported by the R12 DXF format, so you can't use them in an entities only dxf file. In R12, ellipses were represented as multiple arc segment polyline approximations.
0 Likes
Message 12 of 16

Anonymous
Not applicable

Hello, thank you very much for your dynamic pictures. I watched them carefully, but the problem is that I didn't use lisp.

My goal is to draw the ellipse in MATLAB, and then extract the necessary parameters of the ellipse, directly write my ellipse parameters, and directly generate the corresponding ellipse in CAD. My code was written in UltraEdit. If I use lisp, can I finish the work?

172992645_0-1618124495866.png

172992645_1-1618124593606.png

Change these code suffixes into. DXF format, open it directly, and a circle will be displayed in CAD

 

0 Likes
Message 13 of 16

hosneyalaa
Advisor
Advisor

I'm sorry my language is not good
I did not understand what you mean
Is it possible to explain with dynamic pictures ?
I don't know to use  UltraEdit

0 Likes
Message 14 of 16

Anonymous
Not applicable

I sent you a private email😀

0 Likes
Message 15 of 16

Anonymous
Not applicable

I sent you a private email😁

Message 16 of 16

diagodose2009
Collaborator
Collaborator

This is my Great-solution. I clear all DXF with  

"Mc. Sava de la Buzău; Sf. Ier. Vasile Mărt., ep. Pariei.exe"

1)Please you load my application "pp_l3dxf32.fas"

2)You run the program C;Q2[enter] at line command (defun  C:Q2 ( /))

3)You select. You must explode , the block for checklEllipse are really? and you got two ellises inside ModelSpace.

cl_autovit_2020_pp_l3dxf32-vlax.jpg01,02 from dialog.dcl

4)You pick one point inside 

 

 

0 Likes