Jump to content

twk

Member
  • Posts

    877
  • Joined

  • Last visited

Posts posted by twk

  1. This is very interesting, I've never thought to use the interaction tools like this.

    Would this mean that we would have to run separate scripts lanuages for either operation? ie (pascal for interaction, python for everything else).

  2. I use Pycharm to develop, which as VCS integration either using Githubg/Bitbucket/etc.

    I dont use resource files at the moment (I assume you're meaning the vwr pacakges?)

    Folder structure setup is as below:

     

    - Workgroup Folder (Setup/pointed to in the Vectorworks Preferences). Eg (C:\VW Preferences\2022)

    - Setting this in the Vectorworks Preferences causes vectorworks to setup the required folder structure (that vectorworks uses) for use as a Workgroup folders. Which adds folders such as: Libraries, Plug-ins, Settings, Workspaces, etc. I keep all my plugins (.vso, .vsm, etc) files in the Plug-ins folder, together with my scripts for them.

    - The plugin development project folder is in the Plug-ins folder, which is what the PyCharm project points to.

    - This way Pycharm manages the version control for both the script modules and the vectorworks custom plugin files (vso, vsm, vst)

     

     

  3. Wow have these replies filled my inbox, have had to turn off notifications for this topic!

     

    So things seem a bit clearer since I last read..

    1. Service Select   IS NOT THE SAME AS   Subscriptions

    2. Service Select = Perpetiual License | ie | When you stop service select you get to keep Vectorworks whatever version you've stopped at

    3. Subscription = Non Perpetual License | ie | When you stop subscription you lose access to using Vectorworks

    • Like 3
  4. Thanks, ok, so first things first, I am not familiar with the Spotlight tools,lol. (VW Architect version user). But I assume the plugins work the same.

    I'm still not following the diagram above. Am trying to figure out what objects are what.

    - Is the gray truss a vectorworks object? I assume the magenta ones are the spotlight fixtures, and your custom plugin is the one labelled Soca breakout?

    - And the grey lines are also another custom plugin? The cables one?

     

    Each plugin will have an insertion point and a rotation value attached to it. I would start there and use basic trignometry (soh, cah, toa) to get exact locations and orientations of each object. Then using the vs.Distance call on the values you've calculated.

     

    Could you share a dummy vwx file. I also have a Designer version that can open spotlight stuff.

     

    Cheers,

    Tui

  5. Spot on @Christiaan. The yearly cycles are a headache precisely because of the number of major features included in a yearly release. If features were spread out over the year, users could focus on learning a new feature for each quater then use that in the next quarter, instead of spending 3quarters of the year learning and trying to implement new featuers/workflows, almost in time for another yearly release with another new set of features or workflows.

    • Like 4
  6. Should have searched, found this little nugget from @Pat Stanford

      

    On 1/24/2020 at 8:12 AM, Pat Stanford said:

    3. It is possible that under the current state of Vectorscript/VW2020 that we can not make a 100% accurate report. Is a mostly accurate report worth anything?  There is no way to query a storey and find out the levels that are associated. What I am doing now is making a list of all of the level types in the file and trying to assign each one to the story. If it succeeds then I assume that that level was not associated and delete it. If is fails, then I am assuming that the level already exists and adding it to the spreadsheet. Unfortunately, the way you add a level is by specifing the name of the level type. In your example above with two levels named Ceiling, I don't have a way to identify them separately.

     

    code below:

    ## LEVELS
    def get_all_level_types_in_document():
        doc_level_types = vs.GetNumLayerLevelTypes()
        level_type_names = []
        for i in range(doc_level_types):
            level_type_name = vs.GetLevelTypeName(i+1)
            level_type_names.append(level_type_name)
    
        return level_type_names
    
    ## GET LEVELS ASSOCIATED WITH A STORY
    def stories_level_elevations(story_name:str):
        data = []
        doc_level_types = get_all_level_types_in_document()
        story_handle = vs.GetObject(story_name)
        
        for level_type in doc_level_types:
            elev = vs.GetLevelElevation(story_handle,level_type)
            result = vs.AddStoryLevel(story_handle, level_type, -123, '') # DUMMY LEVEL ASSOCIATION
            
            if result: # result is true if level not associated with Story, therefore we delete this temp association
                vs.RemoveStoryLevel(story_handle, level_type, False)
            else:
                data.append(f"Level Type {level_type}, Elevation : {elev}")
    
        return data
    
    stories_level_elevations("L2")

     

  7. AFAIK those layer calls cannot use wildcards.

    Here's some code for design layers you could use to adapt for classes as well.

     

    # First build a list of design layers
    def get_design_layers():
        layer_names = []
        layer_handle = vs.FLayer()
        while layer_handle != None:
            layer_type = vs.GetObjectVariableInt(layer_handle, 154) # filter out design layers only. (1 = Design Layer, 2 = Sheet Layer, 3 = Referenced Layer)
            if layer_type == 1:
                layer_names.append(vs.GetLName(layer_handle))
                layer_handle = vs.NextLayer(layer_handle)
    
        # we now reverse sort the layer_names list. For some reason this method retrieves layers in reverse order of the stack shown in the Navigation Pallette.
        layer_names.reverse()
    
        return layer_names
    
    # Code for controling visibility of design layers
    def set_visibility(design_layer_name:str, layer_visibility:int, document_design_layers:[str]):
        #  0 = Visible, -1 = Hidden, 2 = Grayed
            
        if design_layer_name in document_design_layers: # this line makes sure we don't create a new design layer using next line of code
            vs.Layer(design_layer_name) # only way to activate/jump to the layer we want, this call also creates design layers if the name provided doesnt exist
            # then we apply visibilities
            if layer_visibility == 0:
                vs.ShowLayer()
            elif layer_visibility == -1:
                vs.HideLayer()
            elif layer_visibility == 2:
                vs.GrayLayer()     
    
    # Code for filtering visibility of design layers
    def layer_visibility(layer_name:str, layer_visibility:int, document_design_layers:[str]):
        # cycle through design layer names, if layer_name parameter matches any design layer in design layer list, apply layer visibilty
    
        # Store current layer, this will make sense later
        cur_layer = vs.GetLName(vs.ActLayer())
        
        for design_layer_name in document_design_layers:
            if layer_name in design_layer_name:
                set_visibility(design_layer_name, layer_visibility, document_design_layers)
    
        # since we've activated/jumped to the design layer we're trying to control visibilty of, we will jump back to our initial design layer, stored in 'cur_layer'
        vs.Layer(cur_layer)

     

    • Like 2
  8. Does anyone know which function calls to use for setting record fields to be controlled by the data manager field mapping.

     

    Have just setup a data mapping for a particular record to WinDoor objects, and they seem to work -- manually, however I have the records already attached to some odd 200 objects.

     

     

     

    image.thumb.png.cad06c928a22770e357dca1b0cb43f21.png

     

     

    image.png.361568acc4b45683b573ed93208c9ad6.png

     

    Have tried vs.SetParamStyleType, put that seems to be only for plugin objects, not records.


    Any help, or pointers in the right direction would be greatly appreciated.

     

    Cheers,

    Tui

     

  9. On a side note, heres a snippet that lists out all installed modules for your python environment (adapted for vectorworks, by adding vs.CreateText(), to be run on design/sheet layer). 

     

    def list_modules():
        import pkg_resources
        installed_packages = {d.project_name: d.version for d in pkg_resources.working_set}
        # print(pkg_resources.working_set)
        text_data = []
        for k, v in installed_packages.items():
            # print(f"{k} : {v}")
            text_data.append(f"{k} : {v}")
    
        import vs
        vs.CreateText(f"{vs.Chr(13)}".join(text_data))

     

    • Like 3
×
×
  • Create New...