Jump to content
Developer Wiki and Function Reference Links ×

2D Path Plugin Objects


El Dinyo

Recommended Posts

I am trying to update a 2D Path Plugin object from v2017 to v2019 (plugin worked fine in v2017) and I am running into a weird issue.

 

If you move the object from location 1 to location 2,  it still has a memory of the original location of the path at location 1 even though nothing shows up there.  When try too add/clip surface to edit the 2D path object, it looks at the location 1 for the joins and moves the 2D path back to the original  location plus or minus the add/clip surfaces.

It works correctly when I double click into the path object to change the shape through vertex tools but that is by FAR a slower method of our workflow.  Definately a bug or maybe a method I can use to reset path geometry to the new locations?

 

Thanks for any insights!

 

See below for pics.  You can see it ignores the new location and bases the new shape of the object off the old location.  

   image.thumb.png.539f6a0b5cb59e5cb8159c5ff48a3180.png image.thumb.png.e3c1ae2b2242bc5108e64b8e4fb3771f.png

Edited by El Dinyo
Link to comment

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);

Link to comment
  • 11 months later...

Just following up on this. This issue has been fixed in Vectorworks 2020 and was a bug that effected 2d path objects in general. (plugin or not).  The revision cloud object was also affected by this bug.  I have been told that this has been fixed in the latest service pack of Vectorworks 2019 as well. 

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...