yongbin Posted November 21, 2013 Share Posted November 21, 2013 Hi, How can I delete DOP object with python? I couldn't find delete method in hou.DopObject yet. Thank you, Quote Link to comment Share on other sites More sharing options...
kare Posted November 21, 2013 Share Posted November 21, 2013 (edited) node = hou.node("your_node_path") node.destroy() This snippet will delete your dop objects and any other network objects Edited November 21, 2013 by kare Quote Link to comment Share on other sites More sharing options...
yongbin Posted November 21, 2013 Author Share Posted November 21, 2013 Hi, kare. Thank you for your reply. But I need to choose objects for delete. Quote Link to comment Share on other sites More sharing options...
graham Posted November 21, 2013 Share Posted November 21, 2013 Unfortunately it would seem HOM does not have the ability to destroy simulation objects. You might be able to write an inlinecpp function that does this, but I haven't verified that such a thing is possible. Quote Link to comment Share on other sites More sharing options...
graham Posted November 21, 2013 Share Posted November 21, 2013 This inlinecpp function seems to work where you pass in your hou.DopNode and hou.DopObject: bool deleteDopObject(DOP_Node *node, SIM_Data *data) { DOP_Parent *parent = node->castToDOPParent(); if (!parent) { return false } SIM_Engine &engine = parent->getNonConstEngine(); if (data->getDataType() == "SIM_Object") { SIM_Object *obj = (SIM_Object *)data; engine.removeSimulationObject(obj); return true; } return false; } 1 Quote Link to comment Share on other sites More sharing options...
yongbin Posted November 22, 2013 Author Share Posted November 22, 2013 Hi, graham. Thank you for sharing your knowledge! I've tried import inlinecpp module and inlinecpp.createLibrary, but didn't success. Here is the code I tried. deleteDopObject = inlinecpp.createLibrary( name="cpp_del_dopobj", includes="", # WHAT SHOULD I INCLUDE?? function_sources=["""booldeleteDopObject(DOP_Node *node, SIM_Data *data){ DOP_Parent *parent = node->castToDOPParent(); if (!parent) { return false } SIM_Engine &engine = parent->getNonConstEngine(); if (data->getDataType() == "SIM_Object") { SIM_Object *obj = (SIM_Object *)data; engine.removeSimulationObject(obj); return true; } return false;}"""])[/CODE]I don't know what module should I include here. Maybe another problem could be also exist. What should I fix here?Thank you. Quote Link to comment Share on other sites More sharing options...
graham Posted November 22, 2013 Share Posted November 22, 2013 You basically need to set the includes to include the headers for all the objects that need to be used. Something like this should probably work: """#include <DOP/DOP_Parent.h> #include <DOP/DOP_Node.h> #include <SIM/SIM_Data.h> #include <SIM/SIM_Engine.h> #include <SIM/SIM_Object.h> """ 1 Quote Link to comment Share on other sites More sharing options...
yongbin Posted November 22, 2013 Author Share Posted November 22, 2013 I get it. Thank you graham. Here is another question. What is different between SIM_Object and SIM_Data? Because you converted it from object to data. I roughly guessing that it is same (almost?). Is it true? Quote Link to comment Share on other sites More sharing options...
yongbin Posted December 22, 2013 Author Share Posted December 22, 2013 Good news with this 13.0.268 release! I checked houdini journal and found this. Houdini 13.0.268: Added hou.DopSimulation.removeObject and hou.DopRelationship.removeRelationship to remove objects or relationships from a DOP simulation. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.