0

how to use RVPaint with Python ?

Hi,

Iam trying to draw a cube with RVpaint but can't figure it out. This is what i got at the moment :

nodetxt = 'sourceGroup000000_paint'
frame = commands.frame()
user = 'test'

points = [[0.0,0.0],[0.1,0.0],[0.1,0.1],[0.0,0.1]]

node = '%s.pen:%s:%s:%s' % (nodetxt,0,frame, user)

commands.newProperty('%s.points' % node, commands.FloatType, 2)
commands.newProperty('%s.color' % node, commands.FloatType, 4)
commands.newProperty('%s.width' % node, commands.FloatType, 1)
commands.newProperty('%s.active' % node, commands.IntType, 1)
commands.newProperty('%s.brush' % node, commands.StringType, 1)

for point in points:
  commands.setFloatProperty('%s.points' % node,  point, True)

commands.setFloatProperty('%s.color' % node, [ 1.0, 0.0, 0.0, 0.5 ], True)
commands.setFloatProperty('%s.width' % node, [width], True)
commands.setIntProperty('%s.active' % node, [ 1 ], True)
commands.setStringProperty('%s.brush' % node, [ 'circle' ], True)

 

Am i missing something ? I can draw RVOverlay without any issue, but RvPaint doesnt seem to work for me ...

 

5件のコメント

  • 0
    Avatar
    Jon Morley

    Hi Nicolas,

    Could you please save the resulting session file and send that to us?

    I think you want to set the points property all at once rather than in a for loop like so:

    commands.setFloatProperty('%s.points' % node,  points, True)

    Thanks,
    Jon

  • 0
    Avatar
    nicolas

    Yes, i join an RV session file here.

     

    setting "points" at once with a list such as

    commands.setFloatProperty('%s.points' % node,  points, True)

    return this error:

    <!--StartFragment-->ERROR: Bad argument (1) to function commands.setFloatProperty: expecting float 

  • 0
    Avatar
    Jon Morley

    Hi Nicolas,

    It appears that structuring your float input as seen in the session file is not necessary. I was successful using:

    points = [0.0,0.0,0.1,0.0,0.1,0.1,0.0,0.1]
    rv.commands.setFloatProperty('%s.points' % node,  point, True)

    Please give that a shot and tell me if it works for you as well.

    Thanks,
    Jon

  • 0
    Avatar
    nicolas

    Thanks for the answer Jon,

    Using your code doesn't give any error, but i don't see anything drawing on screen either. Does it give you the result you expected on your side ? If yes, could you send me the rest of the code you used please ?

  • 0
    Avatar
    Jon Morley

    Hi Nicolas,

    I used rvshlell connected to a running RV to send the remote-pyeval command:

    rv.commands.setFloatProperty('defaultSequence_p_sourceGroup000000."pen:1:1:jon".points',  [0.0,0.0,0.1,0.0,0.1,0.1,0.0,0.1], True)

    It worked to draw a somewhat centered backwards "C" shape. That seems to fit the points you provided when you take into consideration the annotation tool attempts to draw a continuous stroke through the points. It doesn't simply connect the dots.

    Perhaps it would be better to know your larger picture goals here. What are you trying to accomplish?

    Thanks,
    Jon

ログインしてコメントを残してください。