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
  • 3 months later...

Hallo @KingChaos,

 

first of all, I must mention that the areas we are about to delve into are complex and cannot be managed without proper debugging.

The relevant knowledge should also be present to some extent to be able to assess any errors that occur.

@Marissa Farrell has already explained it well regarding the databases. I will also briefly add my contribution here:

Basically, the database is a trash can. It takes in data and spits it out again.

In the normal Marionette objects, if the database is linked, the object writes certain values into this database, usually controlled by the OIP.

The “set record field” can be integrated into the network for this purpose. It is not possible for the database to change the object without further ado.

And here we are at the topic.

 

Without further ado:

attached you will find your adjusted file

Stange.thumb.png.aab6b2a658a3044879556cd4070036a7.png

There are two nodes from @DomC, get/set Marionette OIP Field.

Get and Set Marionette OIP Parameter

 

I had to modify these nodes a bit because I couldn’t manage to read/write the OIP strings.

Maybe it’s a version issue or I’m doing something wrong. But they work for you now 😉. Also, without the “End + Update” or Pass that I wrote, not much happens.

The script updates the values in the objects, but the objects themselves need to be updated. To remove this manual process, this node is placed at the end.

Maybe there’s a purpose where the Pass is useful. I still need to write an article and debug the node more thoroughly. So be warned!!! Not all values like to be updated.

Together with the record fields, endless possibilities arise for writing, reading, processing, and reproducing in the object.

 

Final word:

It is important to clean up at the end and know where the data is processed to decide how the logic of the entire project looks.

It doesn’t make sense to have the complete script in all objects. I prefer to distinguish between “active” and “passive” networks. An active network is the pillar for me. Here, only data that must really be actively influenced by this object is visible and stored, and can only be entered at this point, i.e., in the object itself, usually in the OIP.

Otherwise, I try to keep it as passive as possible to preserve performance. A passive network would be a menu command that is only executed when the user manually triggers it. Only then are the final data processed. Not in between while the pillar is constantly being moved from A to B.

 

I hope I could help you a bit and wish you much success and good luck.

 

{Moderator note: Incorrect file uploaded so removed. Check further down in this thread for the download Pat Stanford}

Best regards

 

  • Like 1
Link to comment

@Zuzzla
Thanks for noting that. After all this is right. The node uses the key varName which represent the internal name. the key 'text' represents the visible parameter name. Because i use "if name in varName" and not name == varName it worked for me while i always not check with the full name.
However the "text" key was the right one to use. 

image.thumb.png.106c1ef7a2d6f471980124eb46da64d2.png

  • 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...