Community
AutoCAD Forum
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

dxf ellipse group codes

11 REPLIES 11
Reply
Message 1 of 12
hinsonjoel
595 Views, 11 Replies

dxf ellipse group codes

i am attempting to write a dxf file and i am ending up with an extrustion by default. i am wantiing a plain 2D look and ending up with an isometric look. is there combination (230,240,250) to get this done? or is there a group code in the header that i am overlooking?

 

0
SECTION
2
HEADER
999
ellipse.dxf.
999
ellipse.dxf.
0
ENDSEC
0
SECTION
2
TABLES
0
ENDSEC
0
SECTION
2
BLOCKS
0
ENDSEC
0
$ANGBASE
0
SECTION
2
ENTITIES
0
ELLIPSE
5
262
330
1F
100
AcDbEntity
8
0
100
AcDbEllipse
62
1
10
990
20
-651
30
0
11
415
21
-153
31
0
210
0
220
0
230
1
40
0.36987951807228914
13
990
23
651
33
0
41
0
42
6.283185307179586
50
0
0
ENDSEC
0
EOF

 

Capture+_2022-01-11-18-34-53.jpg 

11 REPLIES 11
Message 2 of 12
hinsonjoel
in reply to: hinsonjoel

this looks like an "isometric/ extrusion angle" being applied to the render,..i have attempted many combinations (210,220,230) and it stays the exact same,.. now where i am saying i am trying to remove the rotation,.. actually i would like to be able to control the rotation,,.. but i do not see where "group code 50" or a comparable group code listed as an option for the ellipse in the dxf manual that is online.  i have been wrestling with this for days. i hope i am in the right place and that you kindly forum reader can help me out.  thanks in advance.

Message 3 of 12
artc2
in reply to: hinsonjoel

The (210, 220, 230) is the normal vector for the plane that contains the ellipse. The (11, 21, 31) is the major axis vector and must be perpendicular to the normal vector since it must lie in the plane of the ellipse. Those two vectors will determine the orientation of the ellipse in space.

And, of course, the (10, 20, 30) is the ellipse center point which determines the ellipses location in the plane.

Your data also includes a (13, 23, 33) as well as a 50 none of which are valid data for an ellipse.
Message 4 of 12
hinsonjoel
in reply to: hinsonjoel

i have made changes to the dxf per your instruction and i am still getting a rotation and the points (10,20,30) are for sure perpendicular to the points (11,21,31),.. any ideas or comments? look forward to hearing what you think. thanks

 

0
SECTION
2
HEADER
999
drawing.dxf.
999
drawing.dxf
0
ENDSEC
0
SECTION
2
TABLES
0
ENDSEC
0
SECTION
2
BLOCKS
0
ENDSEC
0
$ANGBASE
0
SECTION
2
ENTITIES
0
ELLIPSE
5
262
330
1F
100
AcDbEntity
8
0
100
AcDbEllipse
62
1
10
968
20
-630
30
0
11
1537
21
-630
31
0
210
0
220
0
230
1
40
0.3251318101933216
41
0
42
6.283185307179586
0
ENDSEC
0
EOFCapture+_2022-01-12-07-15-50.png

Message 5 of 12
cadffm
in reply to: hinsonjoel

1. Set your code 21 to zero and check the ellipse again, is this what you stumpled?
2. Your "DXF File" doesn't match the DXF Definition for R13 (lowest format for Ellipse objects)


If your viewer read this file, good for you, but "wrong"*. Means: Possible that the next program can't read the file.

*The ellipse entitiy is okay, but all around is not enough, a minimum DXF for R13 or should have more content if i am right.

Sebastian

Message 6 of 12
artc2
in reply to: hinsonjoel

The (10,20,30) is the center point of the ellipse not a vector, so perpendicular doesn't apply to it. I think you meant that your (11,21,31) vector is perpendicular to the (0,0,1) normal vector. 🙂

The data you have now looks reasonable. The view you show appears to have the view's twist not aligned with the ellipse's major axis vector. Based on what I see in the view, it looks like the view is set up so that the World Coordinate System's X axis is horizontal to the right. The ellipse major axis vector of (1537, -630, 0) is to the right and down, so that's how you see the ellipse. If you want to see the ellipse so that it's major axis appears to be horizontal, then you'll either need to use a major axis vector with a 0 for the Y and Z components (such as (1661.1, 0, 0) which is the same magnitude as your current major axis vector, but in the X direction), or you'll need to change your view twist so that it aligns with the ellipse's major axis.
Message 7 of 12
hinsonjoel
in reply to: hinsonjoel

so you are saying to correct it with trial and error adding a factor to it? if i know a hard angle that is being applied i can deal with that, i can solve for it.. but i don't want to have to guess.  can we agree its maybe a 45^ angle that is being applied??,... now i must say that the angle that is happening with the ellipse is not occuring with lines,.. a line described as 0 along the horizontal and vertical axis show up as such and so it is does not appear to be  "drawing setting" / "WCS" issue. so let me run with things a little more and i will let the group know how it went. ok? ok. & again i thank everyone for their contribution to this thus far.

