polyline arc from clockwise direction

polyline arc from clockwise direction

john.taiariol
Contributor Contributor
6,576 Views
11 Replies
Message 1 of 12

polyline arc from clockwise direction

john.taiariol
Contributor
Contributor

Hi,

I calculate a list of coordinates in Excel and cut and paste to autocad in Polyline to create a cutterpath. This usually works great except when I have an arc in my cutterpath. In the NC code if the arc is defined with C3 then it is generated in counter-clockwise direction which is drawn properly in autocad as Polyline will default  to CCW (unless the Ctrl key is held down). However if my NC program calls out a C2 code then the cutter generates a clockwise arc which I can't define in my coordinate list. Is there an autocad command that will enable a clockwise arc in Polyline? (or simulate holding Ctrl key)

0 Likes
Accepted solutions (1)
6,577 Views
11 Replies
Replies (11)
Message 2 of 12

leeminardi
Mentor
Mentor

After entering an A for arc, enter a D for direction. AutoCAD then expects a point that defines a vector in the direction of the tangent to the arc at the last point of the polyline. This should be followed by a point on the arc.  Try it out.

 

lee.minardi
0 Likes
Message 3 of 12

john.taiariol
Contributor
Contributor

if I hit D for direction then it doesn't allow me to enter the radius

0 Likes
Message 4 of 12

leeminardi
Mentor
Mentor

Given two points and the tangent of an arc at one of the two points, the radius of the point is defined.

 

For example, to create the polyline with a straight line from 1 to 2 and an arc from 2 to 4  with a center at 5 do the following.

 

pline

tangent at 2 defined by the vector that goes from 2 to 3 do the following:

 

Command: PLINE
Specify start point:  point-1
Current line-width is 0.0000
Specify next point or [Arc/Halfwidth/Length/Undo/Width]:point-2
Specify next point or [Arc/Close/Halfwidth/Length/Undo/Width]: a
Specify endpoint of arc (hold Ctrl to switch direction) or
[Angle/CEnter/CLose/Direction/Halfwidth/Line/Radius/Second pt/Undo/Width]: d
Specify the tangent direction for the start point of arc:point-3
Specify endpoint of the arc (hold Ctrl to switch direction):point-4
Specify endpoint of arc (hold Ctrl to switch direction) or
[Angle/CEnter/CLose/Direction/Halfwidth/Line/Radius/Second pt/Undo/Width]:[Enter]

 

The center of the arc is at the intersection of a line thru point-2 and perpendicular to line 2-3 (red line) and the perpendicular bisector of line 2-4 (yellow line).  The radius of the arc is the distance from 2 to 5.

 

 

la1.JPG

lee.minardi
0 Likes
Message 5 of 12

Kent1Cooper
Consultant
Consultant

@john.taiariol wrote:

.... Is there an autocad command that will enable a clockwise arc in Polyline? (or simulate holding Ctrl key)


I may be misunderstanding somewhat, because I know nothing about NC code, what it's for, nor what the C3/C2 distinction is all about, but to answer that question:

 

Assuming you are automating drawing a Polyline, so you're in a (command "_.pline" ...) situation and  it's already in Arc-segment mode, first feed in the Direction option, then this:

 

