Jump to content


  • Posts

  • Joined

  • Last visited

Posts posted by SamIWas

  1. On 4/5/2022 at 8:30 PM, MullinRJ said:

    @The Hamma,

       Out of curiosity, how many scripts is too many? Ball park. I assume the limit depends on how many total items are in a workspace, but knowing how many scripts you added would be interesting to know. Also, were your scripts Menu Items, or Palette Scripts?




    I think the number depends on the alignment of the planets, and it will change over time.  I used to have a massive workspace full of custom scripts which made my workflow exceptionally fast.  Then somewhere around 2015, workspaces started to break apart if there were too many scripts. Many just wouldn't run.  This lasted for years.  2021 seemed to fix it, and I loaded up my workspace again, and it worked well.  Then, over time, commands started to break, not work at all, or call up completely random other commands.  I've never figured out an actual number.  Hopefully, 2022 fixes it, but I'm not holding my breath.

  2. 23 hours ago, Pat Stanford said:

    What I really want it for is debugging.  Loop with a Message and a Wait so I can let the code run and look at values as it continues.  Useless for that in the current state.  So I use AlrtDialog(Concat(Blah, Blah1, Blah2)); and hit the enter key 1000 times.  😞


    We are the same....I really lament the loss of Message functionality for debugging.

    • Like 1
  3. On 2/27/2022 at 12:45 PM, Jesse Cogswell said:

    I have had some issues with ResetObject not properly working on Lighting Devices in versions 2020+.  In 2015, they added the LDevice_Reset(h:HANDLE) and LDevice_ResetVisual(h:HANDLE) which have helped in some instances.  You might try those.

    Man...it's been over a month since you posted this, but thank you.  I will try this!

  4. I wrote a script which does some spotlight lighting device numbering tricks that the Vectorworks numbering tool does not do.  It all works perfectly as intended.  But a friend testing it for me says that the instruments updated by the script do not update in the XML file which is used as the data exchange between spotlight and Lightwright.  He says a change in the OIP works, changes via the numbering tool work, and changes made via "edit divide" work, but changes made via the script do not.  Even after making other changes in the document, instruments numbered only by the script do not update.


    Is there some kind of syntax which can be used in a vector script to update the field for Lightwright?  I do not use Lightwright, so I can't look into it myself.

  5. So, say I have a script with a dialog where the user can input several values.  in this case, let's say it's a pull-down menu.


    What is the method used so that the next time the script is run, the last-chosen or last-inputted value is populated in the dialog?  I'm assuming it has something to do with string definitions or something, but I haven't delved into this yet.  Or maybe it's in the parameters?


    Example:  Script is run, and the dialog has an edit box named "Start" where the user enters "100" as the value.  The next time the script runs, I want "100" to be in that edit box.  Or if they choose "Channel" from a drop down, then "Channel" would be the chosen option next time.

  6. 3 hours ago, JBenghiat said:

    You can… but what are you trying to do? A solution may already exist. 


    Building a script where I can right click on a pipe, choose a fixture, then have the script place fixtures on the pipe at either a fixed distance or per specified degree along the curve of a curved pipe.  There are options between duplicate array, move by points, or align and distribute, but I don't believe any of them allows you to pick a pipe and a fixture and automatically distribute.    I know how to do all the aligning and placing, I can figure out the length and radius of pipes and feed them in, but following paths is the harder part.


    For instance, when using a curved lighting pipe, it's fairly straightforward to get the length and radius of the pipe (although dimension fields come in with very strange formatting), but there's nothing in the pipe records which indicate the starting and ending angle of the pipe, it's center of arc, or rotation, at least as far as I can find.  So, I figure I need to pull in the underlying arc to get its information.

  7. 12 hours ago, JBenghiat said:

    You can’t change the layout live, only hide, show, and disable items. You place your if/then in the dialog handler, where you can retrieve values and call ShowItem(). You can retrieve a value at any time in the handler loop, not just during the ok event. 


    12 hours ago, klinzey said:

    Typically you will use Swap Panes  to show different sets of controls depending on the options that are chosen in the dialog.

    This will give let you place different controls in the same location.



    Oooh...thanks guys, I will test these out.  I don't think the script I'm trying to write will work out because I'm not sure you can pull info from the underlying polygon/arc in a lighting pipe.  But, this still gives me some stuff to play with.

  8. Me again...sorry for flooding the forum, but I'm on a writing kick...


    So, in custom PIOs, it's easy to show/hide/grey etc different parameters in the OIP.


    I assume the same thing is possible in custom dialogs, as things like the door tool change options in the dialog depending on what is in other fields.  I'm looking to replicate that, but fear that it may be event-based or something, and I just can't wrap my head around that yet.


    I was hoping that a simple if/then statement would do it, but it appears to be more complicated than that, since I don't think it parses the field results until the OK button is hit.  Any pointers, or is this far more complicated than that?

    In the handler section....
    					FOR symindex:= 1 to numsyms DO symindex:= InsertImagePopupResource(dialogid, 5, symlist, symindex);
    In the dialog section....
    		dialogid:=CreateLayout('Place Fixtures On Radius',TRUE,'Apply','Cancel');
    		CreateStaticText(dialogid,4,'Select Symbol:',15);
    		CreateStaticText(dialogid,8,'Relative Angle:',15);
    		IF lmode='Angle' THEN BEGIN
    		IF lmode='Distance' THEN BEGIN


  9. 9 hours ago, MullinRJ said:


       After a little playing, I found one way to populate a Symbol Popup Menu:

    index := InsertImagePopupObjectItem(dialogid, menuID, SymNam);


       And it appears you can also use:

    index := InsertImagePopupResource(dialogID, kImagePopupID, listID, index);

    where you use one of the BuildResourceList commands to build a list of symbol definition names, though I haven't tried this explicitly.


    Have fun,




    Alright...I was able to get this to work well enough for now.  Can't figure out how to make it show only lighting devices, so in bigger documents, the list is huge.  But, it's at least a start.




    What I was hoping for is something like this, but maybe it's not possible.




    Thanks for the help so far!



  10. 8 hours ago, MullinRJ said:

    Hello @SamIWas,

      For your symbol popup item, look at:  CreateThumbnailPopup(dialogID, item_number);

    Sorry, I don't have any example code to populate it.


       I assume your LayerName popup menu is already populated, but if not, use:  
    GetChoiceCount(dialogID, menuID, Cnt);
    AddChoice(dialogID, menuID, 'menu item text', Cnt);

    in a loop to add items to the end of the menu. This code would go in the SetupDialogC section of the dialog handler.


       To select an existing menu item to be the chosen item, use:  SelectChoice(dialogID, menuID, menuPos, TRUE);

    where menuPos is the position of the Active Layer Name in your list. I believe counting in SelectChoice is 1-based, but if I'm wrong, it's 0-based. Easy enough to test.

    This code also goes in the SetupDialogC section of the dialog handler.






    Thanks...this has given me some stuff to look at.  The SelectChoice for the layer menu works better than what I had come up with.  It appears that it orders the list in alphabetical order, so now I'm just searching for the right way to find the alphabetical index of the layers.


    Man...the symbol stuff seems harder than I thought.  Figured there would be a symbol popup window like what appears in so many tools, but it looks like you have to build it.  ugh.

  11. Hey gurus...


    I wrote a script to place symbols (lighting devices) based on the position of a large container object and all of its settings.  It all works exactly how I want it to.  Right now, I'm using a couple of workarounds to get the correct final result, but I'd love to figure out a few sticking points.One is getting a symbol chooser in my dialog, and the other is how to populate the layer drop-down with the current layer.  Some notes are in the code below (only relevant parts of the entire code are shown).  I realize that it might not be up to real programmers type code.


    So, I thought CreateSymDispCtrlN or CreateSymbolDisplayControl might be the answer, but they display only images.  I would like to get the symbol drop-down menu seen in other tools and then be able to pass off the resulting symbol choice to the lsymbol variable. 


    The second issue is the layer dialog.  Choosing the layer and passing it to the llayer variable works fine and functions correctly  in the script.  I just want the menu to default to the current layer, but doing a SetItemText for that component caused weird issues with selecting, so I'm not sure that's it.


    Any pointers would be very appreciated!


    FUNCTION Mydialog(var lsymbol:STRING; var langle : REAL; var llayer : STRING ) : BOOLEAN;
    	dialogid, result : INTEGER;
    	iTest : REAL;
    	PROCEDURE Dialog_Handler(VAR item : LONGINT; data : LONGINT);
    		CASE item OF
    					IF GetEditReal(dialogid,7,2,iTest) THEN langle:=iTest;
    		END; {case}
    	END; {Dialog Handler}
    		dialogid:=CreateLayout('Add Fixtures to Softboxes',TRUE,'Apply','Cancel');
    		CreateStaticText(dialogid,4,'Symbol Name',20); 
    		{CreateSymDispCtrlN(dialogid,5,'Arri SkyPanel S60-c',100,100,5,0,2,1,TRUE);}  
    		CreateEditText(dialogid,5,'Enter symbol here',40); *** THIS IS TEMPORARY UNTIL I CAN FIGURE OUT THE SYMBOL DIALOG
    		CreateStaticText(dialogid,6,'Relative Angle:',20);


  12. 5 hours ago, JBenghiat said:

    You can use RunTempTool to draw objects during the mouse move event. With vs, you probably can't easily draw a representation of the objects you are moving, but you should be able to draw the bounding box fairly easily. The example in the wiki includes draw commands. https://developer.vectorworks.net/index.php/VS:RunTempTool


    Keep in mind that if you're running as a tool, the entire script begins executing at the moment of the first click.

    Thanks for this.  I don't think what I want to do is totally possible (I didn't think it was before I even started), but this temp tool thing could be pretty useful for some other stuff!  One day, I will learn more than you've forgotten about this stuff!

  13. 9 minutes ago, JBenghiat said:

    When in the process are you wanting to draw the preview? You have some limited drawing capacity with event enabled tools, as well as with RunTempTool, but this is generally not something you can do with Vectorscript. 


    I would guess with the first click it would choose one point, then it would draw outlines of the new objects in place as the mouse was moved around based on the mouse position, until the mouse is clicked..  I would guess this would work better as a tool than a script.  The end idea is largely based on the "Move By Points" tool, just with different custom options.  

  14. I'm trying to figure out how to code the pre-visualiztion of object placement in a script/tool using Vectorscript.  When you select an object, then use the "Move By Points" tool,  the tool outlines the selected object(s), and dynamically moves them around the workspace as you move the mouse.  I have been trying combinations of GetMouse, Mousedown, TrackObject and such, but can't seem to figure this out.  Is this even possible, or is it something that only an internal Vectorworks tool can do?  Or does it require something like events, which I have never figured out.

  15. 17 hours ago, JBenghiat said:

    @SamIWasYour own object or any object?

    My plugin objects.  I have custom point-object tools I use for racks, cables, optos, network units, consoles, nodes, etc.  In order to make them import/export with FileMaker Pro (where I have an extensive database I use to track every piece), I have a UUID procedure within the tool which assigns a UUID to the object in one of the fields, and as an object name.  The object name will change automatically If duplicated, and the procedure will check to see if the ID and name match, and generate a new ID if they do not.  But I need the UUID procedure to run again after duplication to make the ID unique to each object.  But it won't run unless I change some data.  


    HOLY CRAP.  I thought I had tested this before multiple times and it didn't work...but checking "Reset on Move" and "Reset on Rotate" does fix that issue.  Now to go update all my plugins!

    • Like 1
  16. On 7/25/2021 at 7:55 PM, JBenghiat said:

    Note, you need a hex editor to enable an event-based tool. The biggest feature of the event enabled tool is customizing the mode bar, as well as handling multiple clicks easier to work with. Many of the limitations are still there though, for example, the code still doesn't run until after the first click.


    I just want code to run when an object is duplicated, so my objectID checker will run.  But every time I see one of those event-enabled scripts, my mind turns into spaghetti.

  17. On 7/21/2021 at 9:07 AM, klinzey said:

    The new parameters are used to store a reference to a resource. They will not be displayed on the OIP.

    For example, the Symbol Definition filed will store the name of a symbol and only a symbol. If you try to put other data in the field if will not store the information.

    When the symbol name is changed in the Resource manager, the filed will be updated so the object can use the new value.


    You still need another user interface element to allow the user to select the resource, so these are not simply parameters that you can just drop into the OIP.


    The other new options work in a similar manner.

    Thanks, Kevin.  Darn...I was really hoping that it was going to put in a symbol selection menu or a texture selection option.  That would be sweeeeeet.


    I guess the only option for those things is to just type the name into a text box, right?

  18. I've been making custom scripts and plugins for quite some time.  But, I just noticed, I guess after a 2021 upgrade, that there are new options for script parameters (I assume these didn't exist .  I got excited to see material and texture options, and a symbol definition.  I was hoping these would allow me user-input of textures and symbols.  But, they don't appear to do that.


    Can anyone explain how these are used, or if they don't actually do anything with point plug-ins unless they're set up a certain way?



  19. 1 hour ago, Jesse Cogswell said:

    @SamIWas ,

    @line-weight mentioned in the original post that they have been using the eyedropper tool to do this, but it becomes very tedious if you have a large number of viewports spread across multiple sheet layers, the tool I wrote and posted above allows you to do it all in one go, and has the ability to force the viewports to run an update as well.


    Sigh...that's what happens when I don't finish reading the entire post and move on to the responses....🤔


  20. On 10/21/2020 at 7:13 PM, line-weight said:


    Yes indeed ... although there is also the possibility that an investment of time doing something moderately engaging, to write a script say, is still worth it, if it avoids a smaller amount of time doing something incredibly tedious/frustrating.


    Note that the eyedropper tool works on viewports with layer and class settings and is pretty immediate.

  21. On 10/26/2020 at 1:26 PM, Pat Stanford said:

    The Message command "stopped working" a few versions ago in that it does not operate during a Vectorscript, but only at the end of the script. At least that is my memory.


    You can either use AlrtDialog, and require the user to hit enter to proceed. (this is my go to for debugging) Or you can try AlertInform and set it to be a minor alert. The problem with that is the second time you call AlertInform it ignores the Minor and pops up a dialog box instead of just putting the information into the message bar.


    If you really feel you need a progress indicator you might be better off in Python and use Python objects instead of VW objects.  +1 to @JBenghiat 😉


    So THAT'S why so many of my scripts don't report what they used to.

  22. 3 hours ago, Pat Stanford said:

    When you Ungroup a PDF you typically end up with 3 items. A bitmap of the PDF on top. A white rectangle (we think it represents the paper). And finally at the bottom a Group containing all of the vector linework and text that VW can extract from the file.


    It sounds like you had ungrouped the PDF and deleted the bitmap but not the rest.


    Glad you found the problem.

    Yeah...I've done the deal with PDFs for many years, ungrouping then dealing with the resultant parts.  For some reason, I just missed that they were there since they were hidden and weren't selecting.  

  23. 11 minutes ago, Pat Stanford said:

    How complicated is your drawing? You might try exporting back on version to a VW file and then updating that back to your current version.


    Is there any specific action that causes the lines to show?


    Have you tried to Purge unused objects?


    I just opened this back up to say that I found the issue.  The lines were there, but were covered with a white rectangle, thus not appearing when I showed everything.  I was sure I had deleted them, but apparently I had not.

  • Create New...