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
    • Recent
    • Tags
    • Users
    • Login

    BaseDraw and 2D drawing pen type

    Scheduled Pinned Locked Moved PYTHON Development
    3 Posts 0 Posters 322 Views
    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.
    • H Offline
      Helper
      last edited by

      On 01/06/2013 at 03:53, xxxxxxxx wrote:

      Hi !

      I'm trying to do some 2D drawing using the 2D drawing methods from BaseDraw (DrawLine2D, DrawCircle2D, and so on...).

      I can change the color of the drawing, but I couldn't find a way to :
      - draw continuous lines (I can only get dashed lines)
      - change the thickness of the lines

      Is this possible ? How ? (I've searched through the doc, but found only the SetPointSize method which seem to have no effect)

      Thanks !

      Olivier

      from c4d import \*
      #Welcome to the world of Python
      
      def main() :
          draw = doc.GetActiveBaseDraw()    
          
          #ligne rouge
          draw.SetPen(Vector(255,0,0))   
          draw.DrawLine2D( Vector(200,170,0),  Vector(360,150,0) )
          
          #cercle vert
          draw.SetPen(Vector(0,255,0))   
          draw.DrawCircle2D(250,230,40 )
          
          #ligne bleue
          draw.SetPen(Vector(0,0,255))   
          draw.SetPointSize(5) #aucun effet
          draw.DrawLine2D( Vector(200,320,0),  Vector(360,300,0) )
      
      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

        On 01/06/2013 at 04:44, xxxxxxxx wrote:

        You can not draw from a Python Tag. You can use my DrawHelper plugin or implement your own Tag
        plugin and override the Draw() method.

        https://developers.maxon.net/forum/topic/5750/5797_drawhelper

        -Nik

        1 Reply Last reply Reply Quote 0
        • H Offline
          Helper
          last edited by

          On 01/06/2013 at 04:46, xxxxxxxx wrote:

          Your code is correct and should draw in a non xor fashion. However gui operations from
          a script are not supported / allowed. Difficult to say why it does draw in xor mode, as 
          BaseDraw doesn't offer a xor mode on its own.

          Hm, tried the script and for me it does draw as expected in non xor mode. Might be
          something hardware/os/scene specific, so that you end up in a different draw pass
          than me. Doing BaseDraw drawing operations from a script is simply not a good idea.

          For the line width - You simply cannot change the line width. BaseDraw.SetPointSize()
          is meant to be used with BaseDraw.DrawPoints() which is still broken in python I think.

          ps : importing everything from c4d is a bad idea

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