perpendicular/tangent object snap issue with AutoCAD in .NET

Viewed 1538

Here is an album of screenshots and corresponding descriptions which should storyboard the problem I'm about to describe.

Now, let me explain my issue in mathematical terms and in the code (C#):

========================

Given:

  • A circle with center of origin at (0,0) and radius = 0.0364

  • A line segment which is parallel to the top of the circle and separated by a small margin (so that the line segment is not tangent to the circle). Size of margin does not matter. The line segment's length is 40% of the diameter of the circle.

Solve for:

A vertical line segment with its starting point at the starting point of the aforementioned line and its ending point touching the circle's edge.

========================

I am not receiving my desired result using AutoCAD's Object Snap feature. The line segment I am trying to draw renders only diagonally using OSnap modes tangent and perpendicular. (See the following C# examples):

Example 1:

bigCircle.GetObjectSnapPoints(
  ObjectSnapModes.ModePerpendicular, 
  0, 
  tipTopCenterPoint1, 
  hatTopP3Dstart1, 
  fakematrix1, 
  p3dcolright, 
  icol1
)

...renders the new line folding in, becoming diagonal. I don't know what it is snapping to, but it's not what I want.

Example 2: This function...

bigCircle.GetObjectSnapPoints(
  ObjectSnapModes.ModeTangent, 
  0,
  tipTopCenterPoint1,
  hatTopP3Dstart1,
  fakematrix1,
  p3dcolright,
  icol1
);

....renders the new line extending out, becoming diagonal. I believe the line is attaching to the point tangent to the circle, but it's not what I want.

Here is what I want to get; how can I do so?

desired result

1 Answers
Related