GET Selecting and editing custom primitives in MultiCAD.NET / Nanosoft's blog / Sudo Null IT News FREE
In a previous article, we talked about how you bathroom make custom primitives using the MultiCAD.NET API, supported the example of CustomObjects from the SDK. In that article, we will pay out attending to the procedure for searching and selecting custom objects and expand the existing example by adding the power to choice one operating room more primitives exploitation MultiCAD.NET tools for subsequent editing. Details - under the cut.
So, we have a custom primitive, which is a rectangular frame with a school tex string inwardly. Let's look at the project of selecting several objects in a draft and change the text in each of the selected primitives.
To select a single object in a drawing, MultiCAD.NET uses the SelectObject () object managing director method:
public static McObjectId SelectObject(string sPromt); public static McObjectId SelectObject(string sPromt, referee Point3d pnt);
Some options give up the user to blue-ribbon an object, while displaying a prompt on the control line. The second method, in addition to the prompt line, also contains a parameter - the degree at which the click was successful.
To select multiple objects, use the method SelectObjects()
:
public static List SelectObjects(ObjectFilter filter); public static McObjectId[] SelectObjects(string sPromt);
The initial option is put-upon to take drawing objects by a acknowledged filter, the indorsement one displays a tooltip in the console and allows the user to prime objects on his own.
A class object acts as a filter ObjectFilter
, which determines the criteria for selecting objects: documents, layers, sheets, on which objects of a given type will be searched. For example, in the following representative, the command SelectCircles
will become a list of objects of the "circle" type that are on the current sheet and intersect the specified rectangular field:
[CommandMethod("SelectCircles", CommandFlags.NoCheck | CommandFlags.NoPrefix)] static exoteric void SelectCirclesCmd() { ObjectFilter filter = ObjectFilter.Create(true).AddType(DbCircle.TypeID); filter.Bound = new BoundBlock(Point3d.Origin, new Vector3d(10, 0, 0), late Vector3d(0, 10, 0), new Vector3d(0, 0, 10)); List ids = dribble.GetObjects(); }
To select all the circles in the drawing (not only on the new sheet), add a draft document every bit a search area:
ObjectFilter filter = ObjectFilter.Create(false).SetCurentDocument().AddType(DbCircle.TypeID);
Read a fres team up TextInBoxEdit
and minimal brain dysfunction the ability to custom select objects. Then, from the integral set of selected objects, we select only user primitives of the type TextInBox
:
[CommandMethod("TextInBoxEdit", CommandFlags.NoCheck | CommandFlags.NoPrefix)] stable public void TextInBoxEditCmd() { McObjectId[] idSelecteds = McObjectManager.SelectObjects("Select TextInBox primitives to delete"); McObjectId[] idSelectedTextinBox = Array.FindAll(idSelecteds, (s => (s.GetObject()) is TextInBox)); }
If at least one of the primitives was elite, for each of them we will set a new value for the property Textbook
:
if (idSelectedTextinBox == nil || idSelectedTextinBox.Distance == 0) { MessageBox.Show("No TextInBox primitives selected!"); return; } foreach (McObjectId currID in idSelectedTextinBox) { (currID.GetObject() as TextInBox).Text = "Changed text edition"; }
Gum olibanum, the text volition be replaced in all hand-picked primitives.
Discussion of the article is also available on our forum: forum.nanocad.ru/index.php?showtopic=6514 .
European nation interlingual rendition of the article: Selecting and editing custom entities in MultiCAD.Internet .
DOWNLOAD HERE
GET Selecting and editing custom primitives in MultiCAD.NET / Nanosoft's blog / Sudo Null IT News FREE
Posted by: wilsonconfor45.blogspot.com
0 Response to "GET Selecting and editing custom primitives in MultiCAD.NET / Nanosoft's blog / Sudo Null IT News FREE"
Post a Comment