Message 8 of 12
artc2
in reply to: hinsonjoel

If you are replying to my response to you, then I don't understand what you are trying to say because my response wasn't saying anything about trial and error adding any kind of factor to anything and there isn't any angle being applied to anything.
Message 9 of 12
cadffm
in reply to: hinsonjoel

@hinsonjoel 

..and I am missing your response to my last post, specially about my 1.)

 

Sebastian

Message 10 of 12
hinsonjoel
in reply to: hinsonjoel

i mean that i have equations for the ellipses rotations matrix and so if i knew the exact angle this is coming in at and if that is an industry standard, then i can cascade in the angle and calc where the side of the ellipse should be, rather than to guess at what angle looks closest.  also i am looking at what the dxf manual is saying about (11,21,31) says "relative to the center in WCS",.. is this is saying the number should be a distance from (10,20,30) and not a coordinate?

Message 11 of 12
artc2
in reply to: hinsonjoel

I don't understand what you mean by "exact angle this is coming in at". If you mean the angle between the ellipse major axis and the WCS X, Y, and Z axes, then that can be easily determined from the (11,21,31) which is a vector, in WCS, that specifies the direction and magnitude of the ellipse major axis.

The (11,21,31) is a vector whose direction is the direction of the ellipse major axis and whose magnitude is the distance from the (10,20,30) to a point on the ellipse that lies on the ellipse major axis.
Message 12 of 12
hinsonjoel
in reply to: artc2

i am forgetting to show you behind the scenes the generation of the file,.. seems one mans ellipse is the next guys oval and i am attempting to save to this file format to make a thing i working on more useful.

 

if al>0 then
for i = 1 to al
LIST.GET ovalpts,i*5,oval2z
GR.GET.VALUE gooval1[i],"left",left2,"top",top2,"right",right2,"bottom",bottom2
GR.GET.VALUE rotovalang[i],"x",rotx,"y",roty,"angle",angle
width=(right2-left2)
height=(bottom2-top2)
!ptx1 is x center of rectangle
!pty1 is y center of rectangle
ptx1=left2+(width/2)
pty1=top2+(height/2)
!rotx is x point of rotation
!roty is y point of rotation
dzx2=rotx-ptx1
dzy2=roty-pty1
!dzx2 is x difference point of rotation, center of rectangle
!dzy2 is y difference point of rotation, center of rectangle
dzx3=ptx1+dzx2
dzy3=pty1+dzy2
ltx = (left2-dzx3)*cos(TORADIANS(angle)) - (top2-dzy3)*sin(TORADIANS(angle))+dzx3
lty = (left2-dzx3)*sin(TORADIANS(angle)) + (top2-dzy3)*cos(TORADIANS(angle))+dzy3
rtx = (right2-dzx3)*cos(TORADIANS(angle)) - (top2-dzy3)*sin(TORADIANS(angle))+dzx3
rty = (right2-dzx3)*sin(TORADIANS(angle)) + (top2-dzy3)*cos(TORADIANS(angle))+dzy3
lbx = (left2-dzx3)*cos(TORADIANS(angle)) - (bottom2-dzy3)*sin(TORADIANS(angle))+dzx3
lby = (left2-dzx3)*sin(TORADIANS(angle)) + (bottom2-dzy3)*cos(TORADIANS(angle))+dzy3
rbx = (right2-dzx3)*cos(TORADIANS(angle)) - (bottom2-dzy3)*sin(TORADIANS(angle))+dzx3
rby = (right2-dzx3)*sin(TORADIANS(angle)) + (bottom2-dzy3)*cos(TORADIANS(angle))+dzy3

ov_mrx_a=((rbx+rtx)/2)
ov_mry_a=((rby+rty)/2)
ov_mbx_a=((rbx+lbx)/2)
ov_mby_a=((rby+lby)/2)



