public static McObjectId SelectObject(string sPromt); public static McObjectId SelectObject(string sPromt, ref Point3d pnt);
SelectObjects()
method: public static List SelectObjects(ObjectFilter filter); public static McObjectId[] SelectObjects(string sPromt);
ObjectFilter
, which defines the criteria for selecting objects: documents, layers, sheets, on which objects of a given type will be searched. For example, in the following example, using the SelectCircles
command, SelectCircles
will get a list of objects of the "circle" type, which are located on the current sheet and intersect the specified rectangular area: [CommandMethod("SelectCircles", CommandFlags.NoCheck | CommandFlags.NoPrefix)] static public void SelectCirclesCmd() { ObjectFilter filter = ObjectFilter.Create(true).AddType(DbCircle.TypeID); filter.Bound = new BoundBlock(Point3d.Origin, new Vector3d(10, 0, 0), new Vector3d(0, 10, 0), new Vector3d(0, 0, 10)); List<McObjectId> ids = filter.GetObjects(); }
ObjectFilter filter = ObjectFilter.Create(false).SetCurentDocument().AddType(DbCircle.TypeID);
TextInBoxEdit
and add the ability to custom select objects. Then, from the entire set of selected objects, we select only user primitives of the TextInBox
type: [CommandMethod("TextInBoxEdit", CommandFlags.NoCheck | CommandFlags.NoPrefix)] static public void TextInBoxEditCmd() { McObjectId[] idSelecteds = McObjectManager.SelectObjects("Select TextInBox primitives to edit"); McObjectId[] idSelectedTextinBox = Array.FindAll(idSelecteds, (s => (s.GetObject()) is TextInBox)); }
Text
property: if (idSelectedTextinBox == null || idSelectedTextinBox.Length == 0) { MessageBox.Show("No TextInBox primitives selected!"); return; } foreach (McObjectId currID in idSelectedTextinBox) { (currID.GetObject() as TextInBox).Text = "Changed text"; }
Source: https://habr.com/ru/post/200366/
All Articles