.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Add ellipse in drawing.

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
chikito1990
10029 Views, 5 Replies

Add ellipse in drawing.

Hi all,

 

I am trying to create a cylinder. To accomplish this I am creating two ellipses and two lines. After I try to insert them in the DWG dwaing I can see only the lines. Here is a code sniped so you can see what am i doing.

 

Double ellipseRadiusRatio = 0.4;
                Vector3d ellipseMajorAxis = new Vector3d(0.0, 1500.0, 0.0);
                Vector3d ellipseLeftCenter = new Vector3d(72541.7, 80198.5, 0.0);
                Vector3d ellipseRightCenter = new Vector3d(77145.7, 80173.6, 0.0);

                Ellipse leftEllipse = new Ellipse();
                leftEllipse.MajorAxis.Add(ellipseMajorAxis);
                leftEllipse.RadiusRatio = ellipseRadiusRatio;
                leftEllipse.Center.Add(ellipseLeftCenter);
                leftEllipse.StartAngle = 0;

                Ellipse rightEllipse = new Ellipse();
                rightEllipse.MajorAxis.Add(ellipseMajorAxis);
                rightEllipse.RadiusRatio = ellipseRadiusRatio;
                rightEllipse.Center.Add(ellipseRightCenter);
                rightEllipse.StartAngle = 0;
               
                Point3d ellipseTopStart = new Point3d(77154.7, 81673.6, 0.0);
                Point3d ellipseTopEnd = new Point3d(72541.7, 81698.5, 0.0);
                Point3d ellipseBottumStart = new Point3d(77154.7, 78673.6, 0.0);
                Point3d ellipseBottumEnd = new Point3d(72578.5, 78701.8, 0.0);

                Line ellipseTop = new Line(ellipseTopStart, ellipseTopEnd);
                Line ellipseButtom = new Line(ellipseBottumStart, ellipseBottumEnd);

                acBlkTblRec.AppendEntity(rightEllipse);
                acBlkTblRec.AppendEntity(leftEllipse);
                acBlkTblRec.AppendEntity(ellipseTop);
                acBlkTblRec.AppendEntity(ellipseButtom);

                acTrans.Commit();

 I hope you can see the problem.

Thnaks in advance!

 

Best regards, 

Dimitar Georgiev

5 REPLIES 5
Message 2 of 6
mzakiralam
in reply to: chikito1990

Try to add below lines before doing acTrans.commit():

acTrans.AddNewlyCreatedDBObject(rightEllipse, True)
acTrans.AddNewlyCreatedDBObject(leftEllipse, True)
acTrans.AddNewlyCreatedDBObject(ellipseTop, True)
acTrans.AddNewlyCreatedDBObject(ellipseBottom, True)




Message 3 of 6
chikito1990
in reply to: mzakiralam

still the same result. I uploaded 2 pictures "result"  is the current pucture,  but i wnat to be like "result2" (ignore colors and extra elements)

Message 4 of 6
mzakiralam
in reply to: chikito1990

As I did not see your full code so I can't tell why it is going wrong. However, in below there are 2 links where drawing ellipse is involved. Try to compare your ellipse with those code:

http://forums.autodesk.com/t5/NET/How-can-I-use-a-graphic-ellipse-with-text-together/m-p/3806417/hig...

http://forums.autodesk.com/t5/NET/VB-NET-SET-METHOD-ON-ELLIPSE/td-p/2824426

Message 5 of 6
Hallex
in reply to: chikito1990

See also:
http://adndevblog.typepad.com/autocad/2012/05/creating-an-ellipse.html
_____________________________________
C6309D9E0751D165D0934D0621DFF27919
Message 6 of 6
mzakiralam
in reply to: chikito1990



probably I understand the point that why ellipse drawing is not wokring.



"The way to create an ellipse is to use the constructor of ellipse class and pass the parameters." - I got this line from adndevblog.The way you try to draw ellipse is not valid. try to see below link. There you will get full code of how to create ellipse:



http://adndevblog.typepad.com/autocad/2012/05/creating-an-ellipse.html



I hope this will solve your issue.



Regards

Zakir

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

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost