Jump to content

David Bengali

Member
  • Posts

    38
  • Joined

  • Last visited

Everything posted by David Bengali

  1. David Bengali

    x

    Thread moved
  2. Thanks Patrick, Is there an advised workaround? I am discovering that various third party plugins are showing the same behavior as well and have thus become unusable. best, David
  3. Hi, wondering if anyone has encountered this or knows of a solution: When I enable custom object info palette for a plugin object with vs.SetObjPropVS( vs.kObjXPropHasUIOverride, True ) #8 I find that trying to change the value of radio buttons in the object info palette crashes vectorworks. I have inserted all of the widgets with vs.vsoInsertAllParams() I'm not trying to do anything crazy; I am really just trying to get some separators onto the OIP. I am handling Event 41 as guided by the wiki: ... elif theEvent == vs.kObjOnWidgetPrep: #41 UpdateParametersState() ... def UpdateParametersState(): vs.vsoSetEventResult( vs.kObjectEventHandled ) #-8 Changing the value of other parameters in the OIP, including numeric fields and checkboxes, works fine. Most importantly, I see the same behavior when I try the example plugin provided at http://developer.vectorworks.net/index.php/Python_Sample_Point_Object_(complex) If I click the radio button for Male / Female in this PIO's info palette, vectorworks crashes. This leads me to think there is more going on than bad code in my own object. I am running VW2017 SP4 on Mac OS X El Capitan
  4. Thanks Josh for the pointer to those header files; this listing is super helpful! There are certain things I need to do when my object is reshaped but not necessarily when certain other events are triggered, hence my interest in detecting the reshape event unambiguously. In practice, it has been working fine for me so far to just notice that some reset event occurred, and then see if the length has indeed changed, but it turns out, yes, 18 is the state value that corresponds to this action. At risk of dropping compatibility for earlier VW versions, I guess. My interest in the SDK's ability to notice drag events is really about added control points, and my wish to possibly keep redrawing part of the object as they are dragged for clearer visual feedback, rather than just when the move is done. However, it sounds like that is an advanced topic to return to at some later date.
  5. Thanks, it seems like the SDK may eventually be required. Just curious is there a straightforward way to take a PIO created in python and port it over to the SDK, or even to keep it mostly in python but extend it with the SDK?
  6. initializing variables doesn't seem to prevent garbage on the False case when the event was triggered by a drag of the built-in control points, but in any case, the solution I have gone with is, as Pat suggested, to use hidden parameters to store the old value of LineLength and rotation, and as Josh suggested, to check if these values have changed if an event is triggered but vsoStateGetParamChng returned False. This works fine for my use case, but I still wonder if there is some undocumented constant that corresponds to the state change reflected by this action. It is a little too bad that there isn't one single place where all of the arcane constants in vectorscript are documented. I know there is the appendix of selected tabulated values, but it is incomplete.
  7. Ah, I now understand what you were saying about the state getting cleared. If I put the call to vsoStateGetParamChng before the vsoStateGet calls, I do get True and valid other data in the event of changing a parameter in the OIP. However, for dragging one of the ends of the linear PIO, I get false and garbage data, even if vsoStateGetParamChng is called first.
  8. Thanks Josh, Strangely enough, I seem to be getting false on vsoStateGetParamChng, even when the last state change really was a change to some parameter in the OIP, but also after dragging one of the end points of the linear PIO. Wondering if there is anything I am obviously doing wrong here. Sample code below After a either a linear object reshape, or after a change to a PIO parameter in the OIP, the last alert in the following snippet displays something like didParamChange: False outWidgID: 356515844 OutPrmIdx: -19949 outOldVal: F÷. import vs # event / state constants vs.kParametricRecalculate = 3 vs.kObjOnInitXProperties = 5 vs.kParametricEnableStateEventing = 590 vs.kObjXPropAcceptStates = 18 vs.kObjOnAddState = 44 vs.kObjectEventHandled = -8 vs.kCreatedReset = 0 vs.kMovedReset = 1 vs.kRotatedReset = 2 vs.kParameterChangedReset = 3 vs.kObjectChangedReset = 4 vs.kLayerChangedReset = 5 vs.kExitFromEditGroup = 6 vs.kObjectNameChanged = 7 def execute(): global objname, oh result, objname, oh, rh, wh = vs.GetCustomObjectInfo() theEvent, message = None, None theEvent, message = vs.vsoGetEventInfo() if theEvent == vs.kObjOnInitXProperties: #enable eventing for this plug-in vs.SetPrefInt( vs.kParametricEnableStateEventing, 1 ) #590 result = vs.SetObjPropVS(vs.kObjXPropAcceptStates, True) #18 elif theEvent == vs.kObjOnAddState: #44 message = vs.vsoStateAddCurrent( oh, message ) elif theEvent == vs.kParametricRecalculate: #3 ResetEventHandler() def ResetEventHandler(): global objname, oh if vs.vsoStateGet( oh, vs.kCreatedReset ): #0 vs.AlrtDialog("Object Just Created") if vs.vsoStateGet( oh, vs.kMovedReset ): #1 vs.AlrtDialog("Object Just Moved") if vs.vsoStateGet( oh, vs.kRotatedReset ): #2 vs.AlrtDialog("Object Just Rotated") if vs.vsoStateGet( oh, vs.kParameterChangedReset ): #3 vs.AlrtDialog("Parameter Changed") if vs.vsoStateGet( oh, vs.kObjectChangedReset ): #4 vs.AlrtDialog("Object Changed") didParamChange, outWidgID, outPrmIdx, outOldVal = vs.vsoStateGetParamChng(oh) vs.AlrtDialog("didParamChange: " + str(didParamChange) + " outWidgID: " + str(outWidgID) + " outPrmIdx: " + str(outPrmIdx) + " outOldVal: " + str(outOldVal)) I also see in the wiki the following: (Orso, 2016.05.08): vsoStateGetParamChng returns false after following modifications: on PIO rec set up on move, rot, path reshape layer scale, height, thickness Thus there won't be a state parameter change on move, rot or on copy. outWidgID, outPrmIdx return 0 on move, rot, new obj, alt-drag copy Of course, I am not seeing 0 for those ID's, rather, something that looks like garbage data.
  9. Thanks, yes, I am checking both ParameterChangedReset and ObjectChangedReset, and neither one of these seems to be set when the main control points of the Linear PIO are dragged. Since these are the most basic features of this type of PIO, it seems strange that one would have to resort to the SDK to notice if they have been adjusted, so I assumed I was missing something, but I suppose if Event 3 (parametric recalculate / reset) gets triggered, and none of the states I am checking are set, then I could assume the only remaining option was a change in those control points, and then check stored hidden variables for position, rotation, and LineLength as you suggest.
  10. Hi all, I am creating a Linear plug-in object, and trying to catch and respond to the event where a user changes the LineLength by moving one of the two built in control points of the object. However, I cannot seem to figure out what event / state change this qualifies as. The vso states I know of are: vs.kCreatedReset = 0 vs.kMovedReset = 1 vs.kRotatedReset = 2 vs.kParameterChangedReset = 3 vs.kObjectChangedReset = 4 vs.kLayerChangedReset = 5 vs.kExitFromEditGroup = 6 vs.kObjectNameChanged = 7 Below is an example of some code I have used to try to detect this state change. Alerts appear as expected for move, rotate, attribute change, and parameters changed either in the OIP or by moving an added Conrol Point parameter in the drawing, but when I drag the two points that are actually built in to the PIO, although I do receive 3 for the event, triggering the ResetEventHandler in this case, no alert fires off for any of the checked state changes. It seems that this state change is not one of those listed above. I expected it to be a Param change along with possibly a rotation and position change, depending on which of the two points was dragged. Can anyone advise on what state I need to check for, and how I can capture the new and old value for line length, rotation, and position that could have been adjusted by this action? def execute(): global objname, oh result, objname, oh, rh, wh = vs.GetCustomObjectInfo() theEvent, message = None, None theEvent, message = vs.vsoGetEventInfo() if theEvent == vs.kObjOnInitXProperties: #5 #enable eventing for this plug-in vs.SetPrefInt( vs.kParametricEnableStateEventing, 1 ) #590 result = vs.SetObjPropVS(vs.kObjXPropAcceptStates, True) #18 elif theEvent == vs.kObjOnAddState: #44 message = vs.vsoStateAddCurrent( oh, message ) elif theEvent == vs.kParametricRecalculate: #3 ResetEventHandler() def ResetEventHandler(): global objname, oh if vs.vsoStateGet( oh, vs.kCreatedReset ): vs.AlrtDialog("Object Just Created") if vs.vsoStateGet( oh, vs.kMovedReset ): vs.AlrtDialog("Object Just Moved") if vs.vsoStateGet( oh, vs.kRotatedReset ): vs.AlrtDialog("Object Just Rotated") if vs.vsoStateGet( oh, vs.kParameterChangedReset ): vs.AlrtDialog("Parameter Changed") if vs.vsoStateGet( oh, vs.kObjectChangedReset ): vs.AlrtDialog("Object Changed")
  11. Thanks Maarten and Miguel! That was exactly what I was looking for.
  12. Novice vectorscript question: If I have a string containing a value like 10'4 or -6", what function will allow me to use this string to set the x location of a symbol, assuming I have a handle to a symbol instance on the active layer? thanks, David
×
×
  • Create New...