So I tried broke it down to the base 2D Path plugin shown below and I am still having the same problems. It only works after I double click into the object making the vertexes editable. Somehow that resets the location and the new 2D path. I tried resetting the elements using ResetObject( objectHandle :HANDLE); but that has no effect. Only way to truly reset it is by double clicking in. Is the kResetEventID not called anymore on a plugin move or add/clip surface? Maybe that is something I can try.
Anyone have any idea why this would stop working in Vectorworks 2019? ( I did not try to use it in Vectorworks 2018) Is it a bug?
Also, are there any good replacements for the vectorscript listserv? Is this supposed to be it? That seemed to be invaluable knowledge base and seems to be completely gone now. I know they want to get away from email, but man there was tons of developer content there that now is very lacking. Also the responses were amazing.
I make it a surface eligible object in the code below so I can perform the add and clip surface functions on it. You also need to check the checkbox to make the plugin event enabled to make this code work. The actual 2D path is drawn as:
Full Code Below:
PROCEDURE test;
CONST
kObjOnInitXProperties = 5;
kResetEventID = 3;
kObjXIs2DSurfaceEligible = 14;
kObjXPropSpecialEdit = 3;
kDefaultSpecialEdit = 0;
kCustomSpecialEdit = 1;
kPropertiesSpecialEdit = 2;
kReshapeSpecialEdit = 3;
kObjXPropAcceptsMarkers = 10;
kObjXPropAcceptsBothMarkers = 3;
kObjXPropDefaultPropertyUI = 11;
kObjXPropHide3DLocationWidget = 1;
kHidePolyWidget = 2;
kObjOnWidgetPrep = 41;
VAR
theEvent, theButton :LONGINT;
result :BOOLEAN;
objHand, recHand, wallHand, pathHand, dupeHand, dupeHand1 :HANDLE;
objName :STRING;
objHd2, recHd2, wallHD2 :HANDLE;
resultsStatus :BOOLEAN;
objName2 :STRING;
IsError :BOOLEAN;
red, green, blue :LONGINT;
start, ending :BOOLEAN;
style :INTEGER;
size :REAL;
opacity :INTEGER;
gArrowIndex :INTEGER;
gMarkerSize, gMarkerAng :REAL;
begArr, endArr :BOOLEAN;
BEGIN
resultsStatus := GetCustomObjectInfo(objName2, objHd2, recHd2, wallHD2);
vsoGetEventInfo(theEvent, theButton);
CASE theEvent OF
5: {kObjOnInitXProperties:}
BEGIN
SetPrefInt( 590, 1 );
result := SetObjPropVS(18, TRUE);
result:= SetObjPropVS(8, TRUE);
result:= SetObjPropVS(12, TRUE);
result := vsoInsertAllParams;
result := SetObjPropVS(kObjXIs2DSurfaceEligible, TRUE);
result := SetObjPropCharVS(kObjXPropSpecialEdit, Chr(kReshapeSpecialEdit));
result := SetObjPropCharVS(kObjXPropAcceptsMarkers, Chr(kObjXPropAcceptsBothMarkers));
END;
41: {kObjOnWidgetPrep:}
BEGIN
{vsoSetEventResult( -8 );{kObjectEventHandled}
END;
44: {kObjOnAddState} {this is needed for getting event info}
BEGIN
theButton := vsoStateAddCurrent(objHd2, theButton);
END;
{Object reset has been called.}
3: {kResetEventID:}
BEGIN
pathHand := GetCustomObjectPath(objHd2);
dupeHand := CreateDuplicateObject(pathHand, objHd2);
{set vis of the 2D path object here}
SetClass(dupeHand, 'test'); {Set the class of the polygon}
SetFPat(dupeHand, GetFPat(objHd2));
GetFillFore(objHd2,red, green, blue);
SetFillFore(dupeHand, red, green, blue);
GetFillBack(objHd2, red, green, blue);
SetFillBack(dupeHand, red, green, blue);
SetLSN(dupeHand, GetLSN(objHd2));
GetPenFore(objHd2, red, green, blue);
SetPenFore(dupeHand, red, green, blue);
GetPenBack(objHd2, red, green, blue);
SetPenBack(dupeHand, red, green, blue);
SetLW(dupeHand, GetLW(objHd2));
GetMarker(objHd2, start, ending, style, size);
SetMarker(dupeHand, start, ending, style, size);
GetOpacity(objHd2, opacity);
SetOpacity(dupeHand, opacity);
GetObjArrow(objHd2, gArrowIndex, gMarkerSize, gMarkerAng, begArr, endArr);
SetObjArrow(dupeHand, gArrowIndex, gMarkerSize / GetPrefReal(152), gMarkerAng, begArr, endArr);
IsError:= false;
IF (IsError = false) THEN BEGIN
PopAttrs; { restore drawing environment }
END;{END CASE 3}
vsoStateClear(objHd2);
END;
END; {END CASE theEvent}
PushAttrs; { save drawing environment}
END; {end test}
Run(test);