Jump to content

JBenghiat

Member
  • Content Count

    1,454
  • Joined

  • Last visited

Community Reputation

355 Spectacular

About JBenghiat

  • Rank
    1000 Club

Personal Information

  • Homepage
    https://www.benghiatlighting.com
  • Location
    United States

Recent Profile Visitors

4,509 profile views
  1. You'll want to use https://developer.vectorworks.net/index.php/VS:FindObjAtPt_Create and the associated calls. If you're looking for object detection at a certain point, that's a lot easier than detecting true overlap between objects (which would require building the list of objects with this call and then checking the bounding boxes of all objects). Remember, unless you're just looking for the overlap with a custom insertion tool, you need to translate between the PIO's internal coordinates and the external world.
  2. Run a script with the line EnableDebugMenu; and restart.
  3. You first need to enable the debug menu. If you're using 2021, you can use the partner products installer to do this. Otherwise, it's a VS command. Then select Debug List View Ex...
  4. The python API still parallels the VectorScript API, so none of the functions are particularly geared towards python's capabilities. The resource "list" is not related to an actual python list. Behind the scenes, the list is a c++ container, and the LONGINT variable the functions use is essentially a pointer to that container. You can, of course, construct you own functions that output the various Vectorworks calls into python lists.
  5. If the handle is NIL, you need to import the resource, take what information you need, and then delete it. You only get the handle if the resource is in the current file. The resource manager has the ability to show attached records in other files. I believe this is due to cached data and happened at the core level, so a script can't do something similar. I could be wrong, though.
  6. I always get a little turned around choosing the before or after version of a transformation on a VWTransformationMatrix, e.g. RotateXBefore vs RotateXAfter. I had thought maybe Before applies to pre-multiplication and After applies the post-multiplication, but the opposite seems to be true: Before applies to the object axes and After applies to the global axes. Does anyone know what the before and after terms actually apply to?
  7. You can use record formats for storing data and browse via resource lists. I believe the record format can't be hidden to show up in the resource list. For referenced files, you may be able to access resources, though.
  8. If you edit the accessory symbol and place a Spotlight-ready symbol (with Light Info attached) in the symbol definition, the accessory should obey the stacking order relationship, a bit like a label legend.
  9. Visual Studio Code will give you syntax completion and code folding. I believe it also does some error checking. Off the top of my head, I don't know anything like the old Plist Editor that gives you more of a UI for editing the XML.
  10. For lighting devices, you can get the field Weightdouble. It returns the weight in grams regardless of units, so you have to hard-code in the unit conversion in the formula.
  11. Try to use direct API calls instead of DoMenu calls. Look at https://developer.vectorworks.net/index.php/VS:SetLayerRenderMode and https://developer.vectorworks.net/index.php/VS:CreateVP
  12. Technically, you can add a sample lighting device to the symbol definition for the clamp, which defines a user-specified spatial relationship. But I would just add the bottom bolt to the yoke (when would you not have a bolt or nut?), which will let you place any hanging hardware and have the vertical offset calculate from its bounding cube. Or just leave off the bottom bolt. Unless you're creating an engineering drawing, is that level of detail and the associated rendering time really necessary? Especially when you're not showing the yoke bolts, gel slot, screws...
  13. In vs, I think the best way is a variation on the "Waldo" method. Insert a locus, get it's handle, get the type of its parent, delete the locus. If the type is a group, you can do some checks to see if it is a special type of group. Depending on what you're going to do with the information, you may need to recursively get parent until you get to a viewport, symbol definition, plug-in object, or layer. The SDK had some better tricks — I'm fairly sure those haven't worked their way into vs, but I'd be happy for someone to prove me wrong.
  14. I think the issue is that you just keep appending handles into hVP. As above, this is where using return values instead of globals would make this clear.
  15. I have to admit, I'm finding your script very hard to follow, which makes troubleshooting difficult. A couple general pieces of advice that may help: - The advantage of breaking out functions from the main body is to have each function perform a unitary task. To that end, structure them in terms of taking an input and generating an output and should be testable on their own. - To that end, avoid using global variables as a way to pass and retrieve values. Save them for things like constants or preferences. Your GetHandles functions should return an array of handles, which makes it clear what they do. Your count function can return a tupple of counts. That way, your main DoIt function can handle initializing, aggregating, and resetting variables and the data flow is clear. - I'm getting lost with the *2, *3, *4… variants. Rename the variables to resemble what they are, like hInObject, hSymbol, hGroup, hObject. Don't worry about repeating variable names — unless you specify "global," each function has its own scope, which is another advantage of declaring a function.

 

7150 Riverwood Drive, Columbia, Maryland 21046, USA   |   Contact Us:   410-290-5114

 

© 2018 Vectorworks, Inc. All Rights Reserved. Vectorworks, Inc. is part of the Nemetschek Group.

×
×
  • Create New...