TheSwamp

Code Red => .NET => Topic started by: nekitip on January 10, 2019, 03:01:12 AM

Title: DisposableWrapper Class
Post by: nekitip on January 10, 2019, 03:01:12 AM
What does
Code: [Select]
DisposableWrapper Class mean to us?
Can I safely copy a class inheriting from it, and apply to another object?

Here is the documentation:
https://help.autodesk.com/view/OARX/2019/ENU/?guid=OREFNET-Autodesk_AutoCAD_Runtime_DisposableWrapper (https://help.autodesk.com/view/OARX/2019/ENU/?guid=OREFNET-Autodesk_AutoCAD_Runtime_DisposableWrapper)

What I care about it is my "BURST" .NET atempt where I have Color class, and I'm thinking of copy color of object before doing setpropertiesfrom, and later returning to the same object. (check separate topic)
The documentation for color class:
https://help.autodesk.com/view/OARX/2019/ENU/?guid=OREFNET-Autodesk_AutoCAD_Colors_Color (https://help.autodesk.com/view/OARX/2019/ENU/?guid=OREFNET-Autodesk_AutoCAD_Colors_Color)
Title: Re: DisposableWrapper Class
Post by: MickD on January 10, 2019, 04:38:08 AM
The disposable wrapper is a class that wraps the native C++ ARX classes. Unless you are writing a custom object and need to wrap it for .Net consumption I wouldn't worry about it.
So short answer is yes but sometimes you may need to 'clone' to make a copy.

I'd just try it, it will definitely let you know if it fails :)
Title: Re: DisposableWrapper Class
Post by: nekitip on January 10, 2019, 03:43:11 PM
I did try, nothing happend for 5 minutes, I had no more patience :roll:. What is the normal time such things to fail?

Anyway, just to fill in, in this particular case, I've managed to find how to instead use EntityColor, which is, if I understand correctly, struct type, so there should be no problem with wrapped pointers. But my fears of wrappers still remain  :2funny: