Jump to content


  • Content count

  • Joined

  • Last visited

Community Reputation

72 Excellent

About JBenghiat

  • Rank
    500 Club

Personal Information

  • Homepage
  • Location
    NY, NY

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. JBenghiat

    Accessing render options

    That would be useful, though the render options are stored per document, not per layer. Passing either null or the document header would make more sense.
  2. JBenghiat

    Color parameter (with picker) in OIP

    Just a quick glance, but python uses leading white space to determine code structure. I think you have some extra space before the final elif.
  3. You simplest solution would be to set up each focus chart symbol as a Lighting Device and either use Lightwright data exchange or File>Import Instrument Data. This necessitates keeping a separate file from your plot as well as being very careful about any modifications that would affect LW data (if using data exchange). If this is a one time merge, you can create a worksheet (Create Report… makes it easy) from your symbols, use Excel to order the data in the same way (or use VLookup), and paste from Excel to the worksheet. If you imported data differently on Windows, you probably set up Excel to be an ODBC source, which you cannot do on the Mac. If you want to do something similar, you can use a SQLite utility to import csv data from LW and then use the SQLite file as a data source in VW. Otherwise, this needs to be handled with a script. If you wish to connect data often, this might be a worthwhile investment of time and not too complicated with Python.
  4. JBenghiat

    Color parameter (with picker) in OIP

    Search the archive (including Vectorscript) for event enabled objects. You will have to add some more structure to your code to handle events (your current code goes in the reset event). The InitXProperties event allows you to add buttons (as well as set other properties), and you will also get an event when the user clicks on a button.
  5. JBenghiat

    Persistent highlight of object during dialog

    Dialogs should draw the new objects before they are closed. You may need to issue a Redraw() or RedrawAll() to see the new objects.
  6. JBenghiat

    Persistent highlight of object during dialog

    No, you need SDK functions for that. The only vs/py function for highlighting is TrackObject() You can use regular selection highlighting while in the dialog as well as use temporary geometry. Your easiest option might be to get the bounding box of each object and draw a colored rectangle using the coordinates. The begin/endContext commands help keep undo clean for temporary geometry.
  7. JBenghiat

    Color parameter (with picker) in OIP

    The light objects are part of Vectorworks’ core, so their interface elements aren’t part of any of the APIs. As far as I know, you’ll have to use a button widget to call a custom dialog with a color pop up.
  8. Here is a very simplified procedure for the parameter SideLength: boo, PIName, PIHan, PIRecHan, PIWallHan = vs.GetCustomObjectInfo() # Initialize variable with parameter sideLength = vs.PSideLength # If first regen, use dialog for value if IsNewCustomObject( PIName ): outVal = vs.DistDialog('Enter a distance value:','0') if not vs.DidCancel(): sideLength = outVal # Use variable to draw object vs.MoveTo(0,0) vs.LineTo(sideLength, 0) # Write value to parameter vs.SetRField( PIHan, PIName, 'SideLength', vs.Num2StrF( sideLength ) I often have other things that can affect the parameter value, such as error checks or adjusting based on another parameter change (detected with states), so I just write values at the end of the script, but you could have this line under the if section.
  9. I probably didn’t explain my suggestion of states very well. The only way states address your task as you described it is as a check to see if the plug-in is regenerating for the first time. Are you trying to set defaults for the first plug-in in the document or set values when each plug-in is inserted?
  10. Do you want the dialog with options to appear once per document in order to set defaults or on the insertion of every plug-in? If the former, you want to invoke SetObjPropVS(kObjXPropPreference, TRUE) in the initXProp event, which gives you an event to handle for whenever the plug-in defaults dialog gets displayed, whether on first insertion or when pressing the settings button in the mode bar. You then can craft a custom dialog to set initial values. The downside for this approach is that you will need to handle every field that you want to have user accessible default data — I don't believe you have a way to also present the standard defaults dialog. If the latter, in the reset event, check if the object is regenerating for the first time, and if so present your dialog. You can do this either with states (state 0) or IsNewCustomObject(). Note that both of these methods will only be true if manually inserting the object. If you want to also gather information for duplicating or inserting via script, you can do this with states, but because you would be presenting a dialog, I advise against it. Your dialog should write values to the object's record using SetRField. A few things to note about parameter values. If you access a value with Pparam_name, this is really just a constant that vs initializes as soon as the script loads, so it is fast and correctly typed, but read only. GetRField() will always retrieve the stored value, so if you use SetRField() earlier in the script, you will retrieve the updated value. When dealing with plug-ins with initialized or manipulated data, I use the following procedure: - At the beginning of the reset event, initialize a class that stores all parameters into variables - In the course of the plug-in code only read and write the variables - At the end of the reset event, write all the variables with SetRField.
  11. Maybe take a step back and explain what you are trying to accomplish. Do you want to change object defaults, override defaults on insertion, or something else? Default values store in a record format that has the same name as the plug-in. Use GetObject(pluginName) to get the handle and SetRField to set defaults. The plug-in reads default values before the first event. The init event usualy only only happens once per session to tell VW how to handle plug-in. In developer mode, the init event runs with every regen, allowing you to actively refine how the plug-in behaves.
  12. If you're needing to select points as part of the script, you can use CallTool() to temporarily use the selection tool. Otherwise, iteration is not so bad, and what would happen internally anyway. I would use ForEachObjectInList() or ForeachObjectInLayer() to iterate over objects, and test with PtInPoly()
  13. JBenghiat

    Accessing render options

    My current project needs to support 2018, though assuming the data format hasn't changed for 2019, it would be easy to recreate the calls. As a start, just adding the correct user data structs to RenderOptionValues.h would be really helpful.
  14. JBenghiat

    Accessing render options

    Nope, just the SDK.
  15. JBenghiat

    Accessing render options

    I've found that you can access settings through the data object specified by kOpenGLDataType, however the data structure doesn't quite match what one would think from the constant list in RenderOptionValues.h.