Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    Snapping to a specific position of an object plugin's object chain

    Cinema 4D SDK
    windows r23 2023 2024 python
    2
    2
    575
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • ThomasBT
      ThomasB
      last edited by ThomasB

      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

      Thanks,
      T.S.B

      ferdinandF 1 Reply Last reply Reply Quote 0
      • ferdinandF
        ferdinand @ThomasB
        last edited by ferdinand

        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

        MAXON SDK Specialist
        developers.maxon.net

        1 Reply Last reply Reply Quote 0
        • First post
          Last post