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
    1. Maxon Developers Forum
    2. Gaal Dornik
    3. Posts
    G
    • Profile
    • Following 0
    • Followers 0
    • Topics 9
    • Posts 26
    • Best 0
    • Controversial 0
    • Groups 0

    Posts made by Gaal Dornik

    • RE: How to weld two points to the last selected point?

      Considering this thread it looks like getting points selection order is not trivial task for c4d api.

      posted in Cinema 4D SDK
      G
      Gaal Dornik
    • RE: GetActiveToolData() doesn't work for Mirror Tool

      I want to mirror a polygon selection along specified modeling axis, but i'm kinda stuck since i can't apply the dedicated Mirror Tool, the basic Scale Tool also doesn't allow to set the tool settings...

      posted in Cinema 4D SDK
      G
      Gaal Dornik
    • RE: How to weld two points to the last selected point?

      @i_mazlov

      The problem with this code - it doesn't always work correctly. Sometimes it's not taking into account selection order - welds to the first selected point for example. Look at this preview.

      import c4d
      
      def main():
          doc = c4d.documents.GetActiveDocument()
          op = doc.GetActiveObject()
      
          lastPoint = op.GetPointS().GetLastElement()
      
          settings = c4d.BaseContainer()
          settings[c4d.MDATA_WELD_TOPOINT] = True
          settings[c4d.MDATA_WELD_POINTINDEX] = lastPoint
          settings[c4d.MDATA_WELD_OBJECTINDEX] = op
          
          doc.StartUndo()
          doc.AddUndo(c4d.UNDOTYPE_CHANGE, op)
          
          result = c4d.utils.SendModelingCommand(
                          command=c4d.ID_MODELING_WELD_TOOL,
                          list=[op],
                          mode=c4d.MODELINGCOMMANDMODE_POINTSELECTION,
                          bc=settings,
                          doc=doc,)                
          doc.EndUndo()
          c4d.EventAdd()
      
      if __name__=='__main__':
          main()
      
      posted in Cinema 4D SDK
      G
      Gaal Dornik
    • RE: Howto add headers & dividers for a ShowPopupDialog?

      It works as expected in C4D 2024, but not in the previous versions.

      posted in Cinema 4D SDK
      G
      Gaal Dornik
    • How to weld two points to the last selected point?

      Hello, currently this code welds two points in the middle, but i want it to weld to the last selected point, setting MDATA_WELD_TOPOINT to True doesn't help. How to solve this?

      import c4d, sys
      
      
      #
      # M A I N
      #
      def main():
          doc = c4d.documents.GetActiveDocument()
      
          settings = c4d.BaseContainer()
          settings[c4d.MDATA_WELD_TOPOINT] = True
          
          result = c4d.utils.SendModelingCommand(
                          command=c4d.ID_MODELING_WELD_TOOL,
                          list=[op],
                          mode=c4d.MODELINGCOMMANDMODE_POINTSELECTION,
                          bc=settings,
                          doc=doc,
                          flags=c4d.MODELINGCOMMANDFLAGS_CREATEUNDO)
      
          if not result:
              raise RuntimeError(f"Modelling command failed for {op}.")
      
          # Inform Cinema 4D that the document has been modified.
          c4d.EventAdd()
      
      
      # Execute main()
      if __name__=='__main__':
          main()
      
      posted in Cinema 4D SDK windows s26 2023 python
      G
      Gaal Dornik
    • RE: How to Apply a modeling command?

      Thanks man, i'll take a look at it!

      posted in Cinema 4D SDK
      G
      Gaal Dornik
    • RE: GetActiveToolData() doesn't work for Mirror Tool

      Are there any workarounds for this?

      posted in Cinema 4D SDK
      G
      Gaal Dornik
    • RE: Howto add headers & dividers for a ShowPopupDialog?

      Actually i've got 'Type to search' popup field in C4D 2023.2.0 also, but POPUP_ALLOW_FILTERING flag is omitted.
      Is there a way to hide it?

      posted in Cinema 4D SDK
      G
      Gaal Dornik
    • RE: How to create a radial (pie) menu?

      Thanks for your detailed answers, i hoped there is a simpler way to do it)...
      Pie menus is a very common thing nowadays, why maxon developers haven't implemented it already?
      In modo for example you can create pie menus, popups...etc without any coding.
      Not every user is ready/have the time/etc to learn python to build a simple popup, but almost every user needs to customize their working software.
      I really hope you'll implement these features soon.

      posted in Cinema 4D SDK
      G
      Gaal Dornik
    • GetActiveToolData() doesn't work for Mirror Tool

      Hi, i'm trying to change Mirror Tool settings, but when i get them using GetActiveToolData() it returns me 'None'. Also i've noticed that changing tool settings in the Attributes tab doesn't show up anything in the Script Log, usually i can see tool setting's name and corresponding value in the log.

      Tried both in C4D R26 and 2023.2.0.

      Is it a bug or i'm missing something?

      Thanks.

      import c4d
      
      def main():
          doc = c4d.documents.GetActiveDocument()
          
          c4d.CallCommand(14038) # Mirror
          settings = doc.GetActiveToolData()
          print("settings: %s" % settings)
          
          settings[c4d.MDATA_MIRROR_VALUE] = 0.0
          settings[c4d.MDATA_MIRROR_SYSTEM] = 0
      
          c4d.EventAdd()
      
      # Execute main()
      if __name__=='__main__':
          main()
      
      posted in Cinema 4D SDK windows s26 python 2023
      G
      Gaal Dornik
    • How to Apply a modeling command?

      Hello, i'm trying to make a quick flatten command with custom settings, but i can't find it in MCOMMAND list so it looks like i can't use SendModelingCommand which would be ideal for this. Right now i can change settings for the tool, but don't know how to hit 'Apply' button in Python.
      How can i do that?

      Thanks.

      posted in Cinema 4D SDK s26 windows python
      G
      Gaal Dornik
    • RE: How to create a radial (pie) menu?

      Thanks for your response.

      Currently i've done it using c4d.gui.ShowPopupDialog, it's not very fancy, but does the job.

      1. Do you know is there a way to show multiple ShowPopupDialog at once?
      2. Maybe i can modify the existing M_GLOBAL_POPUP in Python?
      posted in Cinema 4D SDK
      G
      Gaal Dornik
    • How to create a radial (pie) menu?

      Hello, i'd like to create a radial (pie) menu in Python similar to M_GLOBAL_POPUP (V key), but without submenus - just regular commands instead.

      Is that possible?

      In similar thread was a mention that this can be done using GeDialog and GeUserArea classes. Maybe somebody can show little example of it?

      posted in Cinema 4D SDK windows s26 python
      G
      Gaal Dornik
    • RE: Command Make Editable confusion

      Got it! Thanks.

      posted in Cinema 4D SDK
      G
      Gaal Dornik
    • Command Make Editable confusion

      Hello, i need to run Make Editable command via Python script. Aren't these the same thing?
      A. c4d.CallCommand(12236) # Make Editable
      B. c4d.CallCommand(c4d.MCOMMAND_MAKEEDITABLE)
      Command A runs just fine unlike B. Am i missing something?

      Thanks.

      posted in Cinema 4D SDK s26 windows python
      G
      Gaal Dornik
    • RE: Howto add headers & dividers for a ShowPopupDialog?

      That's indeed strange because i haven't included this flag for sure, but i can see this field at the top...

      posted in Cinema 4D SDK
      G
      Gaal Dornik
    • RE: Howto add headers & dividers for a ShowPopupDialog?

      BTW Is there a way to remove 'Type to search' at the top of a popup?

      posted in Cinema 4D SDK
      G
      Gaal Dornik
    • RE: Howto add headers & dividers for a ShowPopupDialog?

      That's great! Thanks a lot!)

      posted in Cinema 4D SDK
      G
      Gaal Dornik
    • RE: Howto add headers & dividers for a ShowPopupDialog?

      I also would like to know can i add icons to popup menus?

      posted in Cinema 4D SDK
      G
      Gaal Dornik
    • RE: Howto add headers & dividers for a ShowPopupDialog?

      Hi, i'm using gui.ShowPopupDialog.

      popup = c4d.BaseContainer()
      popup.SetString(ID_LIVE_SELECTION, "Live Selection")
      result = gui.ShowPopupDialog(cd=None, bc=popup, x=c4d.MOUSEPOS, y=c4d.MOUSEPOS)

      posted in Cinema 4D SDK
      G
      Gaal Dornik