Jump to content
Developer Wiki and Function Reference Links ×

record name


Recommended Posts

The SetRecordField node in the Record and IFC category will let you store values to record.field.

 

I don't see a node for getting the required name of the parameter record. 

 

The Vectorscript to get this would be:

 

GetName(GetParametricRecord(YourHandle));

 

This should give you a string representing the name of the record that you can use in the SetRecordField node.

 

Sorry, but I don't have time to make a node today.

Link to comment

ah ok, i made it with chatGPT.

 

@Marionette.NodeDefinition
class Params(metaclass = Marionette.OrderedClass):
#APPEARANCE
    #Name
    this = Marionette.Node( "Get Record Name" )
    this.SetDescription( 'Returns the value of a data record field. If the data record does not exist or is not attached, it returns false' )

    #Input Ports
    inObj = Marionette.PortIn( vs.Handle(0), 'hObj' )
    inObj.SetDescription( "The input object" )
    

    #OIP Controls

    #Output Ports
    obj = Marionette.PortOut('hObj')
    obj.SetDescription( "The original object" )
    recName = Marionette.PortOut('sRecName')
    recName.SetDescription("The name of the attached record")

#BEHAVIOR

def RunNode(self):
        # functions
        def getRecName(objHan):
            # This function returns the name of the first record attached to ObjHan, else an empty string
            totalRecCount = vs.NumRecords(objHan)
            if totalRecCount > 0:
                locRecHan = vs.GetRecord(objHan, 1)
                locRecName = vs.GetName(locRecHan)
                return locRecName
            return ''

      # inputs
        inObj = self.Params.inObj.value

        # script
        recName = getRecName(inObj)

        # outputs
        self.Params.recName.value = recName
        self.Params.obj.value = inObj

 

it returns 1 record name.

 

i failed to add an output with a list of the field names of this record.

 

Then i tried to list all attached records, but that does not work too.

 

😞

Link to comment
  • Marionette Maven

There's no way to update the OIP values of Marionette objects in the Shape Pane from another script, if you create Marionette Objects that get their values from Record Values, then you can change them from worksheets, scripts, etc. 

 

Can you give me a better description of what you're hoping to do with the file you've attached, or even just what you're trying to do generally?

 

It's possible to create a Marionette object that will draw based on record field values, but it would require setting up its own record format and would not be bidirectional with the record values and OIP Shape Pane values.

What this would mean is that if you want OIP (shape pane) values, you can't modify the shape of the object with the record, but if you're okay only modifying record fields to affect the object, then you could do all edits in the Data Pane or within database worksheets, etc. (this would mean no parameters will appear in the Shape Pane of the OIP)

Otherwise, you can use the OIP (shape pane) values to set the record values, but you cannot update the OIP (shape pane) values from editing the record.

Link to comment

i want to make an object node, which places red symbols like this

 

image.png.e05beee8f51658d1b03f918d0309465b.png

behind each segment of a named polygon.

 

i need to put the segments length into the red symbols.

 

with xg cabinets its working very good, except some unwanted behavior.

 

Therefore i read out the "record" of the red symbols and found

 

 

image.thumb.png.cf2c612b1c19b0e527642a05465d5dd5.png

 

but it seems, that there are no fields with the data i need.

 

 

So i need to remake the red symbol to make it be dynamic with a database?

 

The red symbol is not that easy. You saw it before.

 

 

But i dont know how to make the symbol react like now AND having a record with all the oip inputs.

Link to comment
  • Marionette Maven

There's a difference between how the XG Cabinets and a custom Marionette Object would work. 
The XG Cabinet is a Plug-in Object and was created with records and fields that relate to the parameters, and Marionette is able to access these values using the nodes as you've done with your other file.

 

Marionette Objects are not created the same way. They are not the same type of PIO, they're created using the Python API which was wrapped up in Marionette nodes. There's currently no direct relationship with the parameters exposed to the OIP and the record you're seeing when you request an attached record; that record is just part of the Marionette PIO, not what is created by it. Here's a screenshot showing the fields that are in the Record Format you've queried, none of which relate to the parameters in the OIP:
image.png

 

As I mentioned before, the Marionette Network could be written to attach a custom Record Format and store values from the OIP as Record Fields, or just allow users to manipulate the Record Fields to define the Marionette object, but there is currently no way to have the same bi-directional relationship that traditional PIOs have with OIP Parameters and Record Fields.

 

To do what you're hoping, you will have to edit the Marionette Network inside the Marionette Object Style to define the new relationships.

  • Like 1
Link to comment

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.

×
×
  • Create New...