Jump to content
Developer Wiki and Function Reference Links ×

Door


Recommended Posts

How can I make a Node in Marionette with a Script ?

Here is the Scipt. 

 

hTür = vs.WSScript_GetObject()

#Datenbank Tür
record = 'Door CW'
fieldname = 'Space1UUID'

#Datenbank Raum
recordRaum = 'Space'
fieldnamesRaum = ['11_Building','11_Floor','11_Room ID','11_Number']
dataRaum = []

#UUID von Raumnummer 1 auslesen
UUID = vs.GetRField(hTür, record, fieldname)
hRaum = vs.GetObjectByUuid(UUID)

#Die Felder Gebäude, Stockwerk, Wohnungsnummer und Raumnummer auslesen
for field in fieldnamesRaum:
	data = vs.GetRField(hRaum, recordRaum, field)
	dataRaum.append(data)

#Die Felder Gebäude, Stockwerk, Wohnungsnummer und Raumnummer zusammensetzten
raumnummerTür = dataRaum[0] +'.' + dataRaum[1] + dataRaum[2] + '.' + dataRaum[3]

#Resultat zurückgeben
vs.WSScript_SetResStr(raumnummerTür)

 

My new Friend ChatGPT tried to help me, but it doesn't work 😃
 

#COMMAND;READONLYREFFILE;[VWLibDef]/Records & IFC\Get Record Field.py;
#Created by [Your Name] on [Date]

@Marionette.NodeDefinition
class Params(metaclass=Marionette.OrderedClass):
    # APPEARANCE
    this = Marionette.Node("Get Room Number from Door")
    this.SetDescription('Returns the room number associated with a door.')

    # Input Ports
    inDoor = Marionette.PortIn(vs.Handle(0), 'hDoor')
    inDoor.SetDescription("The input door object")

    # Output Ports
    roomNumber = Marionette.PortOut('sRoomNumber')
    roomNumber.SetDescription("The room number associated with the door")

    success = Marionette.PortOut('bSuccess')
    success.SetDescription("True if operation was successful, false otherwise")

    # BEHAVIOR
    def RunNode(self):
        # Inputs
        hDoor = self.Params.inDoor.value

        # Database definitions
        recordDoor = 'Door CW'
        fieldUUID = 'Space1UUID'
        recordRoom = 'Space'
        fieldNamesRoom = ['11_Building', '11_Room ID', '11_Number']

        # Initialize output values
        roomNumber = ''
        success = False

        # Get the UUID from the door
        UUID = vs.GetRField(hDoor, recordDoor, fieldUUID)

        if UUID:
            # Get the room object by UUID
            hRoom = vs.GetObjectByUuid(UUID)

            if hRoom:
                # Gather room data
                dataRoom = []
                for field in fieldNamesRoom:
                    data = vs.GetRField(hRoom, recordRoom, field)
                    dataRoom.append(data)

                # Create room number string
                roomNumber = f"{dataRoom[0]}.{dataRoom[1]}.{dataRoom[2]}"
                success = True
            else:
                vs.AlrtDialog("Room not found for UUID: " + UUID)
        else:
            vs.AlrtDialog("UUID not found for the door.")

        # Outputs
        self.Params.roomNumber.value = roomNumber
        self.Params.success.value = success

 

can someone help me ?
 

I want to record the Roomnumber in a Database, so can i export the number with the Door in my IFC....

Best regards

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