TraceBoundary with another usercoordinate system in c#
Hi, i have a Problem with the TraceBoundary Function
The Function do but when a change the usercoordinate system the TraceBoundary Function give me a DBObjectCollection with Count = 0.
When i change my user coordinate system, it's works.
Here my code:
using (var tr = db.TransactionManager.StartTransaction())
{
AcAp.Document acDoc = AcAp.Application.DocumentManager.MdiActiveDocument;
AcDataService.Database acCurDb = acDoc.Database;
PromptPointOptions pPtOpts = new PromptPointOptions("");
// Prompt for the first point
pPtOpts.Message = sMessageFirstPoint;
var ppr = acadEditor.GetPoint(pPtOpts);
if (ppr.Status != PromptStatus.OK)
{
System.Windows.Forms.MessageBox.Show(AKGStrings.PickPointsErrorText, AKGStrings.PickPointsErrorTitle, System.Windows.Forms.MessageBoxButtons.OK,System.Windows.Forms.MessageBoxIcon.Exclamation);
return null;
}
var objs1 = acadEditor.TraceBoundary(ppr.Value, true);
var myObjs1 = objs1;
if (objs1.Count != 1 || !(objs1[0] is AcDataService.Polyline))
{
foreach (AcDataService.DBObject dBObject in objs1) dBObject.Dispose();
//Show Message Box
System.Windows.Forms.MessageBox.Show(AKGStrings.PickPointsErrorText, AKGStrings.PickPointsErrorTitle, System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Exclamation);
return null;
}
Could you please help me ?
Thanks
The Function do but when a change the usercoordinate system the TraceBoundary Function give me a DBObjectCollection with Count = 0.
When i change my user coordinate system, it's works.
Here my code:
using (var tr = db.TransactionManager.StartTransaction())
{
AcAp.Document acDoc = AcAp.Application.DocumentManager.MdiActiveDocument;
AcDataService.Database acCurDb = acDoc.Database;
PromptPointOptions pPtOpts = new PromptPointOptions("");
// Prompt for the first point
pPtOpts.Message = sMessageFirstPoint;
var ppr = acadEditor.GetPoint(pPtOpts);
if (ppr.Status != PromptStatus.OK)
{
System.Windows.Forms.MessageBox.Show(AKGStrings.PickPointsErrorText, AKGStrings.PickPointsErrorTitle, System.Windows.Forms.MessageBoxButtons.OK,System.Windows.Forms.MessageBoxIcon.Exclamation);
return null;
}
var objs1 = acadEditor.TraceBoundary(ppr.Value, true);
var myObjs1 = objs1;
if (objs1.Count != 1 || !(objs1[0] is AcDataService.Polyline))
{
foreach (AcDataService.DBObject dBObject in objs1) dBObject.Dispose();
//Show Message Box
System.Windows.Forms.MessageBox.Show(AKGStrings.PickPointsErrorText, AKGStrings.PickPointsErrorTitle, System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Exclamation);
return null;
}
Could you please help me ?
Thanks
0
Comments
-
You should translate the selected point from UCS to WKS coordinates...!
You can use just one line of code...
Point3d curPt = ppr.Value.TransformBy(ed.CurrentUserCoordinateSystem);
var objs1 = acadEditor.TraceBoundary(curPt, true);0 -
Hi Sakko,
thanks for your reply.
You have right, but this is a workaround from bricsys.
A bug was confirmed and it will be fix in Version 25.0