.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

PointEntity3D

4 REPLIES 4
Reply
Message 1 of 5
jgarciaanton
519 Views, 4 Replies

PointEntity3D

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.
4 REPLIES 4
Message 2 of 5
Anonymous
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
Message 3 of 5
jgarciaanton
in reply to: jgarciaanton

Thanks a lot Alex, that solved it.

j.
Message 4 of 5
jbooth
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).
Message 5 of 5
jgarciaanton
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.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost