Remove Object element from OM

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 22/01/2012 at 14:03, xxxxxxxx wrote:

User Information:
Cinema 4D Version:   12 
Platform:      
Language(s) :

---------
hi,
I'm wondering if it's possible to remove objects from the OM. What I'm trying is as soon as the user hits the button create Cinema 4D removes my plugin from the OM
I tried something like this.
 this.b.RemoveIndex(1000023);
-------------
this.b.Remove(1000023);
and some other remove's

this.b is the reference to the GetDataInstance(node) and the number is the Plugin ID

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 22/01/2012 at 18:58, xxxxxxxx wrote:

this->Remove();

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 23/01/2012 at 06:05, xxxxxxxx wrote:

at the moment it's not working becuase i think i've forgot to wrap a class into c#
I asuming that this->Remove() calls the Remove function from GeListNode.
So I was wondering why something like this wouldn't work

BaseObject remveObj = this.b.GetObjectLink(1000023,doc);
removeObj.Remove();

this.b is a BaseContainer  getting the Data from GetDataInstance(node);

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 23/01/2012 at 06:11, xxxxxxxx wrote:

Have you checked that the result of GetObjectLink() returns a valid object?  The object must be in the document referenced by 'doc'.  GetObjectLink() is a link in the BaseContainer.  Try this instead (not sure if C# has pointer references) :

BaseObject* removeObj = this.b.GetObjectLink(1000023,doc);
removeObj->Remove();

If C# doesn't then you will have to find a relevant way since the link isn't an object but a (memory) reference to it.

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 23/01/2012 at 06:57, xxxxxxxx wrote:

The weird thing is that i can delete meshs but not the plugin itself from the OM. I start to think that it's not possible within a plugin to delete or remove itself.

Did you tested if it works to remove a plugin through his own script?
Ok I tested it in the SDK with the Double circle it's not working C4D Crashes like it does when i try it with my c# script of my plugin

BaseContainer *bc = ((BaseObject* )node)->GetDataInstance();
  
			BaseObject *removeObj = bc->GetObjectLink(1001154,doc);
			removeObj->Remove();