Jump to content
Hans Martin Kern

Rotating custom objects?

Recommended Posts

All,

 

I'm trying to get my feet wet with creating Marionette nodes to support @Stephan Moenninghoff's  endeavours. As you would expect from an old fart I run into all kinds of problems, so please feel free to hit me with a rolled-up newspaper if my questions are way too basic.

 

My first "project" is a node creating any kind of custom object (code below). I tried both interiorcad's objects and stock VW plug-in objects. Works beautiful. 

 

If I route the custom object created by my node through the stock "Set 3D Rotation" Marionette node, the object is not rotated. I'm sure I'm missing something obvious here - any hints?

 

Thanks!

 

HMK

 

==

@Marionette.NodeDefinition
class Params(metaclass = Marionette.OrderedClass):
#APPEARANCE
    #Name
    this = Marionette.Node( "Create Custom Object" ) 
    this.SetDescription('Creates a custom object')

    #Input Ports
    universalName = Marionette.PortIn(0)
    universalName.SetDescription('The universal name of the custom object')
    position = Marionette.PortIn(0)    
    position.SetDescription('Insertion point of object instance')
    rotation = Marionette.PortIn(0)
    rotation.SetDescription('Rotation angle of object instance')
    showPropertiesDialog = Marionette.PortIn(0)
    showPropertiesDialog.SetDescription('Show the object''s properties dialog')
    
    #OIP Controls

    #Output Ports
    object = Marionette.PortOut('hObj')
    object.SetDescription('The resulting object instance')

#BEHAVIOR

def RunNode(self):
    #inputs
    universalName = self.Params.universalName.value
    position = self.Params.position.value
    rotation = self.Params.rotation.value
    showPropertiesDialog = self.Params.showPropertiesDialog.value
    
    #script
    customObject = vs.CreateCustomObjectN(universalName, position[0], position[1], rotation, showPropertiesDialog)
    
    #outputs                
    self.Params.object.value = customObject

Share this post


Link to post

Patrick, 

 

thanks for the hint. However, this leads to the inevitable question: How do rotate a custom-object without taking the current view into account? Coming from an SDK background, I would expect to set the custom object's 4x3 TransformMatrix and I'm done. 

 

HMK

Share this post


Link to post

Hans,

 

you just mentioned the solution. I forgot that there is a transfrommatrix-node.

The Rotate3D node could be fixed by checking the type for PlugIn objects and

using TransfMatrix in case.  (@Marissa Farrel   :))

Edited by Patrick Winkler

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


 

7150 Riverwood Drive, Columbia, Maryland 21046, USA   |   Contact Us:   410-290-5114

 

© 2018 Vectorworks, Inc. All Rights Reserved. Vectorworks, Inc. is part of the Nemetschek Group.

×
×
  • Create New...