Snapping to a specific position of an object plugin's object chain
-
An Object plugin returns an object chain with certain objects.
But now I need a point at a very specific position of the object where other objects created in Cinema 4D can snap to it.I have or rather wanted to solve this by creating an internal polygon object that is placed in the object chain with a point, for example. I then made the point visually visible using the Draw method
ObjectData.Draw(self, op, drawpass, bd, bh)
However, the snapping does not work properly. If you're too close, nothing will snap. If the snapping radius is too small, nothing works.
Am I completely on the wrong track or should I approach the whole thing differently? Sometimes there's just a lack of new things, and I can't always find everything in the Github examples...sometimes I have to laugh at myself, how stupid I want to start a spedific approach....Regards
-
Hey @ThomasB,
Thank you for reaching out to us. Without your code we cannot really help you, we are not the oracle of Delphi There are many things which could go wrong in your plugin. But in general what you are doing is correct; add a dummy point object with your snap points to your cache, when you want to introduce special snapping points for your custom generator object. Snapping onto the points of the returned geometry should work out of the box (but snapping sometimes struggles a bit with deep caches).
There is however only limited support for adding special snapping points, as it is not really intended to add you own snap logic in that manner. The
snapping
module both in Python and C++ does not allow you to implement your own snapping logic, you can just read some data.You should also keep in mind that the snapping is an older part of Cinema 4D which has its flaws. You should check if your problem also does occur when you try to snap onto the converted cache of your object (current state to object). If that is the case, you know it is not something your plugin does, but simply the fact that the snapping struggles with that specific geometry/scenario.
Cheers,
Ferdinand