ObjectIdExtensionTryGetObjectT Method |
Tries to open an AutoCAD object of the given type in the given open mode.
Namespace:
Gile.AutoCAD.R20.Extension
Assembly:
Gile.AutoCAD.R20.Extension (in Gile.AutoCAD.R20.Extension.dll) Version: 2.0.0.0 (2.0.0.0)
Syntaxpublic static bool TryGetObject<T>(
this ObjectId id,
Transaction tr,
out T obj,
OpenMode mode = OpenMode.ForRead,
bool openErased = false,
bool forceOpenOnLockedLayer = false
)
where T : DBObject
<ExtensionAttribute>
Public Shared Function TryGetObject(Of T As DBObject) (
id As ObjectId,
tr As Transaction,
<OutAttribute> ByRef obj As T,
Optional mode As OpenMode = OpenMode.ForRead,
Optional openErased As Boolean = false,
Optional forceOpenOnLockedLayer As Boolean = false
) As Boolean
public:
[ExtensionAttribute]
generic<typename T>
where T : DBObject
static bool TryGetObject(
ObjectId id,
Transaction^ tr,
[OutAttribute] T% obj,
OpenMode mode = OpenMode::ForRead,
bool openErased = false,
bool forceOpenOnLockedLayer = false
)
[<ExtensionAttribute>]
static member TryGetObject :
id : ObjectId *
tr : Transaction *
obj : 'T byref *
?mode : OpenMode *
?openErased : bool *
?forceOpenOnLockedLayer : bool
(* Defaults:
let _mode = defaultArg mode OpenMode.ForRead
let _openErased = defaultArg openErased false
let _forceOpenOnLockedLayer = defaultArg forceOpenOnLockedLayer false
*)
-> bool when 'T : DBObject
Parameters
- id
- Type: ObjectId
ObjectId to open. - tr
- Type: Transaction
Transaction or OpenCloseTransaction to use. - obj
- Type: T
Output object. - mode (Optional)
- Type: OpenMode
Open mode to obtain in. - openErased (Optional)
- Type: SystemBoolean
Value indicating whether to obtain erased objects. - forceOpenOnLockedLayer (Optional)
- Type: SystemBoolean
Value indicating if locked layers should be opened.
Type Parameters
- T
- Type of the output object.
Return Value
Type:
Booleantrue, if the operation succeeded;
false, otherwise.
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type
ObjectId. When you use instance method syntax to call this method, omit the first parameter. For more information, see
Extension Methods (Visual Basic) or
Extension Methods (C# Programming Guide).
ExceptionsException | Condition |
---|
Exception | eNullObjectId is thrown if id equals ObjectId.Null. |
ArgumentNullException | Thrown if tr is null. |
See Also