SDK example DgnECManagedEvents has this...
public DgnECInstanceCollection FindInstances (ECQuery query) { FindInstancesScope scope = FindInstancesScope.CreateScope (GetDefaultModel(), new FindInstancesScopeOption (DgnECHostType.All & ~DgnECHostType.File, true)); return DgnECManager.Manager.FindInstances (scope, query); }
What is the purpose of CreateScope (GetDefaultModel(), new FindInstancesScopeOption (DgnECHostType.All & ~DgnECHostType.File, true)? That seems to be telling MicroStation to look everywhere excepting the DGN file. Since it's creating the scope for a model, why not say FindInstancesScopeOption (DgnECHostType.Model, true)?
CreateScope (GetDefaultModel(), new FindInstancesScopeOption (DgnECHostType.All & ~DgnECHostType.File, true)
FindInstancesScopeOption (DgnECHostType.Model, true)
Hi Jon,
Definition of CreateScope is:
//!Create a scope which finds instances accessible through the given model. //! @param[in] modelRef The model defining the scope //! @param[in] options The options structure controls how the scope is iterated. DGNPLATFORM_EXPORT static FindInstancesScopePtr CreateScope (DgnModelRefR modelRef, FindInstancesScopeOptionCR options);
Now, in CreateScope (GetDefaultModel(), new FindInstancesScopeOption (DgnECHostType.All & ~DgnECHostType.File, true), scope is DefaultModel and scope option is all DgnECHosts except File. Meaning, search ECInstances hosted on Element, Model, DesignLink, View, Attachment, Level etc for a given model.
Please verify.
Thanks,
Mangesh
Answer Verified By: Jon Summers