Arc direction defining problem

Arc direction defining problem

danijel.radenkovic
Collaborator Collaborator
4,507 Views
25 Replies
Message 1 of 26

Arc direction defining problem

danijel.radenkovic
Collaborator
Collaborator

Hello to all,

The short description of what I am trying to do is recreating AutoCAD geometry using Inventor. The geometry that I am talking consists of arcs and lines. Hopefully, @ВeekeeCZ and @CADaSchtroumpf helped me to export geometry coordinates from AutoCAD to excel. Thank you very much for that cause it was not possible without your help and I am not pretty familiar with lisp.

 

If you take a look to this video you will see how it works:

https://www.youtube.com/watch?v=3LOA48OI3X8&feature=youtu.be

 

There is something that I missed to think about. It is arc direction.

img.png

By setting "True" or "False" at the end of the code line, you decide about arc direction.

 

I am looking for the any new parameter which will be exported from AutoCAD, which will help me in defining the right arc direction.

Otherwise, there is a problem as it is showed on this video:

https://www.youtube.com/watch?v=JHqIfVHad4E&feature=youtu.be

Any help is very appreciated.

Danijel


 

Inventor 2018/Windows 10 x64
If this information was helpful, please consider marking it as an Accepted Solution by using the Accept as Solution. Kudos are also gladly accepted.
0 Likes
4,508 Views
25 Replies
Replies (25)
Message 21 of 26

danijel.radenkovic
Collaborator
Collaborator

@john.uhden wrote:

Oops.  I guess an errant finger of mine hit some incorrect key and either I lost my draft or it went through unfinished.

 

Just a thought.  Instead of dealing with separate arcs and sorting them, how about using a polyline consisting of arced segments.  Each segment has a "bulge" factor which controls both the size of the radius and the direction of curvature.  A positive bulge means CCW and a negative bulge means CW.  We can provide you the math in AutoLisp to compute the centerpoint and radius. Also, the straight line segments can be handled the same way and even be comingled with bulged segments (when such conditions are present).


Would you like to provide an example. Maybe it can be useful in my case.

Inventor 2018/Windows 10 x64
If this information was helpful, please consider marking it as an Accepted Solution by using the Accept as Solution. Kudos are also gladly accepted.
0 Likes
Message 22 of 26

john.uhden
Mentor
Mentor

Here ya go.  Hope it helps.

 

 (defun Pdata (Obj / End Param P1 P2 Chord Bulge Delta CenterPt Radius Data)
      ;; Taken from old work by John Uhden (03-19-2017)
      ;; Function to return a list of polyline segments where each segment is a list
      ;; in the format (StartPt EndPt CenterPt Radius CCW).
      ;; In the case of a straight segment, CenterPt, Radius, and CCW are all nil
      ;; CCW will be either 1 for CCW, or 0 for CW, or nil for straight.
      ;;
      ;; Arguments:
      ;;   Obj  (any 2D polyline as a vla-object)
;; (setq Param 0.0 End (vlax-curve-getendparam Obj) ) (while (< Param End) (setq P1 (vlax-curve-getpointatparam Obj Param)) (if (= Param End) (setq P2 (vlax-curve-getpointatparam Obj 0.0)) (setq P2 (vlax-curve-getpointatparam Obj (1+ Param))) ) (if (zerop (setq Bulge (vla-getbulge Obj Param))) (setq Radius nil CenterPt nil CCW nil) (setq Chord (distance P1 P2) CCW (if (minusp Bulge) 0 1) Delta (* 4.0 (atan Bulge)) Radius (/ Chord (* 2 (sin (/ Delta 2)))) CenterPt (polar P1 (+ (angle P1 P2)(- (/ pi 2)(/ Delta 2))) Radius) ) ) (setq Data (cons (list P1 P2 CenterPt Radius CCW) Data) Param (1+ Param) ) ) (reverse Data) )

John F. Uhden

0 Likes
Message 23 of 26

Anonymous
Not applicable

Can you tell me why arc drawn in counter-clockwise by default?

0 Likes
Message 24 of 26

cadffm
Consultant
Consultant

Because it is designed this why, nothing more.

If Autodesk had defined it exactly the other way around,
then you would now ask why it was so defined.

Sebastian

0 Likes
Message 25 of 26

john.uhden
Mentor
Mentor
Unlike we surveyor types, most of the world, including Autodesk, treats due
East as angle 0, and increasing angles from there as counterclockwise.
Thus arcs are defined that way. I don't remember if the ANGDIR system
variable affects that. You will also learn that polylines work the same
way... a positive bulge is CCW and a negative bulge is CW.

John F. Uhden

0 Likes
Message 26 of 26

Kent1Cooper
Consultant
Consultant

@Anonymous wrote:

Can you tell me why arc drawn in counter-clockwise by default?


To elaborate a little....

 

The way AutoCAD stores information  about an Arc in memory does not include some of the things that you might expect, such as its endpoints or midpoint.  It stores the coordinates of the center, the radius, the angular direction [in radians] from the center to the "start" [the more clockwise end], and the direction from the center to the "end."  Everything about the Arc in display on-screen is generated from those pieces of information [also affected by other  information, such as the extrusion direction].  You can draw  one in a variety of ways, including proceeding in a CW direction with three points or other options, but the result is always converted to be defined in a CCW direction for data storage in memory.

 

Given a direction from the center to the start and a direction to the end, an Arc could, in theory, "proceed" in either direction, resulting in either of two Arcs that together would form a circle.  The fact that they chose to store the data as proceeding CCW from start to end is surely because of the mathematical convention mentioned by @john.uhden in Message 25.

Kent Cooper, AIA