.NET
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Cursor Coordinate Problems
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
478 Views, 6 Replies
05-18-2005 07:37 PM
We are in the process of customizing the DockingPalette C# sample found in C:\ObjectARX 2006\samples\dotNet\DockingPalette.
We are attempting to insert an entity into the database at the X,Y drawing coordinates where the user released the mouse button. We are able to retrieve the X,Y pixel coordinates from System.Windows.Forms.DragEventArgs, but have not found a way to translate those into X, Y coordinates useful for inserting an entity at an accurate spot on the drawing. In addition, we haven't found anyway to retrieve the current X, Y of the mouse position when we receive our drop event.
Can anyone provide any guidance on either:
A) translating System.Windows.Forms.DragEventArgs X,Y coords into World Coordinate or User Coordinate system X,Y values
B) retrieving World Coordinate or User Coordinate system X,Y values for the current mouse position
BTW, we're I'd like to thank whoever got a .NET forum setup. We're looking forward to a better repository of .NET knowledge for the ObjectARX api.
We are attempting to insert an entity into the database at the X,Y drawing coordinates where the user released the mouse button. We are able to retrieve the X,Y pixel coordinates from System.Windows.Forms.DragEventArgs, but have not found a way to translate those into X, Y coordinates useful for inserting an entity at an accurate spot on the drawing. In addition, we haven't found anyway to retrieve the current X, Y of the mouse position when we receive our drop event.
Can anyone provide any guidance on either:
A) translating System.Windows.Forms.DragEventArgs X,Y coords into World Coordinate or User Coordinate system X,Y values
B) retrieving World Coordinate or User Coordinate system X,Y values for the current mouse position
BTW, we're I'd like to thank whoever got a .NET forum setup. We're looking forward to a better repository of .NET knowledge for the ObjectARX api.
Re: Cursor Coordinate Problems
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
05-18-2005 08:14 PM in reply to:
Trei
The ObjectARX and .NET API's are different. That is the reason we wanted this forum. Unfortunately Autodesk have blurred the line by packaging the .NET API documentation with the ObjectARX SDK and originally telling .NET API users to use the ObjectARX discussion group. Hopefully Autodesk will further help end this confusion by seperating the .NET API documentation and putting out material that explains they are different.
Regards - Nathan
Regards - Nathan
*Murph
Re: Cursor Coordinate Problems
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
05-19-2005 05:23 AM in reply to:
Trei
If the pros that program all day long have a hard time understanding this,
us amateurs that dabble with it part-time are going nuts. So is that VB,
dotnet, C#, C++ or VS? Waitress, can I get another cup of coffee?
Murph
wrote in message news:4849966@discussion.autodesk.com...
Hopefully Autodesk will further help end this confusion by seperating the
.NET API documentation and putting out material that explains they are
different.
Regards - Nathan
us amateurs that dabble with it part-time are going nuts. So is that VB,
dotnet, C#, C++ or VS? Waitress, can I get another cup of coffee?
Murph
Hopefully Autodesk will further help end this confusion by seperating the
.NET API documentation and putting out material that explains they are
different.
Regards - Nathan
*J. Daniel Smith
Re: Cursor Coordinate Problems
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
05-19-2005 06:26 AM in reply to:
Trei
I've been calling the .NET APIs "ARX.NET" for lack of an official name. I
think ARX is/was for AutoCAD Runtime eXtension (maybe now it's "just three
letters") which still makes sense for .NET.
The line is somewhat blury because a .NET language like Managed C++ or
C++/CLI can readily use both ARX.NET and ObjectARX. Even VB.NET and C# can
make limited use of ObjectARX through P/Invoke and COM Interop.
Also, just as System.Windows.Forms is built on Win32, ARX.NET is largly
built on ObjectARX. Eventually, this will be just an "implementation
detail" (and there will be new .NET-only functionality), but right now it
can still be helpful to know Win32 and ObjectARX even if you're only using
the .NET APIs.
Dan
wrote in message news:4849966@discussion.autodesk.com...
The ObjectARX and .NET API's are different. That is the reason we wanted
this forum. Unfortunately Autodesk have blurred the line by packaging the
.NET API documentation with the ObjectARX SDK and originally telling .NET
API users to use the ObjectARX discussion group. Hopefully Autodesk will
further help end this confusion by seperating the .NET API documentation and
putting out material that explains they are different.
Regards - Nathan
think ARX is/was for AutoCAD Runtime eXtension (maybe now it's "just three
letters") which still makes sense for .NET.
The line is somewhat blury because a .NET language like Managed C++ or
C++/CLI can readily use both ARX.NET and ObjectARX. Even VB.NET and C# can
make limited use of ObjectARX through P/Invoke and COM Interop.
Also, just as System.Windows.Forms is built on Win32, ARX.NET is largly
built on ObjectARX. Eventually, this will be just an "implementation
detail" (and there will be new .NET-only functionality), but right now it
can still be helpful to know Win32 and ObjectARX even if you're only using
the .NET APIs.
Dan
The ObjectARX and .NET API's are different. That is the reason we wanted
this forum. Unfortunately Autodesk have blurred the line by packaging the
.NET API documentation with the ObjectARX SDK and originally telling .NET
API users to use the ObjectARX discussion group. Hopefully Autodesk will
further help end this confusion by seperating the .NET API documentation and
putting out material that explains they are different.
Regards - Nathan
*Albert Szilvasy
Re: Cursor Coordinate Problems
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
05-19-2005 05:25 PM in reply to:
Trei
There's no first class .NET API to convert pixel to world coordinates and
back. You will need to P/Invoke 2 C++ APIs to accomplish this. Here's how to
do it:
public class ArxApi
{
[DllImport("acad.exe", CallingConvention = CallingConvention.Cdecl,
EntryPoint="?acedCoordFromPixelToWorld@@YAHHVCPoin t@@QAN@Z")]
extern static bool acedCoordFromPixelToWorld(int viewportNumber,
System.Drawing.Point pixel, out Autodesk.AutoCAD.Geometry.Point3d worldPt);
[DllImport("acad.exe", CallingConvention = CallingConvention.Cdecl,
EntryPoint="?acedCoordFromWorldToPixel@@YAHHQBNAAV CPoint@@@Z")]
extern static bool acedCoordFromWorldToPixel(int viewportNumber, ref
Autodesk.AutoCAD.Geometry.Point3d worldPt, out System.Drawing.Point pixel);
[CommandMethod("testpix")]
public void Test()
{
Point3d pt = new Point3d(0,0,0);
System.Drawing.Point pix;
acedCoordFromWorldToPixel(0,ref pt,out pix);
Point3d res;
acedCoordFromPixelToWorld(0,pix,out res);
}
}
To convert between UCS and WCS you can use the transformation matrix
returned by Editor.CurrentUserCoordinateSystem
Albert
wrote in message news:4849962@discussion.autodesk.com...
We are in the process of customizing the DockingPalette C# sample found in
C:\ObjectARX 2006\samples\dotNet\DockingPalette.
We are attempting to insert an entity into the database at the X,Y drawing
coordinates where the user released the mouse button. We are able to
retrieve the X,Y pixel coordinates from System.Windows.Forms.DragEventArgs,
but have not found a way to translate those into X, Y coordinates useful for
inserting an entity at an accurate spot on the drawing. In addition, we
haven't found anyway to retrieve the current X, Y of the mouse position when
we receive our drop event.
Can anyone provide any guidance on either:
A) translating System.Windows.Forms.DragEventArgs X,Y coords into World
Coordinate or User Coordinate system X,Y values
B) retrieving World Coordinate or User Coordinate system X,Y values for the
current mouse position
BTW, we're I'd like to thank whoever got a .NET forum setup. We're looking
forward to a better repository of .NET knowledge for the ObjectARX api.
back. You will need to P/Invoke 2 C++ APIs to accomplish this. Here's how to
do it:
public class ArxApi
{
[DllImport("acad.exe", CallingConvention = CallingConvention.Cdecl,
EntryPoint="?acedCoordFromPixelToWorld@@YAHHVCPoin
extern static bool acedCoordFromPixelToWorld(int viewportNumber,
System.Drawing.Point pixel, out Autodesk.AutoCAD.Geometry.Point3d worldPt);
[DllImport("acad.exe", CallingConvention = CallingConvention.Cdecl,
EntryPoint="?acedCoordFromWorldToPixel@@YAHHQBNAAV
extern static bool acedCoordFromWorldToPixel(int viewportNumber, ref
Autodesk.AutoCAD.Geometry.Point3d worldPt, out System.Drawing.Point pixel);
[CommandMethod("testpix")]
public void Test()
{
Point3d pt = new Point3d(0,0,0);
System.Drawing.Point pix;
acedCoordFromWorldToPixel(0,ref pt,out pix);
Point3d res;
acedCoordFromPixelToWorld(0,pix,out res);
}
}
To convert between UCS and WCS you can use the transformation matrix
returned by Editor.CurrentUserCoordinateSystem
Albert
We are in the process of customizing the DockingPalette C# sample found in
C:\ObjectARX 2006\samples\dotNet\DockingPalette.
We are attempting to insert an entity into the database at the X,Y drawing
coordinates where the user released the mouse button. We are able to
retrieve the X,Y pixel coordinates from System.Windows.Forms.DragEventArgs,
but have not found a way to translate those into X, Y coordinates useful for
inserting an entity at an accurate spot on the drawing. In addition, we
haven't found anyway to retrieve the current X, Y of the mouse position when
we receive our drop event.
Can anyone provide any guidance on either:
A) translating System.Windows.Forms.DragEventArgs X,Y coords into World
Coordinate or User Coordinate system X,Y values
B) retrieving World Coordinate or User Coordinate system X,Y values for the
current mouse position
BTW, we're I'd like to thank whoever got a .NET forum setup. We're looking
forward to a better repository of .NET knowledge for the ObjectARX api.
*Tony Tanzillo
Re: Cursor Coordinate Problems
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
05-19-2005 08:05 PM in reply to:
Trei
Hi Albert.
Thanks for the great samples.
Can we presume that System.Drawing.Point and CPoint are
call-compatible types?
--
http://www.caddzone.com
AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006
http://www.acadxtabs.com
"Albert Szilvasy" wrote in message news:4851284@discussion.autodesk.com...
There's no first class .NET API to convert pixel to world coordinates and
back. You will need to P/Invoke 2 C++ APIs to accomplish this. Here's how to
do it:
public class ArxApi
{
[DllImport("acad.exe", CallingConvention = CallingConvention.Cdecl,
EntryPoint="?acedCoordFromPixelToWorld@@YAHHVCPoin t@@QAN@Z")]
extern static bool acedCoordFromPixelToWorld(int viewportNumber,
System.Drawing.Point pixel, out Autodesk.AutoCAD.Geometry.Point3d worldPt);
[DllImport("acad.exe", CallingConvention = CallingConvention.Cdecl,
EntryPoint="?acedCoordFromWorldToPixel@@YAHHQBNAAV CPoint@@@Z")]
extern static bool acedCoordFromWorldToPixel(int viewportNumber, ref
Autodesk.AutoCAD.Geometry.Point3d worldPt, out System.Drawing.Point pixel);
[CommandMethod("testpix")]
public void Test()
{
Point3d pt = new Point3d(0,0,0);
System.Drawing.Point pix;
acedCoordFromWorldToPixel(0,ref pt,out pix);
Point3d res;
acedCoordFromPixelToWorld(0,pix,out res);
}
}
To convert between UCS and WCS you can use the transformation matrix
returned by Editor.CurrentUserCoordinateSystem
Albert
wrote in message news:4849962@discussion.autodesk.com...
We are in the process of customizing the DockingPalette C# sample found in
C:\ObjectARX 2006\samples\dotNet\DockingPalette.
We are attempting to insert an entity into the database at the X,Y drawing
coordinates where the user released the mouse button. We are able to
retrieve the X,Y pixel coordinates from System.Windows.Forms.DragEventArgs,
but have not found a way to translate those into X, Y coordinates useful for
inserting an entity at an accurate spot on the drawing. In addition, we
haven't found anyway to retrieve the current X, Y of the mouse position when
we receive our drop event.
Can anyone provide any guidance on either:
A) translating System.Windows.Forms.DragEventArgs X,Y coords into World
Coordinate or User Coordinate system X,Y values
B) retrieving World Coordinate or User Coordinate system X,Y values for the
current mouse position
BTW, we're I'd like to thank whoever got a .NET forum setup. We're looking
forward to a better repository of .NET knowledge for the ObjectARX api.
Thanks for the great samples.
Can we presume that System.Drawing.Point and CPoint are
call-compatible types?
--
http://www.caddzone.com
AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006
http://www.acadxtabs.com
"Albert Szilvasy"
There's no first class .NET API to convert pixel to world coordinates and
back. You will need to P/Invoke 2 C++ APIs to accomplish this. Here's how to
do it:
public class ArxApi
{
[DllImport("acad.exe", CallingConvention = CallingConvention.Cdecl,
EntryPoint="?acedCoordFromPixelToWorld@@YAHHVCPoin
extern static bool acedCoordFromPixelToWorld(int viewportNumber,
System.Drawing.Point pixel, out Autodesk.AutoCAD.Geometry.Point3d worldPt);
[DllImport("acad.exe", CallingConvention = CallingConvention.Cdecl,
EntryPoint="?acedCoordFromWorldToPixel@@YAHHQBNAAV
extern static bool acedCoordFromWorldToPixel(int viewportNumber, ref
Autodesk.AutoCAD.Geometry.Point3d worldPt, out System.Drawing.Point pixel);
[CommandMethod("testpix")]
public void Test()
{
Point3d pt = new Point3d(0,0,0);
System.Drawing.Point pix;
acedCoordFromWorldToPixel(0,ref pt,out pix);
Point3d res;
acedCoordFromPixelToWorld(0,pix,out res);
}
}
To convert between UCS and WCS you can use the transformation matrix
returned by Editor.CurrentUserCoordinateSystem
Albert
We are in the process of customizing the DockingPalette C# sample found in
C:\ObjectARX 2006\samples\dotNet\DockingPalette.
We are attempting to insert an entity into the database at the X,Y drawing
coordinates where the user released the mouse button. We are able to
retrieve the X,Y pixel coordinates from System.Windows.Forms.DragEventArgs,
but have not found a way to translate those into X, Y coordinates useful for
inserting an entity at an accurate spot on the drawing. In addition, we
haven't found anyway to retrieve the current X, Y of the mouse position when
we receive our drop event.
Can anyone provide any guidance on either:
A) translating System.Windows.Forms.DragEventArgs X,Y coords into World
Coordinate or User Coordinate system X,Y values
B) retrieving World Coordinate or User Coordinate system X,Y values for the
current mouse position
BTW, we're I'd like to thank whoever got a .NET forum setup. We're looking
forward to a better repository of .NET knowledge for the ObjectARX api.
*Albert Szilvasy
Re: Cursor Coordinate Problems
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
05-19-2005 09:15 PM in reply to:
Trei
I don't have control over either of these types so I can't say whether this
will be safe assumption forever but they are certainly bit by bit compatible
right now.
Same is true for Point3d and double[3], Point2d and double[2].
Albert
"Tony Tanzillo" wrote in message
news:4851364@discussion.autodesk.com...
Hi Albert.
Thanks for the great samples.
Can we presume that System.Drawing.Point and CPoint are
call-compatible types?
--
http://www.caddzone.com
AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006
http://www.acadxtabs.com
"Albert Szilvasy" wrote in message
news:4851284@discussion.autodesk.com...
There's no first class .NET API to convert pixel to world coordinates and
back. You will need to P/Invoke 2 C++ APIs to accomplish this. Here's how to
do it:
public class ArxApi
{
[DllImport("acad.exe", CallingConvention = CallingConvention.Cdecl,
EntryPoint="?acedCoordFromPixelToWorld@@YAHHVCPoin t@@QAN@Z")]
extern static bool acedCoordFromPixelToWorld(int viewportNumber,
System.Drawing.Point pixel, out Autodesk.AutoCAD.Geometry.Point3d worldPt);
[DllImport("acad.exe", CallingConvention = CallingConvention.Cdecl,
EntryPoint="?acedCoordFromWorldToPixel@@YAHHQBNAAV CPoint@@@Z")]
extern static bool acedCoordFromWorldToPixel(int viewportNumber, ref
Autodesk.AutoCAD.Geometry.Point3d worldPt, out System.Drawing.Point pixel);
[CommandMethod("testpix")]
public void Test()
{
Point3d pt = new Point3d(0,0,0);
System.Drawing.Point pix;
acedCoordFromWorldToPixel(0,ref pt,out pix);
Point3d res;
acedCoordFromPixelToWorld(0,pix,out res);
}
}
To convert between UCS and WCS you can use the transformation matrix
returned by Editor.CurrentUserCoordinateSystem
Albert
wrote in message news:4849962@discussion.autodesk.com...
We are in the process of customizing the DockingPalette C# sample found in
C:\ObjectARX 2006\samples\dotNet\DockingPalette.
We are attempting to insert an entity into the database at the X,Y drawing
coordinates where the user released the mouse button. We are able to
retrieve the X,Y pixel coordinates from System.Windows.Forms.DragEventArgs,
but have not found a way to translate those into X, Y coordinates useful for
inserting an entity at an accurate spot on the drawing. In addition, we
haven't found anyway to retrieve the current X, Y of the mouse position when
we receive our drop event.
Can anyone provide any guidance on either:
A) translating System.Windows.Forms.DragEventArgs X,Y coords into World
Coordinate or User Coordinate system X,Y values
B) retrieving World Coordinate or User Coordinate system X,Y values for the
current mouse position
BTW, we're I'd like to thank whoever got a .NET forum setup. We're looking
forward to a better repository of .NET knowledge for the ObjectARX api.
will be safe assumption forever but they are certainly bit by bit compatible
right now.
Same is true for Point3d and double[3], Point2d and double[2].
Albert
"Tony Tanzillo"
news:4851364@discussion.autodesk.com...
Hi Albert.
Thanks for the great samples.
Can we presume that System.Drawing.Point and CPoint are
call-compatible types?
--
http://www.caddzone.com
AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006
http://www.acadxtabs.com
"Albert Szilvasy"
news:4851284@discussion.autodesk.com...
There's no first class .NET API to convert pixel to world coordinates and
back. You will need to P/Invoke 2 C++ APIs to accomplish this. Here's how to
do it:
public class ArxApi
{
[DllImport("acad.exe", CallingConvention = CallingConvention.Cdecl,
EntryPoint="?acedCoordFromPixelToWorld@@YAHHVCPoin
extern static bool acedCoordFromPixelToWorld(int viewportNumber,
System.Drawing.Point pixel, out Autodesk.AutoCAD.Geometry.Point3d worldPt);
[DllImport("acad.exe", CallingConvention = CallingConvention.Cdecl,
EntryPoint="?acedCoordFromWorldToPixel@@YAHHQBNAAV
extern static bool acedCoordFromWorldToPixel(int viewportNumber, ref
Autodesk.AutoCAD.Geometry.Point3d worldPt, out System.Drawing.Point pixel);
[CommandMethod("testpix")]
public void Test()
{
Point3d pt = new Point3d(0,0,0);
System.Drawing.Point pix;
acedCoordFromWorldToPixel(0,ref pt,out pix);
Point3d res;
acedCoordFromPixelToWorld(0,pix,out res);
}
}
To convert between UCS and WCS you can use the transformation matrix
returned by Editor.CurrentUserCoordinateSystem
Albert
We are in the process of customizing the DockingPalette C# sample found in
C:\ObjectARX 2006\samples\dotNet\DockingPalette.
We are attempting to insert an entity into the database at the X,Y drawing
coordinates where the user released the mouse button. We are able to
retrieve the X,Y pixel coordinates from System.Windows.Forms.DragEventArgs,
but have not found a way to translate those into X, Y coordinates useful for
inserting an entity at an accurate spot on the drawing. In addition, we
haven't found anyway to retrieve the current X, Y of the mouse position when
we receive our drop event.
Can anyone provide any guidance on either:
A) translating System.Windows.Forms.DragEventArgs X,Y coords into World
Coordinate or User Coordinate system X,Y values
B) retrieving World Coordinate or User Coordinate system X,Y values for the
current mouse position
BTW, we're I'd like to thank whoever got a .NET forum setup. We're looking
forward to a better repository of .NET knowledge for the ObjectARX api.

