Jump to content

Jesse Cogswell

Member
  • Posts

    286
  • Joined

  • Last visited

Everything posted by Jesse Cogswell

  1. @dtheory I just tested this in both VW2019 and VW022. In document context, I was able to get the command while inside a viewport annotation with nothing selected. It is slightly more "buried" because of the added context commands, so it might just not be in a place you're expecting. As for the snapping palette, I'm very much with you. In one sense, snaps are kind of a set and forget thing for me, the only one I toggle regularly is the Tangent snap, so it being out of the way is great. However, it's now so far out of the way when I do want to toggle something, and now the old shortcut keys are no longer tied to snapping. It took me a bit to realize that 'R' now repeats last menu command rather than toggling the Tangent snap. That being said, there's not much I could do about it in terms of scripting. I COULD write a script for each one to toggle the preference, which would live in a script palette and could change name based on current status, but the far easier thing you can do is put snapping into your Smart Options Display, though it would suck to lose one whole slot to it.
  2. @hollister design Studio Right click context menu is probably best if you want to access it often. I personally have it in a menu alongside my other Viewport scripts. You could also consider putting it on a shortcut key. One final way to get to it would be to write a script that calls the tool and have a script palette open to it so that it's always a double-click away. But keep in mind that the script would live with the drawing and would need to be imported to other drawings.
  3. @Pat Stanford It makes the system chime in Windows when you use any key combination of Alt+<key> regardless of the Session "Use sound" setting. It comes from Windows trying to find a top menu item (Alt+F for File as an example) and not being able to since it doesn't exist. I think it's more a limitation of Windows and less of Vectorworks. It can get annoying since the only way to really turn it off is to disable the chime at the Windows system level or to mute your sound.
  4. I wrote a tool that can change a Viewport's class and layer visibilities from the same window. Even better, it can work while you're inside that Viewport's annotation or crop space. It can be found in this topic:
  5. Hello friends. I had some time this afternoon and wrote a tool that should do this quite handily. It opens a dialog window allowing you to select a Viewport and to set the class and layer visibilities in one window. It will work from almost anywhere, even from inside the Viewport's annotation or crop space and you should see the results as soon as you click OK. It will automatically select a VP for you based on whether you're inside an annotation/crop space, whether you have a VP selected, or whether you're on a layer containing a VP. It was written in VW2019 and should work with any version 2019 and higher. I tested it in VW2021 and VW2022 and it seemed to work as it should. Please let me know if anything is weird or it's not working like you expect or if you need any help getting it installed and in your workspace (it will be in the JNC category in the Workspace Editor). EDIT: I should mention that it detects whether you're inside a Viewport annotation/crop by placing a Locus point, scanning it, and deleting it. You generally won't notice that it's there, but if you run the tool on a Viewport with an active class that is currently set to hidden in the Viewport, you will likely get an alert asking if you want to change the visibilities to allow it to be visible. You can select No without any worries. Set Viewport Visibilities.vsm
  6. Are the layers set to different scales? There is a document setting to Ignore layers with different scale which may be hiding things of different scales. Also, make sure that you have all classes on as well and that you have one of the Show others class view settings on. There's a chance that the objects are in a hidden class.
  7. @Phsion The command you are looking for is vs.LDevice_Reset, though I just ran a little test changing a fixture's DMX address and was able to get it to stick with either LDevice_Reset or ResetObject (at least with Vectorscript). Not sure which version you are in, but Vectorworks now updates all related address fields when one field changes. For example, if you change the UniverseAddress field, it will automatically update Universe, DMX Address, and Absolute Address. EDIT: I just did a test in Python on VW2020, VW2021, and VW2022 with the following code and it was able to make changes stick. def ChangeAddress(h): vs.SetRField(h,'Lighting Device','UniverseAddress','2/101') vs.ResetObject(h) vs.ForEachObject(ChangeAddress,("((SEL=TRUE) & (R in ['Lighting Device']))")) I tried commenting out the vs.ResetObject(h) line, the fields in the OIP wouldn't immediately change, but if I deselected and reselected the fixture, the proper values would be in the OIP. Clicking the Refresh Labels button in the OIP to force a reset on the Lighting Device pushed the new values to the symbol.
  8. @mjm in Python it's only 4 (and could be 3 if you are a bit loose with your whitespace arrangement)! Some day I'll get around to sitting down and getting comfortable working in Python. def GetFlipped(h): if vs.IsObjectFlipped(h) == False: vs.SetDSelect(h) vs.ForEachObject(GetFlipped,("SEL=TRUE"))
  9. @halfcoupler There isn't a great way since "flipped" or "mirrored" doesn't appear as a custom selection criteria choice. So I wrote a quick script that will go through all selected objects and build an array to any objects that are seen as "flipped", then deselect everything and reselect anything in that array. It should do what you are looking for. PROCEDURE DeselectNotFlipped; {* Goes through current object selection and deselects any object not flipped Developed by: Jesse Cogswell Date: 1/7/2022 VW Version: 2022 *} PROCEDURE GetFlipped(h:HANDLE); {Evaluates given object and deselects object if it is not flipped} BEGIN IF(IsObjectFlipped(h)=FALSE) THEN SetDSelect(h); END; BEGIN ForEachObject(GetFlipped,(SEL=TRUE)); END; Run(DeselectNotFlipped); If you need any help with getting this set up, please let me know. If it's a command that you look to use often across many drawings, it would be worth building it as a menu command and saving in your workspace. Also, the script was built in 2022 but will run in any version from 8.0 on. Unfortunately there isn't a script command to determine the flip axis that I could find.
  10. I still use saved views pretty extensively but mainly for changing class and layer visibility, only occasionally actually affecting the view. I wrote a script a couple of weeks ago that automatically generates viewports from saved views, but only carries the class and layer visibilities over, all generated viewports have open crops. I have been trying to find a way to poll the current view window boundary dimensions in a way that I can generate a crop object so that the script will automatically crop the viewports based on the view, but for the life of me I can't find a way of getting the necessary information to make it work. Saved views have relatively few commands in Vectorscript, so it can be really hard to get specific information out of them. I have kind of found a way which polls the whole screen size and uses the current view center, zoom, and scale to build a rectangle, but there's no way to check whether you are running Vectorworks in windowed mode or to compensate for any docked palettes on the sides of the screen, so it's not really a workable option. In any case, my script is attached below. Let me know if you have any questions. Saved Views to Viewports.vsm
  11. This was a change made in VW2021, every version that I've used back to VW2010 would have devices default to off. I also find it incredibly frustrating but have found no way to reset it back to the old behavior. I got so fed up with it that I wrote a script to toggle the embedded Light on/off state for any selected Lighting Device object, then bound that to Ctrl+Shift+L, so I can drop a fixture and quickly hit the keys to turn it back off. This is less than ideal compared to having a tickbox somewhere in Spotlight Document Settings to set default behavior, but at least it's relatively quick. I've attached the script below. To install it, download the attached .vsm file to your <User Folder>\Plug-ins folder. The easiest way to get to this folder if you're not used to accessing it is to navigate to the User Folders section of Vectorworks Preferences. There should be a button labeled either Explore or Open in Finder (depending on operating system). Just make sure the .vsm file is in the Plug-ins folder there. Then restart Vectorworks. Now, you'll need to get the menu command into your workspace. Follow the steps below: Go to Tools - Workspaces - Edit Current Workspace Make sure the Menus tab is active In the box on the left, scroll down and expand the category labeled JNC In the box on the right, find a menu location where you want the command to live (like Spotlight) Click and drag the command Toggle Light On-Off State from the box on the left to the box on the right Assign a shortcut to the command, I use Ctrl+Shift+L since it kind of makes sense and isn't used by a default Vectorworks function. Click OK The command will not run if nothing is selected, and will throw an error if no Lighting Device objects are selected. This command will work for all selected fixtures on the active layer and will toggle their existing states. So if you have four fixtures selected, but only one currently "on", running the command will turn that one "off" and the other three "on". It can be super handy if you want to quickly jump back and forth between two lighting looks without changing each light individually. I should also mention that the command will work for any version of Vectorworks from 2019 and up. Toggle Light On-Off State.vsm
  12. This is a bug that goes back to at least VW2019. It comes up when you're selecting vertices in either polylines or NURBS objects. Every once in a while, the vertex highlight gets stuck on the screen plane. It goes away if you close the drawing and reopen. I usually just ignore it when it happens. That being said, I don't recall seeing it happen in VW2022 very often.
  13. All, I have incorporated some requests from @line-weight to the Saved Views to Viewports command. These changes include: Patched bug when creating viewports on sheet that is currently active not updating Viewport properly Added Viewport Scale to List Browser. If empty, Viewport Settings will populate with currently active layer scale Allows for selecting multiple rows of List Browser. Viewport Settings dialog will show limited fields, just Sheet Layer and Viewport Scale Added Generate Name from Saved View Name button to the main List Browser I tested this in VW2019 and VW2021. Please let me know if there are any troubles. I've never tried it, but I assume that replacing an existing plug-in with this file will wipe out any localization that's been done to the plug-in (such as the name of the Saved Views folder), so be prepared to redo any localization that has been done. Saved Views to Viewports.vsm
  14. All, @MarcelP102 pointed out a bug when running the command while inside the Edit 3D Component of a symbol. Patched script attached. Make Symbol Unique.zip
  15. @MarcelP102 It took me a bit to figure out what was causing the bug, but it was really easy to fix once I found it. The script works by building a "blank" symbol definition using a locus point, then copying all of the components from the original symbol into the new symbol definition, then finally deleting the locus point. It breaks when the script is run inside a symbol, as the locus point is created in the 2D component of the symbol, so the new symbol definition doesn't actually get created. The fixed script will now pull your current view projection and create a 2D locus if in Top/Plan view or a 3D locus if you're in a 3D view. I did some tests and couldn't make it break, so you should be good to go. Happy holidays! Make Symbol Unique.zip
  16. As for symbols, geometry in the 2D component (on the screen plane by default) is not counted in the error check for screen plane objects. In fact, moving the screen plane objects inside the 2D component of the symbol to the Symbol Definition plane will move them to the 3D component of the symbol, which is probably not what you're looking for. The best way to find any screen plane objects is to do the following: Make sure all classes and layers are visible. Set your View-Class Options setting to Show/Snap/Modify Set your View-Layer Options setting to Show/Snap/Modify Run Tools-Custom Selection Set it as Select Only, Execute Immediately Select your criteria to be Plane is Screen Plane and make sure all three options under Search within are unchecked. Press OK This should find and select all objects that are set to the screen plane. From here, you should have able to switch them over to Layer Plane through the Object Info Palette and then turn off the legacy feature.
  17. @MarcelP102 Good catch! Since Saved Views are technically stored as Script resources, my script filters out any script outside of the default location of Saved Views in the Resource Manager, named "Saved Views" in the English version. The good news is that this is a really simple fix that you can do. Vectorworks has a built in way to be able to localize plug-ins without getting to the source code in cases like these where something needs to be coded in using strings. If you go to the Plug-in Manager, find my Saved Views to Viewports plug-in in the Third-party Plug-ins tab and click the Customize button, you should get a dialog box to pop up. The third tab should be named Strings. Double click on Resource ID 5000, labeled Misc Strings. From here, the one you are looking for is Resource ID 5006, which is likely set to "Saved Views". Double-click this and type in the name of the folder in the Resource Manager where Saved Views are stored. Then my plug-in should be able to find your Saved View. Consequently, all of my scripts can be localized in this way if you would prefer them to be in your native language. For this particular one, the only strings you shouldn't change are 5000 and 5001, as they're the file paths to the checkmark and blank icons needed for the list browser, but all of the rest of them are free to be changed. Please let me know if you need any further help with this. It's a feature I really like and appreciate but can be on the clunky side.
  18. @line-weight I'm glad to hear that the script is working largely as intended. I'll address each comment laid out above. Regarding the settings dialog populating, it populates now directly from the list browser. In the previous version, it would open with empty fields, so you would need to enter in all of the information a second time. So, when you are absent-minded (like me during testing) and forget to select the correct sheet layer, you would have to enter the data again. The tricky thing about populating the list browser from a previous operation is that there isn't really a great way to save what that operation is. I could have it search the drawing for viewports with names following the "auto-generation" template and populate the list browser that way. The main dialog list browser is intentially locked off so you can only select one saved view at a time. I did this to prevent viewports from having the same name, since that would be populated with the Viewport Settings dialog. In a future version, I'll make it so that it will allow you to select multiple items, but the Viewport Name field will be disabled if more than one is selected. I'll do some testing to see if I can find a clever way to add in auto numbering for drawing number and allow for the automatic name generation to work with multiple items selected. The scale is pulled from whatever the active layer is when you run the tool. It's out of laziness on my part, I don't want to take the time to code in a scale pulldown menu from scratch (there isn't a prebuilt one in Vectorscript). I could just have a Scale field that would be the direct scaling factor (48 for 1/4"=1'-0", or 50 for 1:50) that could populate from the active design layer. I'll add that to the revision list. I almost always have my design layers set to 1/4"=1'-0", since that's the most common printing scale for me, so it usually suits my needs to pull from the active layer. The bit with the red square when creating a viewport with the command when the target sheet layer is also the currently active sheet layer is due to me forgetting to put a ResetObject procedure at the end of my CreateViewports function. It's been fixed now and will be in the next revision. For now, either make sure you have a different active layer when you run the command, or if you do, just do something that forces the viewport to reset, such as changing the scale or editing the viewport annotations. You might have to scroll to zoom to get the screen to redraw, but it will clear out the red X. I have two fairly large drawings that i need to get done by the end of today, but I should have a bit of time to make the changes early this week. I'll re-enable the ability to select multiple items, add an auto-increment on drawing numbers that share sheet layers, add a scale field to the Viewport Settings dialog, and have already fixed the red X when generating viewports with the target sheet layer active. I'll let you know when the revisions are finished.
  19. The first thing to look for is that the "Interactive Scaling Mode" is not disabled. This will hide all reshape handles and control points, including the ones necessary to join Marionette nodes. You can find in the the menu bar in the upper left when you have the Selection Tool active. You want to make sure that you have either the second or third option active, not the one with the big "no" sign (as in the the picture below).
  20. @line-weight Sorry this took longer than expected, I was swamped with work and only got a chance to look at this in fits and starts. I wasn't able to replicate your bug using the layer names and saved view names you provided, and nothing in the code initially looked like it would cause the issue you were describing. When I was working on the Split Worksheet script, I came across a bug with the SubString Vectorscript function function where the documentation lists the delimiter argument to be a full string, but in reality it only uses the first character of the string. Starting in VW2020, the Sheet Layer Pulldown Menu dialog component would display the full sheet layer information, both Sheet Number as well as Sheet Title (as in Sht-1 [Sheet Title]). This is very helpful except that when you pull the data from the pulldown, it gives you the full string even though VW needs just the Sheet Number to get the proper name of the Sheet Layer. So I have all of my scripts using Sheet Layer Pulldown Menus do a version check, and if greater than 24 (VW2019), it used a SubString function with the delimiter set to ' [' to separate out the Sheet Number. In reality, it was only seeing the space in the string, but because I never put spaces in my Sheet Numbers, I never noticed that the delimiter wasn't pulling the correct information. My guess is that in that particular drawing of yours, you have a space in the Sheet Number of the target Sheet Layer. So my script was getting the incomplete name of the Sheet Layer, so it wouldn't build the viewports. I have rewritten the script with a manual substring function that uses the Pos function alongside Copy to properly use the ' [' delimiter. Now it should properly create the viewports. I also added a couple of quality of life improvements. When you press the Set Viewport Options button (now called Viewport Settings), the dialog will populate with the information from the list browser. So if you need to make an adjustment to a Viewport Setting, you now won't have to retype in the information. I added a button to that dialog box at your request called "Generate Name from Saved View Name" that will populate the Viewport Name field using the Saved View name. It can't be an exact match, so it will add the suffix " VP-#" with the number consisting of the next open number starting at 1. Anyhow, give this a shot and let me know if it still doesn't work or breaks in some other way. Saved Views to Viewports.vsm
  21. I know this is an old thread, but I wrote a workaround to solve this exact problem. It can be found in this post: It will take an existing worksheet and "split" it into multiple copies while retaining the data, with an option to copy the first row as a header for each split sheet. For non-database rows, the data will even be referenced back to the master sheet, so as long as you remember to recalculate all of your sheets, your split worksheets will always be up to date. There are a couple of specific caveats, though, they're listed in the original post.
  22. I have something of a workaround for this that I've been working on for a while. There are a couple of caveats that I'll list down below, but I've tested it with a fairly wide variety of worksheets and it seems to work. It is a Vectorscript plug-in I've written attached to this post called Split Worksheet. It launches a dialog box allowing you to select a worksheet, enter in the number of rows in each "split" worksheet, and whether or not to repeat the first row in each split. Once you click OK, it copies the formatting and content of the target worksheet and creates new worksheets with the same data and formatting with the naming scheme of "<original worksheet name> SPLIT-#" with the number incrementing upward with each split. It will even let you overwrite an existing set of splits (in case data has changed or you want to change the number of rows per split sheet). For standard worksheet rows, the data will be referenced back to the master sheet, so things like text formatting and images will carry across correctly, and will update if you make changes to the master sheet. I can't really do that for database rows unfortunately, so the plug-in instead will make the database data "absolute". So it will appear exactly as it does in the master worksheet, but will no longer reference the master worksheet. It also will not carry images from a database row, as there's not a great way to pull the source of the image from a database row. It also will not merge cells for you, though it will copy the data across with references, you'll just have to manually remerge the cells. Now for the caveats. This will only currently work for worksheets of 26 columns or less. For referencing data, I need the name of a cell (like A2), but I got lazy about writing the algorithm to have columns exceed the alphabet, so it will instead throw a warning if you try to run the command on a worksheet with more than 26 columns. The plug-in will work with any version of Vectorworks from 2019 forward. There is a bug in the SetWSRowHeight procedure that prevents the row height from being applied to a worksheet that has been created or had rows added in the same script. So, even though it is storing the row heights properly, the newly created sheets will have every row set to "Auto Fit Row Height" regardless of what the master sheet says. HOWEVER, it seems like that bug has been fixed in VW2022, so if you are most current, this won't be a problem for you. If one of the split worksheets is already on a design or sheet layer and you overwrite it with the command, it will update properly, but the selection box will not until you open the worksheet and close it again. I could not seem to find a way to get Vectorworks to update this. However, if you have the option to open the split worksheets upon completion of the command, you won't have to worry about it. I tested this with a worksheet with a little over 300 rows. VW took a little bit of time to run the command, but it does complete properly. However, on one of my tests, when I had "Open Split Worksheets" checked in the dialog before pressing OK, Vectorworks hung for a long time before crashing. But opening the drawing up and trying again was fine, so I don't know what caused it to crash. If it crashes on big sheets, try running it with "Open Split Worksheets" unchecked. Borders will come across but not necessarily border thickness. There are a ton of ways to set a cell's border style, weight, and color, but no way to pull that information from an existing cell, just whether or not it has a border. Plug-in installation in Vectorworks is a little obtuse if you haven't done it before. Instructions are below. Find your plug-ins user folder. In Windows, this tends to have the default file path C:\Users\<user name>\AppData\Roaming\Nemetschek\Vectorworks\<version number>\Plug-ins. I have no idea where it is on Mac. The easy way to get to it, and is best if it has been changed from default is to go to Vectorworks Preferences, navigate to the User Folders tab, and click on the Explore (in Windows) or Open in Finder (in Mac) button. Then open up the Plug-ins folder. Download the Split Worksheet.vsm file attached to this post into the plug-ins user folder. Restart Vectorworks. Now you will need to add the command to your workspace. This is achieved by going to Tools - Workspaces - Edit Current Workspace. In the Edit Workspace dialog, click on the Menus tab. In the box on the left, navigate to and expand the category named JNC. In the box on the right, find a suitable place to put the command (like Modify or Tools) and expand it. Drag the Split Worksheets command from the box on the left to the desired menu in the box on the right. Click OK. Happy splitting and please let me know if anything looks weird or breaks. As a bonus, I am also attaching a menu command that I wrote that will quickly "stripe" a worksheet with alternating fill colors. I was initially unhappy with it since it didn't work on database rows, but it might come in handy alongside the Split command. Split Worksheet.vsm Stripe Worksheet Rows.vsm
  23. Sam, The SetLineWeightChoice procedure is looking for the actual line weight value in mils, not the indexed choice of the pop-up. As for the line type, you would use SetLineTypeChoice with a LONGINT of the line type as the third argument. To find the internal index of your line type, you would use Name2Index('ISO-08 Long Dashed Short Dashed'). But also keep in mind that this would only work if that particular line type is already in the drawing (otherwise Name2Index will return 0). So you could do a little check with: IF(GetObject('ISO-08 Long Dashed Short Dashed')=NIL) THEN BEGIN resList:=BuildResourceList(96,14,'Attributes - Line Types',numLineTypes); FOR i:=1 TO numLineTypes DO IF(GetNameFromResourceList(resList,i)='ISO-08 Long Dashed Short Dashed') THEN h:=ImportResourceToCurrentFile(resList,i); END; This will import the line type as defined by the Vectorworks defaults file. Also keep in mind that SetLineTypeChoice may be looking for a negative value, so if you aren't getting the results that you want, try making the result of Name2Index negative, at least that's the case with SetLSN.
  24. @mattryan The Unified View and Screen Plane were deprecated in VW2022 for better or worse. By default, Unified View will be set to on for new drawings, but it means that opening an old drawing that had it switched off will have it seemingly locked off. But, for a spot of good news, Unified View and the Screen Plane are still present within Vectorworks, they just need to be switched back on. Go to Document Settings - Document Preferences and navigate to the Legacy 2D tab. There is a checkbox there to re-enable the features.
  25. @line-weight I only tested the script on a handful of files, none of them terribly large. I'll try to get some time tonight to test it on a much larger file and nail down the issue. In the meantime, could you PM me a list of the Layer names and Saved View names? There might be a naming conflict somewhere preventing the viewports from being created. Also, which VW version are you currently using?
×
×
  • Create New...