Getting value of Z Coordinates 0 when working with YZ or XZ Plane.

Getting value of Z Coordinates 0 when working with YZ or XZ Plane.

prem_kumar8SXZJ
Enthusiast Enthusiast
631 Views
5 Replies
Message 1 of 6

Getting value of Z Coordinates 0 when working with YZ or XZ Plane.

prem_kumar8SXZJ
Enthusiast
Enthusiast

Hi When I try to get the Coordinates of my mouse in AutoCAD sometimes I get Z coordinates and sometimes I get Z coordinates as 0. Is there any way to solve this bug? I am not using any code, It is just happening by default in AutoCAD behavior.

0 Likes
632 Views
5 Replies
Replies (5)
Message 2 of 6

ActivistInvestor
Mentor
Mentor

Your screenshots suggest that you're not in the WCS or the view is not parallel to the WCS XY plane.

0 Likes
Message 3 of 6

prem_kumar8SXZJ
Enthusiast
Enthusiast

Hi, How do I check If I am in WCS or the view is not parallel to the XY plane?

0 Likes
Message 4 of 6

_gile
Consultant
Consultant

@prem_kumar8SXZJ wrote:

Hi, How do I check If I am in WCS or the view is not parallel to the XY plane?


You can check if the current view direction is parallel to Vector3d.ZAxis.

public static bool IsCurrentViewPerpendicularToXYPlane()
{
    var ed = Application.DocumentManager.MdiActiveDocument.Editor;
    using (var view = ed.GetCurrentView())
    {
        return view.ViewDirection.IsParallelTo(Vector3d.ZAxis);
    }
}


Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

0 Likes
Message 5 of 6

ActivistInvestor
Mentor
Mentor

Similar to @_gile 's solution, this will tell you if the current view is a plan view of the current UCS:

public static partial class EditorExtensions
{
   public static bool IsPlanUCS(this Editor editor)
   {
      if(editor == null) 
         throw new ArgumentNullException(nameof(editor));
      return editor.GetCurrentView().ViewDirection.IsParallelTo(
         editor.CurrentUserCoordinateSystem.CoordinateSystem3d.Zaxis);
   }
}

 

0 Likes
Message 6 of 6

prem_kumar8SXZJ
Enthusiast
Enthusiast

Hi, @ActivistInvestor@_gile I think I haven't described my problem correctly so I have made one small video for Your reference. When I am working on the Top view which is the XY plane I am getting the coordinates of XY correctly but when I change my view to Left which is the YZ plane then at a certain point I am getting the value of X and Y coordinates only and after a certain point I started to get the value of Z Coordinates. Why this behavior is happening?

0 Likes