Jump to content

Vectorworks Worksheets Reference flexible (VW-24 Landscape)


Recommended Posts

Hello, 

 

we are trying to find a way with Pythenscript to Refrence VW-Worksheets a bit flexibel. 

 

We are having different Worksheets. 

 

We want to Refence one Worksheet with another Worksheet and trying to find out a way that Worksheetname for Reference can be flexible. 

 

At the moment with VW-Ref Function, the Worksheetname ist fixed and needs tobe changed if the Worksheetname has been updated. 

 

We also try to Run Python-Script in Vectorworks but not able to find out a way, how to retrive a PS result in a Worksheet. 

 

We are using this Function: 

 

=DATENBANKDURCHSCRIPT(120; 'Landschaft/Script.py')

 

but unfortunately can not see what ist the output. 

 

We tried to find a Solution to List all our current Worksheet in some kind of Meta-Worksheet. 


The Python Script should iterate these objects and we would like to process the results within the RunScript Worksheet-Function but without success so far 😐:
 

def list_all_tables():
    # Eine leere Liste, um die Handles aller gefundenen Tabellen zu speichern
    table_handles = []

    # Erste Objekt im Dokument
    h = vs.FActLayer()

    # Durch alle Objekte im Dokument iterieren
    while h != vs.Handle(0):
        # Überprüfen, ob das aktuelle Objekt eine Tabelle (Worksheet) ist
        if vs.GetTypeN(h) == 47:  # 47 ist der Objekttyp für Worksheets in Vectorworks
            # Das Handle der Tabelle zur Liste hinzufügen
            table_handles.append(h)
        
        # Zum nächsten Objekt übergehen
        h = vs.NextObj(h)

    # Alle gefundenen Tabellenhandles an die Tabellenschnittstelle übergeben
    for id, h in enumerate(table_handles, start=1):
        vs.WSScript_AddHandleId(h, id)

# Die Funktion aufrufen, um alle Tabellen aufzulisten
list_all_tables()


We would be very grateful for any tips or information 😃

Link to comment

I am a Vectorscript guy, not a Python guy,  but your script looks ok to me.

 

Do you get database subrows when you se the row criteria to be DatabaseByScript [DATENBANKDURCHSCRIPT]?

 

Try putting the script in a script palette and remove the 120 from the start of the DATENBANKDURCHSCRIPT call. That way you can see if the problem is the script or the file location.

 

Here are a couple of posts I have made about DatabaseByScript:

 

 

 

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