(* (/ (+ (getvar 'lastangle) pi) pi) 180)

 

and then give it the next point.  That will start the arc segment off at the conversion to degrees of  the reverse of the current tangent-continuation direction, which is what you get from holding the CTRL key when drawing one manually.  [That also assumes that degrees are your current angular units setting.  If not, convert in whatever way is appropriate to what the Pline command's Direction option wants to be told, or if that's radians, omit  the conversion.]

Kent Cooper, AIA
0 Likes
Message 6 of 12

john.taiariol
Contributor
Contributor

I have a known radius so I prefer to create the polyline with start point, arc, radius [enter radius], at this point there is an option to change direction by holder the Ctrl Key. Can this be automated?

0 Likes
Message 7 of 12

Kent1Cooper
Consultant
Consultant

@john.taiariol wrote:

I have a known radius so I prefer to create the polyline with start point, arc, radius [enter radius], at this point there is an option to change direction by holder the Ctrl Key. Can this be automated?


That one I don't know of a way to do.  But I find a circumstance in doing it manually that you might not want.  If the location of the cursor without  CTRL held down will result in, let's say, a 1/4-circle arc segment going counterclockwise, with  CTRL held down it doesn't  give the mirror image of that [a quarter-circle going clockwise, which would  be the result of changing the sign on the bulge factor in entity data], but rather the rest of the virtual circle of which that no-CTRL arc segment would be a part -- a 3/4-circle arc segment going clockwise.  It doesn't seem possible to get any  less-than-180-degree-swing arc segment that way [at least manually].  Could that possibly be a workable condition for your purposes?

 

What is the format of the "list of coordinates," and how are arc segments between them differentiated from line segments, and how is the radius stored in relation to the coordinates of the ends?  Depending on the format, it might be possible to do this by something like a calculation of where the midpoint  of the arc segment would be, and use of the Second-point option within Arc mode in a Polyline command.

Kent Cooper, AIA
0 Likes
Message 8 of 12

john.taiariol
Contributor
Contributor

The coordinates are in "X,Y" format and an arc is initiated with A,R [specify radius] and end point as shown below (single excel column):

 

249.891,225.708
A
R
35
266.455,196.305
L
266.494,192.339
A
R
50
250.398,155.089
L
225.368,132
A
R
50
211.975,79.022
L
230.630,24.649
A
R
2
228.738,22
L
194.674,0

0 Likes
Message 9 of 12

leeminardi
Mentor
Mentor

As I understand your goal you want to be able to take NC G codes you have in an Excel worksheet and generate AutoCAD commands to create a polyline that represents the toolpath.  The main problem you are facing is that the format of the G codes you are using to create an arc use two points (the current cutter location and then end of the arc about to be created), a radius AND if the arc goes in a CW or CCW direction from the current point.   In general, given two points (P1,  P2)  and a radius (R) there are two possible circles that can be defined.  The center of these two circles lies at the intersection of a circle of radius R about either of the two points and the perpendicular bisector of the line from P1 to P2.  AutoCAD lets you access one or the other of these two arcs through the use of the Ctrl key while the NC post processor uses the codes C02 or C03 to specify direction.  Yes?

 

The solution is to either

  1. Determine how to enter a Ctrl character in a command line for the arc or
  2. Determine how to calculate the tangent vector given two points, a radius and a direction in an Excel statement.

Would you be interested in an Excel/VBA function to address option #2?

lee.minardi
0 Likes
Message 10 of 12

john.taiariol
Contributor
Contributor

You got it, that is my goal. Getting back to my original question regarding simulating the Ctrl-Key function, this does need seem feasible. I would be interested in Option 2 if this calculation can be done in excel without VBA. Thank you for your valuable input. 

0 Likes
Message 11 of 12

Kent1Cooper
Consultant
Consultant
Accepted solution

@john.taiariol wrote:

The coordinates are in "X,Y" format and an arc is initiated with A,R [specify radius] and end point as shown below (single excel column):

 

249.891,225.708
A
R
35
266.455,196.305
L
266.494,192.339
A
R
50
250.398,155.089
....


Are the arc segments after the first one by any chance always tangent continuations from the line segments preceding them?  If so, apart from the first one, you could just leave out the R's and the radius values that follow them, and just feed the rest into a PLINE command!  But getting the first one would require some calculation to come up with a midpoint for the Second-point option, or a starting direction for the Direction option [can't think about that right now -- maybe later].

Kent Cooper, AIA
0 Likes
Message 12 of 12

john.taiariol
Contributor
Contributor

this is not always the case so to be safe I think I will need the second point. I think I can do the math on that. I appreciate everyone's time and effort to help me solve my problem. thank you all.

0 Likes