Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python 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

    "Vector Curl" on Volume Builder?

    Cinema 4D SDK
    python 2024
    2
    3
    552
    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.
    • justinleducJ
      justinleduc
      last edited by

      Hey guys,

      This is a quick one: I can't seem to be able to add a "Vector Curl" filter to my Volume Builder. No matter my settings, I always get a "Volume Filter" that is set to "Smooth".

      Here is the relevant portion of my code:

      # Create Null container
      nullContainer = c4d.BaseObject(c4d.Onull)
      nullContainer.SetName('Vectors Direction')
      doc.InsertObject(nullContainer)
      
      # Create volume builder object
      volumeBuilder = c4d.BaseObject(c4d.Ovolumebuilder)
      
      # Volume builder settings
      volumeBuilder[c4d.ID_BASELIST_NAME] = "Volume Builder 01"
      volumeBuilder[c4d.ID_VOLUMEBUILDER_VOLUMETYPE] = 2
      volumeBuilder[c4d.ID_VOLUMEBUILDER_GRID_SIZE] = 0.5
      
      # Volume filter
      volumeBuilderFilterCurl = c4d.BaseObject(c4d.Ovolumefilter)
      
      # Volume filter settings
      volumeBuilderFilterCurl[c4d.ID_VOLUMEFILTER_VECTOR_FILTER_TYPE] = 1
      
      volumeBuilder.InsertUnder(nullContainer)
      
      clonedActiveObject.InsertUnder(volumeBuilder)
      
      volumeBuilderFilterCurl.InsertUnder(volumeBuilder)
      

      Any help/insight would be greatly appreciated.

      Thank you!

      Justin

      1 Reply Last reply Reply Quote 0
      • i_mazlovI
        i_mazlov
        last edited by

        Hi Justin,

        Thank you for reaching out to us and providing your question with the explanatory code snippet, highly appreciated!

        Regarding your question, there are two points to mention:

        Firstly, you are using constant 1 for the c4d.ID_VOLUMEFILTER_VECTOR_FILTER_TYPE parameter, which targets "normalize" type rather than "curl" type (which corresponds to value 0). I suggest using the literal constants instead, e.g. change the line in your code from

        volumeBuilderFilterCurl[c4d.ID_VOLUMEFILTER_VECTOR_FILTER_TYPE] = 1
        

        to

        volumeBuilderFilterCurl[c4d.ID_VOLUMEFILTER_VECTOR_FILTER_TYPE] = c4d.ID_VOLUMEFILTER_VECTOR_FILTER_TYPE_CURL
        

        You can find the full parameter list on the page: volumes/description/ovolumefilter.h

        Secondly, you forgot to set the volume filter type to vector. Just add the following line after initializing the filter object:

        volumeBuilderFilterCurl[c4d.ID_VOLUMEFILTER_VOLUME_TYPE] = c4d.ID_VOLUMEFILTER_VOLUME_TYPE_VECTOR
        

        This parameter is not referenced in python docs (sometimes it can happen), so it is worth double checking in the C++ documentation: ovolumefilter.h File Reference

        Cheers,
        Ilia

        MAXON SDK Specialist
        developers.maxon.net

        1 Reply Last reply Reply Quote 1
        • justinleducJ
          justinleduc
          last edited by

          Hey @i_mazlov, thank you so much for your incredibly helpful and thorough reply. This is exactly what I was looking for.

          Thanks again! I really appreciate it!

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