Jump to content

sully8391

Member
  • Posts

    45
  • Joined

  • Last visited

Posts posted by sully8391

  1. Hi all. I'm trying to link some text in a symbol to a field of a record format. I've double-triple checked that I have the names of the record format and field correct, but I don't end up with linked fields. I have over 100 fields to link, which is why I'm trying to automate this process. Here's a snippet of the script that's tripping me up:

     

    vs.BeginSym("Console Routing")
    # some other code #
    for chan in range(64):
    	vs.CreateText(f'input {str(chan + 1)}')
    	vs.LinkText(vs.LNewObj(), "ConsoleRoute", f'Input{chan + 1}')
    vs.EndSym()

     

  2. By resource files, I just mean VW files in the user library that I use to import symbols, worksheets and record formats.

     

    I had thought about using a work group, but when importing resources, for example, I need to use vs.GetFolderPath(-13) to get to my user libraries. Not only is importing from a workgroup a more arduous task, but it will break portability to any other machine, as it's all meant to be installed in the user folder.

  3. Hi all,

     

    I've been using the GitHub desktop app, and I'm wondering how best to utilize this with some plugins that I'm developing. I would like to avoid copying files from the user library folder into a separate folder just for commits, but with both plugin scripts and resource files, I can't target a single folder. For some of the scripts, I could just set the environment path to the GitHub folder, but that doesn't cover my resource files, or the .vsm's and .vso's

     

    Curious if anyone else is using the GitHub client, and what is your workflow like?

  4. I'm showing distances between speakers created with the speaker tool in a view port with the dimension tool. Once I create a dimension, half the speakers just disappear. I have to change some parameter that will re-create the autohybrid in order for a speaker to reappear. I tried updating the viewport, and that does not help.

    Speaker Disappearance.jpg

  5. I'm using the following code to import record formats into a file:

     

    recordsList, numRecords = vs.BuildResourceListN(47, full_path) #full_path defined earlier
    
    for record in range(recordsList):
    	vs.CreateText(vs.GetNameFromResourceList(recordsList, record + 1))
    	vs.ImportResourceToCurrentFile(recordsList, record + 1)

    The first time this is run inside a new Vectorworks document there are 2 record formats missing. I have to run the script again for it to work properly. What's really weird is that the CreateText() call, which I've used to check what's actually in the list, doesn't print out all of the records that are imported; so it looks like there are records missing from the list are still imported, which makes no sense to me. I've also tried every version of BuildResourceList with the same results.

  6. I see, I totally just compressed it wrong. It's running now, but I'm having loads of trouble getting to the directory that the actual file is in. I've tried os.getcwd() and os.path.dirname(sys.argv[0]), but both of those return the directory of the process (different from when I run the script standalone). I need a way to locate the resource file no matter where a user saves the downloaded zip. I might have more luck programming at a more reasonable hour, but if you know a magic line of code that achieves this, I'd love to hear it.

  7. Hi All,

     

    I'm trying to implement a simple installation script that will copy a resource file into the user libraries folder. I tested it outside of Vectorworks and it successfully copied and pasted the file into the proper folder, but when I try to pair it with installation nothing happens. It actually appears that script isn't running at all. I altered it so it would throw an error, and nothing happened, then I tried to use it to create some text, and still nothing. It's sitting at the same directory level as the folder holding all of the plugins, which appears to be correct according to this page: https://developer.vectorworks.net/index.php/VS:Implementing_Installation_Script

     

    Anyone know what I might be missing?

  8. Thanks for this! I finally got it working. GetNameFromResourceList, and variations on that, will return empty strings/handles if called before ImportResourceToCurrentFile. In my case that's no big deal, because I intend to import all of the symbols anyway. It's also worth noting that the resource list starts its indices at 1.

     

    • Like 1
  9. Hi all,

     

    I have some plugin objects that I would like to use predefined symbols instead of drawing their geometry for each instance, but I'm having a lot of trouble figuring out how to import a symbol from a user library. It looks like the functions under "Document List Handling" might hold the key, but I can't make any sense out of them. Is what I'm trying to do possible? What would a basic script for this look like?

     

    Thanks!

  10. Constraints are exactly what I need! Thank you. Do you know if there's any more documentation of the constants in the SDK? At least the horizontal and vertical distance constraints are swapped on the wiki. These are useful, but I'm having trouble with the other constraints, and I don't even know if I'm using the correct constants.

     

  11. I see. Do you know if maybe there are any extended properties I need to enable to be able to add certain associations? For example, it seems that associations 38 and 39 are responsible for keeping objects attached to truss and lighting pipes, but when I try adding this association to my plugin objects and then print their associations, there are still zero associations. This is essentially the behavior I'm looking for, one object recalculating its position based on another object. Or is there some function out there that does this, that I just haven't found yet? Both objects are event enabled and the delete-on-delete association is working fine.

     

    Thank you!

  12. I had given a Database Worksheet some thought, but I wasn't able to find any methods that allow me to create a database with Python, and that's a requirement. I also don't think storing these as parameters will work, because the number of components being formatted is configured by a user, and a simple PIO could easily see 256 parameters. If it's possible to create a Database with Python, this could work for the other PIO's I'm working on, because the worksheets are just schedules and can link to actual parameters in the OIP.

     

    As for a hidden record, are you referring to a record that's automatically created like the one for parameters, or one that I generate? There are a number of times I've thought about using a record for data storage, but there are just so many things I want hidden from users. There are also general preferences I'd like to set for the plugin-package, but I don't see how that's possible without instantiating persistent objects.

     

    I'm seeing some success using a dialog to act as an interface between the user and the worksheet, in which case I can execute scripts that update either the PIO or the worksheet as part of the dialog, but what I really (really, really, really) want is to treat the plug-in object like, well, and object, in the OOP sense. Then I could just create a dictionary and use a dialog to edit it; piece of cake. Actually, I can't count the number of times I've wished to interact with a PIO like an OOP object. Is this something that's possible in the SDK? I have to imagine that each instances of a plugin object is in fact an OOP object, if I could extend that object then all my Vectordreams would come true.

    Thanks for your knowledge!

  13. I  have two worksheet questions.

    1.) I'd like to link rows of a worksheet to instances of a PIO to store some parameters and format settings. Right now I'm creating a UUID, storing that in a hidden parameter and in the last column of the worksheet, and then I match the UUIDs to push/pull data. This is not only a bit ugly, but a user can easily change the cell, breaking the link. On the other hand, if I store the initial row number in a hidden parameter, the user could rearrange the rows and break the link that way. Is there an elegant way to link rows with Python/Vectorscript? Or maybe some methods I've overlooked that might help?

     

    2.) The PIOs are event-enabled, so when a parameter is updated, it automatically updates the worksheet. I'd like this to work the other way around. In the SDK I found this property: kObjXPropGetWorksheetEvents = 57. To me that looks like an event-enabled PIO is aware of changes in worksheets, but I haven't been able to find any other information on what event IDs to use, or how to point a PIO at a specific worksheet. Is is possible for edits in a worksheet to trigger a parametric recalc in a specific PIO?

     

    Thanks, All!

     

     

  14. Hi all,

     

    Is there a way to suppress error messages without turning off developer mode? I'm using VS functions within try/except statements, and I'm still getting error messages; I don't need to see that there's an error if I've told it what to do when there is one, and coding to avoid the error altogether is more cumbersome.

×
×
  • Create New...