- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Denunciar
I'm running a script that generates a series of arcs. For the sake of this example, they're 90 degree arcs. The arcs should all begin at the same y-coordinate and end at the same x-coordinate (aligned at both ends), with slightly different radii to each. Instead, the ends of the arcs are just slight out of position, even though the script has all endpoints at the same x value (colored blue in the code sample below). Disabling snap made no difference.
In the example script below, the arcs are being defined by their (1) center point, (2) start point, (3) end point. The shift is illustrated in the following screenshots. For a larger number of arcs, the x-offset dithers back and forth around the target point (it's not always trending off in the same direction).
Thanks in advance for the help, and apologies if I missed where this question was answered previously. I looked but didn't see anything addressing this issue specifically.
zoom -1.000001,-1.000001
-1.000000,-1.000000
arc c 805.000000,0.000000
145.000000,0.000000
785.000000,-640.000000
arc c 865.000000,0.000000
125.000000,0.000000
785.000000,-700.000000
arc c 925.000000,0.000000
105.000000,0.000000
785.000000,-760.000000
arc c 985.000000,0.000000
85.000000,0.000000
785.000000,-820.000000
arc c 1045.000000,0.000000
65.000000,0.000000
785.000000,-880.000000
arc c 1105.000000,0.000000
45.000000,0.000000
785.000000,-940.000000
arc c 1165.000000,0.000000
25.000000,0.000000
785.000000,-1000.000000
arc c 1225.000000,0.000000
5.000000,0.000000
785.000000,-1060.000000
zoom E
¡Resuelto! Ir a solución.
- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Denunciar
You state "the arcs are being defined by their (1) center point, (2) start point, (3) end point. " This is not totally true. When you specify an arc followed by c the first point is the center. the second point is the start AND it sets the radius of the arc, the third point specifies the angle subtended by the arc. It is not necessarily the end point of the arc.
If you want to specify the end points and an angle of 90° then use something like this:
arc 105.000000,0.000000 e 785.000000,-760.000000 a 90
- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Denunciar
@Anonymous wrote:
.... For the sake of this example, they're 90 degree arcs. ....
...
arc c 805.000000,0.000000
145.000000,0.000000
785.000000,-640.000000
....
They're not 90-degree Arcs. @leeminardi suggested how to make them so, but that's going to give a rather different-looking end result than your first image.
If you want them to be tangent to vertical at their upper left ends, as seems to be the intent in the image, and from the fact that the Y coordinates of your specified center points and start points are the same, but you want your specified points to be their endpoints, do the first one [with points above] this way:
....
arc
145,0 ; start
_end
785,-640
_direction 270
....
But note that the center is not specified there, but will be a result of the rest. Its Y coordinate will be the same as the start point, because of the direction specified, but its X coordinate will usually not be what you have in your center points.
[Those trailing zeros are doing nothing for you....]
- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Denunciar
Thank you both for your replies, Kent and Lee. Based on what you were each describing, I realized that what I wanted was impossible with an arc (circular). Instead, I need an elliptical arc to get the general shape I want -- see screenshot below.
...but then I ran into the next issue. Elliptical arcs can't be converted to polylines with the pedit command. When I set the PELLIPSE system variable to 1, the ellipse command changes and I lose the option to create elliptical arcs instead of full ellipses. Is there a way around this? Polylines are critical to the subsequent steps.
Apologies if this second question ought to be a new thread, but others encountering my original issue may run into the same follow-on question.
Also, please excuse the trailing zeroes. I'm procedurally generating the AutoCAD scripts in another language (Matlab), and that's just the default precision that it writes out to the .scr file.
- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Denunciar
If you are procedurally creating the ellipse data in Matlab then you could also create the polyline vertex data too.
I was curious as to how well a 3rd Order BSpline with uniform knots (the AutoCAD default) and 4 control vertices (CVs) would fit an ellipse (this is equivalent to a 3rd degree Bezier spline). Although a segment of a BSpline is a polynomial which cannot exactly duplicate an ellipse I thought I'd give it a try to see how close I could get.
The attached macro-enable Excel file compares the two curves. It uses a custom Excel function I wrote to create BSplines given a value for the independent variable t and the CVs. Since the ellipse has a slope of zero at x = 0 and is vertical at x = 2.5 in my example, the second CV should have the same y coordinate as the first and the third CV should have the same x coordinate as the last CV. Adjusting the second CV (using AutoCAD) in x and the third in Y provided the CVs noted below. A comparison of the two curves indicates a maximum variance of about 0.3%. Once you have a spline in AutoCAD you can convert it to a polyline with splinedit.
White = ellipse, green = splines
This was an interesting exercise but I think the best approach is to go directly from Matlab to AutoCAD polylines.
- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Denunciar
@Anonymous wrote:
.... I realized that what I wanted was impossible with an arc (circular). Instead, I need an elliptical arc to get the general shape I want ...but then I ran into the next issue. Elliptical arcs can't be converted to polylines with the pedit command. When I set the PELLIPSE system variable to 1, the ellipse command changes and I lose the option to create elliptical arcs instead of full ellipses. Is there a way around this? ....
You can make a PELLIPSE=1 Ellipse and then use any of several possibilities to remove the part of it you don't want -- TRIM, or BREAK, or PEDIT's Edit-vertex option with the Break sub-option. If you do these always in the same kind of orientation, so that the start points of the Polyline ellipses are always in the same relationship to the overall picture, then where to specify the break points, or where to pick on it in a TRIM command if the little Circles are already there to use as cutting boundaries, could be built in via the resulting Polyline's vertex parameter values.
- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Denunciar
Thanks, calculating the individual vertices for the ellipse was the right approach; I broke the ellipse into 1 degree polyline segments, which is more than sufficient for my purposes.
@leeminardi wrote:
If you are procedurally creating the ellipse data in Matlab then you could also create the polyline vertex data too.
...
This was an interesting exercise but I think the best approach is to go directly from Matlab to AutoCAD polylines.