.NET

Reply
Active Contributor
chikito1990
Posts: 40
Registered: ‎06-26-2013
Message 1 of 6 (8,095 Views)
Accepted Solution

Add ellipse in drawing.

8095 Views, 5 Replies
08-05-2013 04:41 AM

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

Mentor
mzakiralam
Posts: 231
Registered: ‎11-09-2012
Message 2 of 6 (8,083 Views)

Re: Add ellipse in drawing.

08-05-2013 05:28 AM 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)




Active Contributor
chikito1990
Posts: 40
Registered: ‎06-26-2013
Message 3 of 6 (8,079 Views)

Re: Add ellipse in drawing.

08-05-2013 05:40 AM 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)

Mentor
mzakiralam
Posts: 231
Registered: ‎11-09-2012
Message 4 of 6 (8,055 Views)

Re: Add ellipse in drawing.

08-05-2013 07:15 AM 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

*Expert Elite*
Hallex
Posts: 1,569
Registered: ‎10-08-2008
Message 5 of 6 (8,051 Views)

Re: Add ellipse in drawing.

08-05-2013 07:22 AM in reply to: chikito1990
See also:
http://adndevblog.typepad.com/autocad/2012/05/creating-an-ellipse.html
_____________________________________
C6309D9E0751D165D0934D0621DFF27919
Mentor
mzakiralam
Posts: 231
Registered: ‎11-09-2012
Message 6 of 6 (8,049 Views)

Re: Add ellipse in drawing.

08-05-2013 07:25 AM 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
Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.