Hi,
I am removing a CustomJoint from my model and replacing it with a new PinJoint, using model.updJointSet().remove(joint);
When I remove the CustomJoint, the coordinates are accordingly removed, but this causes problems if other components depend on the removed coordinates. In this example, I have a SpringGeneralizedForce who's <coordinate>knee_add_r</coordinate> property is the name of one of the deleted coordinates.
I know I can use model.findComponent to access the location of a specific component. Is there a method to find all references to a component such that I could detect the problem above?
I think this specific example is slightly out dated as the <coordinate> property should probably be a socket if SpringGeneralizedForce were refactored. Is there a way to find all sockets that reference a specific component?
find all references to a component in a model
- Colin Smith
- Posts: 53
- Joined: Fri Feb 24, 2012 11:50 am
- Ayman Habib
- Posts: 2248
- Joined: Fri Apr 01, 2005 12:24 pm
Re: find all references to a component in a model
Hi Colin,
Generally speaking, one main issue with the approach you're trying is that you need a built/connected model to query it about connections/sockets etc. if you change joint type for example, you need to re-initialize the system and this will fail if there're any missing or invalid connections. Practically you only have XML/Properties to work with to fix/produce a valid model so text or XML editing could be the best way to go. The fact that some objects in the model use names while others use Sockets makes it a bit more challenging but with unique naming in-place, hopefully it's less error prone.
Being able to locate references would be useful for something like renaming a Component (that should in fact be supported) but is not supported by the current functionality.
Hope this helps,
-Ayman
Generally speaking, one main issue with the approach you're trying is that you need a built/connected model to query it about connections/sockets etc. if you change joint type for example, you need to re-initialize the system and this will fail if there're any missing or invalid connections. Practically you only have XML/Properties to work with to fix/produce a valid model so text or XML editing could be the best way to go. The fact that some objects in the model use names while others use Sockets makes it a bit more challenging but with unique naming in-place, hopefully it's less error prone.
Being able to locate references would be useful for something like renaming a Component (that should in fact be supported) but is not supported by the current functionality.
Hope this helps,
-Ayman