haplokuon / netDxf

.net dxf Reader-Writer
MIT License
966 stars 393 forks source link

Arc Lengh dimension not found in library? #431

Open Dharmesh1979 opened 1 year ago

Dharmesh1979 commented 1 year ago

Hi,

I have AutoCAD drawing I want to write some dimension in drawing elements, I have do liner dimensions in drawing but I am facing an issue when bulge or arc exists in element data. I had identify the arc or bulge from drawing but I am not getting how to implement Arc length dimension Is there any way to implement it. I humble request some one to guide me on this.

haplokuon commented 1 year ago

The Arc Length Dimension is not implemented. You can find the full list of available entities in the "Readme.md". The problem with it is that it is not documented and I am tired having to deal with this kind of things.

Dharmesh1979 commented 1 year ago

Understand your problem which facing you. I will wait for solution.

Arc Length Dimension bulge consider start angle and end angle or start point, bulge , end point that bugle convert into coordinates and calculate length for that bulge or curve. is it?

DavidWishengrad commented 1 year ago

Here is the code for getting the length of an arc from a bulge in a polyline2d. An arc length is similar. For an arc subtract the start angle from the end angle and use //totallength = radius * angle; Note: angle is in radians.

You will need to create your own new dim using ticks, extension lines, etc. if you really need that type of dim. Most people never use that type of dim, but it does come up once in a while. Hope it helps.

                            //code get the length of an arc from a pline without exploding it
                            //double angle;
                            //double length;
                            //double angleB;
                            //double radius;
                            //double p1xvalue;
                            //double p1yvalue;
                            //double p2xvalue;
                            //double p2yvalue;
                            //double totallength;

                            //p1xvalue = (poly2d.Vertexes[index].Position.X);
                            //p1yvalue = (poly2d.Vertexes[index].Position.Y);

                            //p2xvalue = (poly2d.Vertexes[index + 1].Position.X);
                            //p2yvalue = (poly2d.Vertexes[index + 1].Position.Y);

                            //length = Math.Sqrt(Math.Pow(p2xvalue - p1xvalue, 2) + Math.Pow(p2yvalue - p1yvalue, 2));
                            //angle = Math.Atan(existingbulge) * 4;
                            //angleB = ((4 * Math.Atan(1)) / 2) - (angle / 2);
                            //radius = (length / 2) / (Math.Cos(angleB));
                            //totallength = radius * angle;

edit-P.S. On second though, if I was faced with creating that dim I would probably try using a radius dim as a starting point and replace the R in R15" with Arch Length. That type of dim will not be annoying to look at and possibly not overlap other dim extension lines, etc.