Jump to content


  • Posts

  • Joined

  • Last visited


819 Spectacular

Personal Information

  • Homepage
  • Location
    United States

Recent Profile Visitors

8,923 profile views
  1. The technique of acting on selected objects is what is giving you trouble. Selection status is really just a flag, so objects inside symbols can maintain their selection status, but not be directly editable (if you were to manually edit the symbol, you would then see those objects selected). Any operations beyond basics should be done via handles as opposed to selected objects. In this case, you want to traverse the drawing structure, not just act on selected objects. Using @Jesse Cogswell's ForEachObject will work, as well the similar ForEachObjectInList. You can find several use examples as well as discussions of working with handles in the forum archives.
  2. Time’s arrow flows one direction, unfortunately. You can migrate a VSM forwards, but not backwards. Your only option is to re-create the plug-in in 2023. Any updates you make in 2023 you can migrate to 2024 by copying the plug-in. if you use external includes for your code, both versions can include the same text file and stay up to date.
  3. Hard to say for sure, but that looks like an empty viewport — layer or class visibilities are set such that it has no objects to display.
  4. Non-modal dialogs aren't possible in Vectorworks at the moment, so the request would need some scaffolding. I'm also going to take a moment to shamelessly plug the sequencing features of Savvy Select Similar Instrument. You can use the mode bar keyboard shortcuts in conjunction with the tool to very quickly select and number units. https://benghiatlighting.com/software/product/savvy-select-similar-instrument-3/
  5. You are correct— encryption substitutes a token for all the variable and constant names, so the value passed to the VSValue isn’t valid. The string repository commands (RepStr) will work, however, both for passing data between vs and python as well as for preserving data between script runs.
  6. A number of potential issues, and some confusion about your description. Screen plane objects don’t appear in 3D views. The only place where you will currently find screen plane objects is in hybrid symbols and PIOs, and because you only see the 2D component in top/plan, you aren’t really aware of the screen plane. If you are seeing a planar object in a 3D view, it’s in the layer plane or another 3D plane. CreateTaperedExtrude appears to be essentially deprecated. Use CreatTaperedExtrd2. Just going by memory, but I believe that when you create an extrude, the profile becomes part of the extrude without creating a duplicate. I believe what you are seeing is the object not having a 2D component, so you are only seeing the 3D in both views. SetPlanarRef only works on 2D objects ( the 3D object exists in non-planar space). Because the extrude call returns a handle, it’s possible that LNewObj() still refers to the oval. In the PIO code, all planar objects get created in the screen plane, so an extrude will give the object depth from the current view. Therefore, you DO need to set the planar ref (usually the layer plane) for all planar objects BEFORE extruding. HTH
  7. Just to clarify @FranAJA‘s remarks, storing a handle into a variable is fine, but you should not store a handle into a parameter or any other kind of persistent storage. These were the warnings about handles at the top of the thread. A handle is nothing more than the location of a drawing object in memory. You can only reliably depend on that block of memory referring to the object you want for the duration of the script, and as long as the script doesn’t delete or otherwise invalidate the object. If you need to store a list of objects for later use, use their UUID or assign name, which can then be used to retrieve the handle.
  8. You might have to be more specific about which issues you’re referring to. Python isn’t able to pause and wait for input the way VW does — this is due to how the language works, and you have to construct your script with callbacks of you want to handle user interaction. This can’t be changed by running vs within python: you still have the same issue with Python being non-blocking. Both VS and python tool scripts don’t execute until the first click, and there’s no way around that. Track object and temp tool work best as menus. There’s also a bug that appeared in 2023 that would cause temp tool to crash. I’m not sure if that has been fixed yet — but it’s a regression, so it should be high on the list.
  9. @Andrey Shulyak Those are two different things. The Clip Cube is the 3D cube that will create a red cut plane with intersecting solids. Cropped Perspective is the legacy perspective view that has four black corners defining the frame. Either way, your solution will use object or program variable constants. Best to stay away from anything NNA_internal unless you’ve been explicitly given a code snippet from an engineer.
  10. @michaelk does this also work in python? In VS, numerical constants can utilize both standard and metric unit marks, and the conversion is automatically handled. Last I checked, this didn’t work in Python, but that was a while ago. @Jayme McColgan a general coding best practice is to avoid “magic numbers,” basically un-named constants. In practice, this can become impractical if you are creating poly lines via script, but ind your case you do have a bunch of repetition, so, for example: kLeftBound = -7.34 would reduce the number of conversions, as well as make maintenance and readability easier. Raymonds approach is fantastic for a quick fix, but I would do the opposite: retrieve the UPI (Units Per Inch) and then multiply any constants defined in inches by the UPI. If you’re specifying dimensions in mm, define UPMM by dividing the returned preference by 2.54
  11. Assuming you have a list of old classes that map to new classes, and you have a means to traverse them (if you switch to python, you can use a dict). Classes have handles, so for each old name, see if GetObject returns a handle. If the handle exists but does not refer to a class, you need to either generate a warning or handle the name conflict in some way. Otherwise continue: Try to get a handle for the new class name. If it does not exist, simply rename the old class to the new class. If the new class name exists but does not refer to a class, handle the conflict by either alerting the user or modifying the new class name until it is valid Once you have a valid name for the new class, do a ForEachObject with deep traversal and change any objects that use the old class to use the new class.
  12. What exactly do you mean by clipbox? The clip cube, the cropped perspective frame, or something else?
  13. @michaelk has the answer. Note that there is a bug where not all text attributes get saved — I know alignment does not, and possibly line spacing, so you would have to manually code those (either set to a constant value or store to a parameter) @MullinRJ what you’re finding are the options to display the text style menu in the OIP. I believe that you also need object variable 800 on for style assignment to work automatically, otherwise you need to get the object’s text style and apply it to each text block.
  14. Unless this is part of a larger process, you can also export csv from the worksheet’s file menu
  15. CallTool isn't going to work for you. The tool will want to collect two points, then (I recommend) use vectors to calculate the length and rotation. Use the CreateCustomObject commands to place the pipe and/or create a Hanging Position. The universal name for the Hanging Position is "Light Position Obj". Use SetRField to set parameters. I know there's been posts on the forum about DebugListView, which can help you find universal names and hidden parameters. You can also construct a sample Hanging Position and examine the output of Export VectorScript. The pipe is path-based, so either call CreateCutomObjectPath, or set the path group after creating the object (the path should be a polyline). Any geometry in the Hanging Position needs to be inserted in its profile group. The trickiest thing is translating been the plug-in's internal coordinates and the coordinates of the overall world.
  • Create New...