Jump to content

Jesse Cogswell

  • Posts

  • Joined

  • Last visited


625 Spectacular

Personal Information

  • Location
    United States

Recent Profile Visitors

4,259 profile views
  1. @michaelk Yeah...I'm not touching that. How did you get that information? Is it documented anywhere?
  2. I have attached a really simple file to show how this works. In the file, there are two design layers, one with a rectangle and one with a cube, and a sheet layer. There is a simple, one line script that sets one of the design layers as your active layer. If you run this script from a sheet layer, Unified View is now disengaged but won't show up in the Legacy 2D tab of the Document Settings. To re-enable Unified View, you have to Enable legacy 2D features and then disable them. Poof, Unified View is back on. Or you can add SetPref(94,TRUE) to any script that activates a layer and hope that your user isn't deliberately disengaging Unified View. Unified View Bug.vwx
  3. Just tried it in both VW2019 and VW2024, no change on the Callout object. I'm assuming that the menu command just runs on ResetObject on every object in the drawing (something along the lines of ForEachObject(ResetObject,(INSYMBOL & INVIEWPORT & (ALL)));), so it has the same effect as my script since it contains a ResetObject command as part of the execution. The test that I just did looked like this: Initial Setup After running the script: After running Tools - Utilities - Reset All Plug-ins: No change. That test script looks like this: SetPenFore(FSActLayer,65535,0,65535); SetPenBack(FSActLayer,65535,0,65535); ResetObject(FSActLayer); ReDrawAll;
  4. I've added this ability, but I did notice a fun bug when it comes to Callouts. The script technically works but the new attributes won't show up on the callout until you use the Attribute Palette to change something. None of the usual tricks to force a reset work, changing the Callout's layer, changing a parameter, or moving the object around. If you change the Callout's class after the fact it will take on the attributes of the new class but I could not get it to work within a single run of the script. I know you probably want this to work on Callouts since they're probably one of your most mis-classed objects, but there doesn't seem to be a solution with a script at the moment. Even running the command twice, once to set attributes by class and again to set the new class, didn't work. This is true at least for VW2019, 2023, and 2024 on Windows. It might work properly on Mac. Callout in the None class with no By Class attributes: Running the command: After running the command, the only attribute that "stuck" is the fill pattern: Changing parameters, layer, and even the note contents has no effect: Selecting the note and using the Attribute Palette "Make All Attributes By Class" button: This seems to be a bug with the Callout tool itself. I tried a simple script that would set the pen color of any selected object to magenta and it works fine on everything except Callouts. Neat. Anyhow, updated plug-in is attached. Save it over the existing one in your User Folder and restart Vectorworks. Reset Plug-in Obj Classes.vsm
  5. I was able to get it to work. I'll share my process. Draw top ellipse in Top/Plan view Off to the side, draw profile ellipse in Top/Plan view Draw angled cutting line Draw axis line Using the 2D Polygon tool in "Paint Bucket" mode, click on the quadrant to create our true profile Decompose the created polyline Select the resulting polylines along the outside edge and the cutting line and Compose Select the new polyline and the axis line and Convert to NURBS and Ungroup, you should have two NURBS curves Use Rotate 3D to get your NURBS curves into the proper plane Recenter your NURBS curves onto your rail ellipse Convert your rail ellipse into a NURBS curve. You should now have three NURBS curves Revolve with Rail, selecting the axis curve, the profile curve, and the rail curve. Then Ungroup and Add Solids to get your final shape I hope this answers your question. The key is getting to a point where you can get the profile curve and the cutting line to be able to be composed together before converting to a NURBS curve.
  6. You would love my method filtering duplicates when building dynamic arrays. I use a FOR loop to go through the existing array with the code to add a new item to the array placed after the FOR loop and a LABEL pointer set at the very end. Inside the FOR loop, if a matching item is found, it uses a GOTO statement to bypass the code adding to the array. If it reaches the end of the loop without finding a match, it is allowed to get to the addition code. Here's the code in this plug-in that builds the array of object types using a ForEachObject(BuildTypeArray,(INSYMBOL & INVIEWPORT & (T=PLUGINOBJECT))) call: PROCEDURE BuildTypeArray(h:HANDLE); {ForEachObject callback that builds array of object types} LABEL 99; {Escape} VAR PIOName,locName:STRING; i:INTEGER; BSB:BOOLEAN; BEGIN PIOName:=GetName(GetRecord(h,NumRecords(h))); FOR i:=1 TO numPIOTypes DO BEGIN IF(PIOName = PIOTypes[i].name) THEN BEGIN PIOTypes[i].num:=PIOTypes[i].num + 1; GOTO 99; END; END; numPIOTypes:=numPIOTypes + 1; ALLOCATE PIOTypes[1..numPIOTypes]; PIOTypes[numPIOTypes].name:=PIOName; BSB:=GetLocalizedPluginName(PIOName,locName); IF(locName <> '') THEN PIOTypes[numPIOTypes].locName:=locName ELSE PIOTypes[numPIOTypes].locName:=PIOName; PIOTypes[numPIOTypes].num:=1; 99: {Escape} END;
  7. All done. Here you go, lightly tested in VW2023 and VW2024: @michaelk I noticed in your screenshot that the two columns UUID and Parent UUID are visible. These are supposed to be hidden (have a column width of 0), did you expand the columns or is that how it presents on Mac? I'm asking because this plug-in will also use a hidden column to conceal the record name for each plug-in object so that it instead presents the localized name. If the Record Name column is visible when you run this, let me know and I'll change up how the programming works a little bit. To install this plug-in, follow the steps below: Download the attached Reset Plug-in Obj Classes.vsm file Open your Vectorworks User File in a file explorer / Finder window Easiest way to do this to go to your Vectorworks Preferences, select the User Folder tab, and click on the Explore (Windows) or Open in Finder (Mac) button Open the Plug-ins folder Place the downloaded Reset Plug-in Obj Classes.vsm file into the Plug-ins folder of your User Folder Restart Vectorworks Put the new plug-in into your workspace Go to Tools - Workspaces - Edit Current Workspace Select the Menus tab In the box on the left, find and expand the category JNC In the box on the right, find a menu to place the new command in, such as Edit or Modify or Tools Click and drag the Reset Plug-in Obj Classes command from the box on the left to the target menu in the box on the right Click OK I tested this and it seemed to work correctly. As a quick side note, as part of the process it will reset the objects after changing their class, so if you have objects that take a while to reset or a lot of objects will be affected by this, the operation may take a while to complete. Just a heads up. In my testing it was pretty fast, however. Reset Plug-in Obj Classes.vsm
  8. @michaelk I think I told you when we met up last spring that I use GOTO statements often in my code as quick escape sequences since Pascal doesn't have a more traditional BREAK command (happy to be wrong about this, of course). It's used often in this particular script since the script has to traverse every single object in every single Symbol, Group, and Wall searching for objects of the target class. It uses the standard WHILE loop using FInGroup and NextObj, but if it finds an object using the class, it doesn't need to keep searching that object, so I use a GOTO statement to exit the WHILE loop. It doesn't save a huge amount of time or computational power, but if you run the command on a huge drawing with complicated symbols, it will be noticeable. However, that won't throw the error you're seeing since I'm not using a FOR or CASE structure in that example. In this script, I am using a GOTO in each. For the FOR loop, I'm using it to return the object type constant of a given parent object type name. I have an array of strings that is indexed by the object type constant selectors so that I can populate the Object Type and Parent Type columns of the dialog box. When you click on the Go to Selected button, it feeds the string found in the Parent Type column into a function that will then spit out the object type constant used in a CASE statement to determine how to get to the chosen object. That function is really simple and looks like this: FUNCTION GetObjectTypeIndex(objName:STRING) : INTEGER; {Searches object types for matching string and returns Object Number} LABEL 99; {Escape Sequence} VAR i:INTEGER; BEGIN IF(objName=sMiscResourceManager) THEN BEGIN i:=999; GOTO 99; END; FOR i:=1 TO kNumTypes DO BEGIN IF(objName=objTypes[i]) THEN GOTO 99; END; 99: GetObjectTypeIndex:=i; END; If it gets fed in "Resource Manager" as the parent, it will return 999 since the Resource Manager doesn't have an object type. I don't know for the life of me why I chose to use the GOTO to skip the FOR loop since I could have just put the FOR loop into the ELSE of the IF, but I did and it works, so I'm sticking by it. In the FOR loop, once it finds the match it doesn't need to complete the loop so instead it uses GOTO 99 to exit out. As for using a GOTO in a CASE structure, I wrote in a way to rebuild the list browser anytime you change target class or any of the Search options. The dialog handler is a big event CASE structure, and I have a LABEL in the part of the SetupDialogC event that adds and fills out the list browser. Anytime the user changes the class or the Search option, the list browser data is wiped out and a GOTO statements returns to that LABEL and regenerates the list browser. It's the best way I've found to be able to quickly regen the list browser without copying and pasting the generation code in each event that would require a rebuild. As penance for @grant_PD for hijacking their thread with nonsense, I'll get to writing up that command now.
  9. I deal with this a lot doing venue drawings with fairly complex class structures. Often these venues are in educational institutions where the students may not have a firm grasp of classes vs. layers, so I do as much as I can to "idiot-proof" the drawings before handing them over. This is pretty easy to do with symbols, since you can set the Assign to Class attribute in the Symbol Options, but that doesn't work with plug-in objects. I think it would be a grand idea for there to be a way to setup default class mapping per PIO, but it would most certainly have to be drawing specific since you might not have the classes in your current drawing. Though I could also see a world in which you could set up the default class attributes and have Vectorworks build the class for you if it doesn't currently exist in the drawing. This would have to be a something that VW adds in the long term, but I wouldn't hold your breath for it. In the short term, it wouldn't be too much work to script up a dialog box that would populate a list of PIO types found in the drawing and let you map a class to them. Then, the script would scour the drawing and change all existing PIOs to their mapped class. I could write such a plug-in pretty quickly, so if I wrap up the drawing I'm currently working on, I might be able to put something together for you later this afternoon.
  10. I think you are missing one set of parentheses in your SelectObj criteria. It should be (INSYMBOL & ((C <> 'NonPlot') & ((T = LOCUS) | (T = LOCUS3D)))). Also, a more efficient way to achieve what you are doing would be through a ForEachObject call. It would make the script one line since there's no need for variables. ForEachObject(DelObject,(INSYMBOL & ((C <> 'NonPlot') & ((T = LOCUS) | (T = LOCUS3D)))));
  11. It's the only reason I still use VW2019 at this point. I do all of my development in 2019 so that the plug-ins will work in any version between 2019 and now. The language hasn't changed much at all, mostly new object variables and a handful of more convenient functions, but it's pretty rare when I come across something that must be in a newer version.
  12. @jonp001 You really have to keep expanding until you get to an actual Vectorworks file. This is how deep I have to go until I get to a place I can import resources from: If you expand the folders until you get to the end and there isn't a VW file, then you may have a larger problem. I am just on Spotlight and don't have the Landmark package, so I can only check Plants based on the premium libraries, but this might be the issue you are having.
  13. For menu commands, you can call another VS menu command by using DoMenuTextByName('Your Command Name',0); I assume it would be the same with Python. In this instance, I think the way I would go about doing this is to make the PDF export the main script and call the label creation script with vs.DoMenuTextByName. This should allow the label creation script to fully complete before exporting the PDF. If you put the label creation script into the Category Don't Put In Workspace, it won't populate in the Workspace Editor, so you can make sure someone doesn't try to use that script by mistake.
  14. I had some work I felt like procrastinating on this afternoon so I wrote you a plug-in that will take care of this for you. You will select a symbol and enter the number of symbols you want to insert. You can then select either a fixed height or set a range, same for rotation. There is a checkbox to group all inserted symbols (might be handy if you're generating a lot of them). Here's a video of it working in VW2019: 2023-12-01 15-51-28.mp4 For the example I created a basic symbol that was 6"x3", 1/8" thick. The marquee selection was 20'x20' with a height between 0'-0" and 10'-0". The plug-in was written in VW2019 and should work in any version from 2019 onward. I did test it in 2024 and it worked as expected. To install the plug-in, follow the steps below: Download the attached Randomize Symbol Insertion.vsm file Get access to your Vectorworks User Folder. The easiest way to do this is to: Open your Vectorworks Preferences Go to the User Folder tab Click on the Explore (Windows) / Open in Finder (Mac) button Insert the downloaded .vsm file into the Plug-ins folder inside the User Folder. Restart Vectorworks Insert the menu command into your workspace Go to Tools - Workspaces - Edit Current Workspace Click on the Menus tab In the box on the left, find and expand the JNC category In the box on the right, find a menu to put the command in, such as Tools or Edit Click and drag the Randomize Symbol Insertion command from the box on the left to the target menu on the right Click OK Let me know if anything weird happens. I tested it with 3D, 2D, and Hybrid symbols. When you use 2D symbols, it will place them on the 3D plane, so you want the symbols left on the Layer Plane, it's best to use the Fixed Height option set to 0. One thing to keep in mind, is that the marquee boundary box and entered heights will only limit the symbol's insertion point, not the geometry of the symbol itself. So if you are using this with large symbols, consider that when setting your insertion area. Randomize Symbol Insertion.vsm
  15. How timely, this topic just came up a couple of hours ago. This thread should give you some ideas about where these objects might be and how to deal with them:
  • Create New...