Editor.SelectCrossingWindow(
Posted: Mon Jul 22, 2024 11:15 pm
Dear Experts,
Can some body help why the below AutoCAD .Net code is not working in progeCAD using IntelliAD API. Hence, the work around we have done using CrossingPolygon. But can some body know the reason why cEditor.SelectCrossingWindow( is not working.
public static SelectionSet GetSelectionSet(string layerName, string entType, Point3d pnt)
{
Point3d upperPnt = new Point3d(pnt.X + 0.05, pnt.Y + 0.05, pnt.Z);
Point3d lowerPnt = new Point3d(pnt.X - 0.05, pnt.Y - 0.05, pnt.Z);
Editor cEditor = Application.DocumentManager.MdiActiveDocument.Editor;
TypedValue tType = new TypedValue(0, entType);
TypedValue tValue = new TypedValue(8, layerName);
ZoomCentre(pnt, 0.05);
SelectionFilter sFilter = new SelectionFilter(new TypedValue[] { tType, tValue });
PromptSelectionResult pSelResuult = cEditor.SelectCrossingWindow(upperPnt, lowerPnt, sFilter);
return pSelResuult.Value;
}
static public ViewTableRecord ZoomCentre(Point3d centre, double magnification)
{
Document doc = Application.DocumentManager.MdiActiveDocument;
Editor pEd = doc.Editor;
Point2d centPt = new Point2d(centre.X, centre.Y);
ViewTableRecord pViewTabRec = new ViewTableRecord();
pViewTabRec.CenterPoint = centPt;
pViewTabRec.Height = magnification;
pViewTabRec.Width = magnification;
pEd.SetCurrentView(pViewTabRec);
return pViewTabRec;
}
Below Coverted the above method to Crossing Polygon:
public static SelectionSet GetSelectionSet(string layerName, string entType, Point3d pnt)
{
Point3d upperPnt = new Point3d(pnt.X + 0.1, pnt.Y + 0.1, pnt.Z);
Point3d lowerPnt = new Point3d(pnt.X - 0.1, pnt.Y - 0.1, pnt.Z);
Editor cEditor = Application.DocumentManager.MdiActiveDocument.Editor;
TypedValue tType = new TypedValue(0, entType);
TypedValue tValue = new TypedValue(8, layerName);
ZoomCentre(pnt, 0.001);
cEditor.Regen();
SelectionFilter sFilter = new SelectionFilter(new TypedValue[] { tType, tValue });
Point3dCollection polygonPoints = new Point3dCollection
{
lowerPnt,
new Point3d(upperPnt.X, lowerPnt.Y, lowerPnt.Z),
upperPnt,
new Point3d(lowerPnt.X, upperPnt.Y, lowerPnt.Z),
lowerPnt
};
PromptSelectionResult pSelResult = cEditor.SelectCrossingPolygon(polygonPoints, sFilter);
return pSelResult.Value;
}
Thanks and Regards,
S.Srinivasa Rao,
Ph: 9322251303.
Can some body help why the below AutoCAD .Net code is not working in progeCAD using IntelliAD API. Hence, the work around we have done using CrossingPolygon. But can some body know the reason why cEditor.SelectCrossingWindow( is not working.
public static SelectionSet GetSelectionSet(string layerName, string entType, Point3d pnt)
{
Point3d upperPnt = new Point3d(pnt.X + 0.05, pnt.Y + 0.05, pnt.Z);
Point3d lowerPnt = new Point3d(pnt.X - 0.05, pnt.Y - 0.05, pnt.Z);
Editor cEditor = Application.DocumentManager.MdiActiveDocument.Editor;
TypedValue tType = new TypedValue(0, entType);
TypedValue tValue = new TypedValue(8, layerName);
ZoomCentre(pnt, 0.05);
SelectionFilter sFilter = new SelectionFilter(new TypedValue[] { tType, tValue });
PromptSelectionResult pSelResuult = cEditor.SelectCrossingWindow(upperPnt, lowerPnt, sFilter);
return pSelResuult.Value;
}
static public ViewTableRecord ZoomCentre(Point3d centre, double magnification)
{
Document doc = Application.DocumentManager.MdiActiveDocument;
Editor pEd = doc.Editor;
Point2d centPt = new Point2d(centre.X, centre.Y);
ViewTableRecord pViewTabRec = new ViewTableRecord();
pViewTabRec.CenterPoint = centPt;
pViewTabRec.Height = magnification;
pViewTabRec.Width = magnification;
pEd.SetCurrentView(pViewTabRec);
return pViewTabRec;
}
Below Coverted the above method to Crossing Polygon:
public static SelectionSet GetSelectionSet(string layerName, string entType, Point3d pnt)
{
Point3d upperPnt = new Point3d(pnt.X + 0.1, pnt.Y + 0.1, pnt.Z);
Point3d lowerPnt = new Point3d(pnt.X - 0.1, pnt.Y - 0.1, pnt.Z);
Editor cEditor = Application.DocumentManager.MdiActiveDocument.Editor;
TypedValue tType = new TypedValue(0, entType);
TypedValue tValue = new TypedValue(8, layerName);
ZoomCentre(pnt, 0.001);
cEditor.Regen();
SelectionFilter sFilter = new SelectionFilter(new TypedValue[] { tType, tValue });
Point3dCollection polygonPoints = new Point3dCollection
{
lowerPnt,
new Point3d(upperPnt.X, lowerPnt.Y, lowerPnt.Z),
upperPnt,
new Point3d(lowerPnt.X, upperPnt.Y, lowerPnt.Z),
lowerPnt
};
PromptSelectionResult pSelResult = cEditor.SelectCrossingPolygon(polygonPoints, sFilter);
return pSelResult.Value;
}
Thanks and Regards,
S.Srinivasa Rao,
Ph: 9322251303.