GR.GET.VALUE gooval1[i],"left",left2,"top",top2,"right",right2,"bottom",bottom2
GR.GET.VALUE rotovalang[i],"x",rotx,"y",roty,"angle",angle
angle=angle-25
width=(right2-left2)
height=(bottom2-top2)
!ptx1 is x center of rectangle
!pty1 is y center of rectangle
ptx1=left2+(width/2)
pty1=top2+(height/2)
!rotx is x point of rotation
!roty is y point of rotation
dzx2=rotx-ptx1
dzy2=roty-pty1
!dzx2 is x difference point of rotation, center of rectangle
!dzy2 is y difference point of rotation, center of rectangle
dzx3=ptx1+dzx2
dzy3=pty1+dzy2
ltx = (left2-dzx3)*cos(TORADIANS(angle)) - (top2-dzy3)*sin(TORADIANS(angle))+dzx3
lty = (left2-dzx3)*sin(TORADIANS(angle)) + (top2-dzy3)*cos(TORADIANS(angle))+dzy3
rtx = (right2-dzx3)*cos(TORADIANS(angle)) - (top2-dzy3)*sin(TORADIANS(angle))+dzx3
rty = (right2-dzx3)*sin(TORADIANS(angle)) + (top2-dzy3)*cos(TORADIANS(angle))+dzy3
lbx = (left2-dzx3)*cos(TORADIANS(angle)) - (bottom2-dzy3)*sin(TORADIANS(angle))+dzx3
lby = (left2-dzx3)*sin(TORADIANS(angle)) + (bottom2-dzy3)*cos(TORADIANS(angle))+dzy3
rbx = (right2-dzx3)*cos(TORADIANS(angle)) - (bottom2-dzy3)*sin(TORADIANS(angle))+dzx3
rby = (right2-dzx3)*sin(TORADIANS(angle)) + (bottom2-dzy3)*cos(TORADIANS(angle))+dzy3

LIST.GET oval_color,i*4-3,r
LIST.GET oval_color,i*4-2,g
LIST.GET oval_color,i*4-1,b
LIST.GET oval_color,i*4,f
TEXT.WRITELN fnum,"0"
TEXT.WRITELN fnum,"ELLIPSE"
TEXT.WRITELN fnum,"5"
TEXT.WRITELN fnum,"262"
TEXT.WRITELN fnum,"330"
TEXT.WRITELN fnum,"1F"
TEXT.WRITELN fnum,"100" 
TEXT.WRITELN fnum,"AcDbEntity"
TEXT.WRITELN fnum,"8"
TEXT.WRITELN fnum,"0"
TEXT.WRITELN fnum,"100" 
TEXT.WRITELN fnum,"AcDbEllipse"
TEXT.WRITELN fnum,"62"
if r=255 & g=0 & b=0 then
p=1
elseif r=255 & g=255 & b=0 then
p=2
elseif r=0 & g=255 & b=0 then
p=3
elseif r=0 & g=0 & b=255 then
p=5
elseif r=255 & g=0 & b=255 then
p=6
elseif r=255 & g=255 & b=255 then
p=7
elseif r=150 & g=150 & b=150 then
p=8
elseif r=0 & g=0 & b=0 then
p=0
endif
TEXT.WRITELN fnum,INT$(p)
TEXT.WRITELN fnum,"10"
TEXT.WRITELN fnum,INT$(ptx1)
TEXT.WRITELN fnum,"20"
TEXT.WRITELN fnum,INT$(-pty1)
TEXT.WRITELN fnum,"30"
TEXT.WRITELN fnum,INT$(oval2z)

ov_mrx=((rbx+rtx)/2)
ov_mry=((rby+rty)/2)
ov_mbx=((rbx+lbx)/2)
ov_mby=((rby+lby)/2)


fac1x=(ov_mrx_a-ptx1)/(ov_mrx_a)
fac1y=(ov_mry_a-pty1)/(ov_mry_a)

fac2x=ov_mrx_a/ov_mrx
fac2y=ov_mry_a/ov_mry

ov_mrx=ov_mrx*fac1x*fac2x
ov_mry=ov_mry*fac1y*fac2y

if (bottom2-pty1)<(right2-ptx1) then
TEXT.WRITELN fnum,"11"
TEXT.WRITELN fnum,INT$(ov_mrx)
TEXT.WRITELN fnum,"21"
TEXT.WRITELN fnum,INT$(-ov_mry)
endif
if (bottom2-pty1)>(right2-ptx1) then
TEXT.WRITELN fnum,"11"
TEXT.WRITELN fnum,INT$(ov_mbx)
TEXT.WRITELN fnum,"21"
TEXT.WRITELN fnum,INT$(-ov_mby)
endif
TEXT.WRITELN fnum,"31"
TEXT.WRITELN fnum,INT$(oval2z)

TEXT.WRITELN fnum,"210"
TEXT.WRITELN fnum,"0"
TEXT.WRITELN fnum,"220"
TEXT.WRITELN fnum,"0"
TEXT.WRITELN fnum,"230"
TEXT.WRITELN fnum,"1"
TEXT.WRITELN fnum,"40"
if (bottom2-pty1)<(right2-ptx1) then
ratio1=(bottom2-pty1)/(right2-ptx1)
TEXT.WRITELN fnum,FRAC(ratio1)
else
ratio1=(right2-ptx1)/(bottom2-pty1)
TEXT.WRITELN fnum,FRAC(ratio1)
endif


TEXT.WRITELN fnum,"41"
TEXT.WRITELN fnum,"0"
TEXT.WRITELN fnum,"42"
TEXT.WRITELN fnum,"6.283185307179586"
next i
endif

Capture+_2022-01-13-19-04-06.pngCapture+_2022-01-13-19-04-14.png

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

AutoCAD Inside the Factory


Autodesk Design & Make Report