.NET

Reply
Contributor
jgarciaanton
Posts: 20
Registered: ‎08-23-2006
Message 1 of 5 (263 Views)

PointEntity3D

263 Views, 4 Replies
10-16-2006 03:17 AM
Hi all,

In a previous post I was advised by Jason Booth (thanks Jason) to use the PointEntity2d or PointEntity3d classes in order to create a point which can be added to the database / model space.

I am unable to find any information on how to create an object with those classes. They have an " unusual " constructor,

Create(System.IntPtr unmanagedPointer, System.Boolean autoDelete)

Parameters
unmanagedPointer Input System.IntPtr object.
autoDelete Input System.Boolean object.

I understand that I need to create an unmanagedPointer to a point3D object, and then use it to crete the PointEntity3D. Am I correct ? How can it be done ?

I cannot find any reference to PointEntity3D on any Autodesk forum, and nothing useful on the rest of the internet , so any help will be very appreciated.

j.
Distinguished Contributor
Alexander Rivilis
Posts: 303
Registered: ‎09-26-2004
Message 2 of 5 (263 Views)

Re: PointEntity3D

10-16-2006 03:27 AM in reply to: jgarciaanton
It is not PointEntity2d or PointEntity3d but it is DBPoint:
Autodesk.AutoCAD.DatabaseServices.DBPoint
For example:
[code]
[CommandMethod("AddPoint")]
static public void AddPoint()
{
Document doc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
Database db = doc.Database;
Editor ed = doc.Editor;
PromptPointResult rs = ed.GetPoint("\nSelect point: ");
if (rs.Status == PromptStatus.OK)
{
DBPoint dbpt = new DBPoint(rs.Value); // If UCS != WCS you need translate point UCS->WCS
using (Transaction tr = db.TransactionManager.StartTransaction())
{
BlockTableRecord btr = tr.GetObject(doc.Database.CurrentSpaceId,OpenMode.ForWrite) as BlockTableRecord;
if (btr != null) {
dbpt.SetDatabaseDefaults(db);
btr.AppendEntity(dbpt);
tr.AddNewlyCreatedDBObject(dbpt,true);
}
tr.Commit();
}
}
}
[/code] Message was edited by: Alexander Rivilis
Contributor
jgarciaanton
Posts: 20
Registered: ‎08-23-2006
Message 3 of 5 (263 Views)

Re: PointEntity3D

10-16-2006 03:45 AM in reply to: jgarciaanton
Thanks a lot Alex, that solved it.

j.
Distinguished Contributor
jbooth
Posts: 223
Registered: ‎02-17-2006
Message 4 of 5 (263 Views)

Re: PointEntity3D

10-16-2006 07:57 AM in reply to: jgarciaanton
I should have noticed this since PointEntity2d and PointEntity3d are in the Autocad.Geometry namespace. Everything in that namespace from what I've seen can't be added directly to the drawing database (hence the reason for the Autocad.DatabaseServices namespace).

Sorry to confuse you, DbPoint is correct (as you already know).
Contributor
jgarciaanton
Posts: 20
Registered: ‎08-23-2006
Message 5 of 5 (263 Views)

Re: PointEntity3D

10-18-2006 07:02 AM in reply to: jgarciaanton
Hi Jason,

No worries, I actually learned quite a few things trying to get things to work with the PointEntity2d / PointEntity3d classes, plus its the intention that counts !

j.
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are You Going To Be @ AU 2014? Feel free to drop by our AU topic post and share your plans, plug a class that you're teaching, or simply check out who else from the community might be in attendance. Ohh and don't forgot to stop by the Autodesk Help | Learn | Collaborate booths in the Exhibit Hall and meet our community team if you get a chance!