Jump to content

twk

Member
  • Posts

    877
  • Joined

  • Last visited

Posts posted by twk

  1. As others have stated, we;re limited with the vectorscript/python implementations provided by vectorworks.

    What I have done with other similar plugins, is a menu item that runs a script looking for changes across the document and updating relevant/linked plugins as needed.

  2. 1 hour ago, Vlado said:

     

    Oh wow, I haven't heard about this. Can you enter a JIRA with your workspace file that causes this? I wasn't able to reproduce it immediately.

    or you can send me the file over to vstanev@vectorworks.net, and I'll file it, to get fixed

     

    Yep have filed a bug (VB-196628), but it wasn't just my workspace.

    Even with the stock workspaces, once you edit the stock workspace and nest any of those tools (doesnt have to be all of them) it will cause the crash when exiting the Edit contours mode. I'll try and find time for a demo video illustrating.

     

    image.png.7d818f080cf8ae83eaedcf74fab467fc.png

     

  3. Well well well.. just spent the last 3 hours diagnosing what was happening and causing the crash.

    Turns out it wasn't:

    - a converted workspace

    - custom short cut keys for my workspace

    - or any custom plugins I had

     

    The Trial and Errors

    Before I unveil the culprit and the solution, share in my grief that which I painstakingly tried. (Side note, there were other anomalies found that were causing other crashes) :

    1. Converted multiple stock workspaces (ANZ, ANZ-BIM)

    2. Removed all shortcut keys

    3. Editing Tools and Menu Items to add our set of custom office shortcut keys

    4. Re-organised icon positioning and stacking within palettes to match our previous office workspace setouts.

     

    Test actions to trigger the crash

    1. Editing or just entering the contours space, for the -> Grade Limit Site Modifier's 'Define by Contours'

    2. Upon exiting, Vectorworks crashes

    The culprit(s):

    - Stacking Tools used in this mode (Reshape, Split, Trim, Clip, Pan, Zoom, and others).

    1. If these tools are stacked in my workspace it will cause the crash. They must be at the top most level in the tool palette

    2. When you're in this contour edit mode of the Grade Limits site modifier, you can see that these tools are not stacked beneath anything

    image.png.319e28a27865a52d2c9ca3949b039b71.png

     

     

    The solution:

    After all that testing, all I had to do was make sure that my custom workspace had these particular tools 'unstacked'. Ie not nested under another tool.

     

    If anyone has a spare moment can you test this by in your own workspace, nest one of these tools (any in my experience) and see if it crashes. 

    @Matt Panzer, @Vlado, it looks like the Contour Edit Palette above is causing some issues, I shall file a bug.

     

     

     

    • Like 4
  4. Apologies looks like there was an extra line after the 'while' call. correct below:

     

    # Define a function to list the names of all sheet layers in the current document
    def list_sheet_layer_names(excluded_layer_names=None):
        """
        @type filter_layer_names: exclusive layer names list ie, only these layers to be returned
        """
        layer_names = []
        hLayer = vs.FLayer()
    
        # Use a while loop and the NextLayer() function to iterate through all the sheet layers in the document
        while hLayer != None:
            if vs.GetObjectVariableInt(hLayer, 154) == 2:
                layer_name = vs.GetLName(hLayer)
                if excluded_layer_names:
                    if layer_name not in excluded_layer_names:
                        layer_names.append(layer_name)
                else:
                    layer_names.append(layer_name)
            hLayer = vs.NextLayer(hLayer)
    
        return layer_names

     

    • Like 1
  5. You know what, I misunderstood your question.

    You're wanting an excluded list.

    We'll revise the 'list_sheet_layer_names' function that accepts a list of sheets to be 'excluded' as a parameter.

     

    # Define a function to list the names of all sheet layers in the current document
    def list_sheet_layer_names(excluded_layer_names=None):
        """
        @type filter_layer_names: exclusive layer names list ie, only these layers to be returned
        """
        layer_names = []
        hLayer = vs.FLayer()
    
        # Use a while loop and the NextLayer() function to iterate through all the sheet layers in the document
        while hLayer != None:
            layer_names.append(hLayer)
            if vs.GetObjectVariableInt(hLayer, 154) == 2:
                layer_name = vs.GetLName(hLayer)
                if excluded_layer_names:
                    if layer_name not in excluded_layer_names:
                        layer_names.append(layer_name)
                else:
                    layer_names.append(layer_name)
            hLayer = vs.NextLayer(hLayer)
    
        return layer_names

     

    then when you run the iteration, you provide the list of sheet names you want excluded:

     

    # Iterate through all sheet layers in the current document
    # Say you want to exclude sheets 01, 05, 10, 12
    for layer in list_sheet_layer_names(['01', '05', '10', '12']):
    
        # Define criteria strings to find title blocks and viewports on the current layer
        titleblock_crit_str = f"(((L='{layer}') & (PON='Title Block Border')))"
        viewports_crit = f"(((L='{layer}') & (T=VIEWPORT)))"
    
        # Use the get_objects_from_criteria() function to get lists of title blocks and viewports on the current layer
        titleblocks = get_objects_from_criteria(titleblock_crit_str)
        viewports = get_objects_from_criteria(viewports_crit)
    <<< RESET OF CODE >>

     

     

     

  6. Good point @Pat Stanford. My workspace is probably converted from 2021 if I can recall correctly.

     

    It's strange though, editing the contours and updating the site model works fine if I'm on the Architect workspace, as soon as I change the workspace to my converted one, and then try to edit/update the contours through the grade limit, it crashes. And this is all within the same session.

     

    I would've thought the tools or the operations that run in the background are not dependent on anything stored in the workspace.

    But all good, will re-do a fresh workspace, it is about time.

  7. there was a mistake in the indent blocking for the last line of the loop, the hLayer = vs.NextLayer(hLayer) shouldn't be nested in the else portion. Fixed below:
     

    # Define a function to list the names of all sheet layers in the current document
    def list_sheet_layer_names(filter_layer_names=None):
        """
        @type filter_layer_names: exclusive layer names list ie, only these layers to be returned
        """
        layer_names = []
        hLayer = vs.FLayer()
    
        # Use a while loop and the NextLayer() function to iterate through all the sheet layers in the document
        while hLayer != None:
            layer_names.append(hLayer)
            if vs.GetObjectVariableInt(hLayer, 154) == 2:
                layer_name = vs.GetLName(hLayer)
                if filter_layer_names:
                    if layer_name in filter_layer_names:
                        layer_names.append(layer_name)
                else:
                    layer_names.append(layer_name)
            hLayer = vs.NextLayer(hLayer)
    
        return layer_names

     

    • Like 1
  8. revised list_sheet_layer_names below, added option to provide a list of layernames you want to only be returned.

     

    # Define a function to list the names of all sheet layers in the current document
    def list_sheet_layer_names(filter_layer_names=None):
        """
        @type filter_layer_names: exclusive layer names list ie, only these layers to be returned
        """
        layer_names = []
        hLayer = vs.FLayer()
    
        # Use a while loop and the NextLayer() function to iterate through all the sheet layers in the document
        while hLayer != None:
            layer_names.append(hLayer)
            if vs.GetObjectVariableInt(hLayer, 154) == 2:
                layer_name = vs.GetLName(hLayer)
                if filter_layer_names:
                    if layer_name in filter_layer_names:
                        layer_names.append(layer_name)
                else:
                    layer_names.append(layer_name)
                    hLayer = vs.NextLayer(hLayer)
    
        return layer_names

     

    • Like 2
  9.   

    On 3/24/2023 at 5:43 PM, Jesse Cogswell said:

    The key is SetObjectVariableInt with the selector set to 9743.  It's one of those nifty things not covered in the documentation.

    Hey Jesse cool find, two quick questions:

    1. How on earth did you find this. I have a run a content search accross the sdk zip file and found nothing regarding the 9743 variable

    2. I'm trying to do the reverse of this. If my active view is within a container, in my case the viewport annotation group, I want to exit this container via script. If I use my trick of vs.Layer(<layer i'm wanting to go to>) to set the active layer, my active view remains still in the annotations space. Maybe a bug, but I was wondering whether you knew of any other jedi variables.

     

    Cheers.

  10. Found the issue.

    I develop in the PyCharm IDE. When I'm doing rapid testing, I just run the Import/Run Script Command in Vectorworks and point to the py file. Which effectively runs the python script in Vectorworks. 99% of the time it works, except for these interactive functions I've just found out.

     

    However I can still develop in PyCharm, and rapid test, but I need to create a script resource in Vectorworks, and have the script hold the import functions call pointing to that py file/function from here. Then it works.

    Will submit a ticket

×
×
  • Create New...