BaseDraw and 2D drawing pen type

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) )

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://plugincafe.maxon.net/topic/5750/5797_drawhelper

-Nik

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