.NET

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

Add ellipse in drawing.

8389 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



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
Mentor
mzakiralam
Posts: 231
Registered: ‎11-09-2012
Message 2 of 6 (8,377 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,373 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,349 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,345 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,343 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
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.