Jump to content

PatW

Member
  • Posts

    78
  • Joined

Everything posted by PatW

  1. In the SDK you would use the class IExtensionWebPalette to define your webpalette and IWebJavaScriptProvider to register the JavaScript functions which can hand data back to the C++ part. class YourCustom_JSProvider: public VCOMImmediateImpl<IWebJavaScriptProvider> { public: CableToolWebPaletteJSProvider(); virtual ~CableToolWebPaletteJSProvider(); virtual void OnInit(IInitContext* context); virtual void VCOM_CALLTYPE OnFunction(const TXString& name, const std::vector<VWVariant>& args, VectorWorks::UI::IJSFunctionCallbackContext* context); private: IWebPaletteFrame* fWebFrame; }; // -------------------------------------------------------------------------------------------------------- class YourCustom_JSProviderCableToolWebPalette : public VCOMImmediateImpl<IExtensionWebPalette> { DEFINE_VWPaletteExtension; DEFINE_VWProtection; public: CableToolWebPalette(CallBackPtr); virtual ~CableToolWebPalette(); virtual IEventSink* VCOM_CALLTYPE QueryEventSink(const TSinkIID& iid); virtual TXString VCOM_CALLTYPE GetTitle(); virtual bool VCOM_CALLTYPE GetInitialSize(ViewCoord& outCX, ViewCoord& outCY); virtual TXString VCOM_CALLTYPE GetInitialURL(); private: CableToolWebPaletteJSProvider fJSProvider; }; Register the function: void YourCustom_JSProvider::OnInit(IInitContext* context) context->AddFunction( "VW_UpdateData" ); When it is triggered in the webpalette this callback is executed: void YourCustom_JSProvider::OnFunction(const TXString& name, const std::vector<VWVariant>& args, VectorWorks::UI::IJSFunctionCallbackContext* context) Unfortunately there is no doc about this on the vw wiki.
  2. Here is a solution that works with a list that has na even amount of members. For uneven lists you could addd another placeholder value and remove it from the final list again. zipList_v2020.vwx
  3. There is a auto compensation if you exceed the maximum chainlength of the hoist. A possible workaround is to change the chainlength( = maxchainlength) recordfield in the hoists symboldefinition then you need to replace the symbol of the hoist by the same in order trigger a refresh of the chainlength.
  4. You are right from a user view it makes more sense when the error appears for the first line. But in Python a statement can go to the next line when it is within brackets. So the python engine realizes that something is wrong when it suddenly sees a declaration in the next line. This is valid for example: print ( "a" + "b")
  5. def callback(h): sym = vs.GetRField(h, "BrxHoist", "SymbolUsed") symH = vs.GetObject(sym) if symH: val = vs.GetRField(symH, "HoistObjectData", "Manufacturer") vs.SetRecord(h,"HoistObjectData") vs.SetRField( h, "HoistObjectData", "Manufacturer", val) vs.ForEachObject(callback, "(R IN ['BrxHoist'])") Here is a little scrip which I quickly put together. It attaches the record to each hoist and only fills in the manufactur. Could be done better but I hope this works for you.
  6. Within VectorWorks\VW28.0.2b(671358)_64\Plug-Ins\Marionette.vwr\Scripts\ (vwr is a zip archive) you can find the Marionette.py Put this one in the pycharm project and then use import Marionette in the script, then all the errors should dissappear. The same applies for the vs.py that you can find at the end of this page. Search for "IDE and Debugging Python Scripts" https://developer.vectorworks.net/index.php/Python Another trick to make development easier is to add the path of your custom node py to the script option (Tools->PlugIns->Scipt options..) and then import the py module into the actial marionette node instead of copying it everytime from the IDE.
  7. I also see no other way than RunTemp tool. You pass in the IID like this: gSDK->RunTempTool( Your_VWExtensionToolClass::_GetIID()); You could write the data of the tool into a static class member that you acces then from the menu command or which is saver you finsih the job in the ::PointAdded method of the VWExtensionTool.
  8. Hi, when editing vwstring files Git shows the message "no changes found" in the diff view, I know this has to do with the utf-16 encoding but all the solutions of stack overflow didnt help so far. Did anyone here figure out how to fix this? regards, Patrick
  9. With the new hoist you can use the "Select Symbol" Button in the OIP. If these hoists are legacy vectorscript Hoists they can be upgraded with the command: Tools->Utility->Convert Old hoists. regards, Patrick
  10. I think the conversion is not correct, try it with: rgb16bit = rgb8Value * 257; 255 * 257 = 65.535
  11. What you could try is to put it temporaly in a folder before exporting and see if ExportResourceN maintaince the structure. Another solution I can think of is opening the lib file and create the folder. Unfortunately this can not be done silently so the user will see the file poping up for a second. if ( gSDK->OpenDocumentPath( fileID, true)) { // DoStuff gSDK->DoMenuName("Save", 0); gSDK->CloseDocument(); gSDK->HandlePendingUpdatesAndActivates(); //workaround for bug in OnFileContent: to trigger closedocument }
  12. Do you usualy copy the whole content out of the symbol, then maybe "Modify->Convert to Group" is what you need.
  13. In the list of the linked post I could find "Purge Items", maybe that works for you.
  14. Just stumbled over the vs-py rosetta stone, in case you dont already know it: https://developer.vectorworks.net/index.php/User:CBM-c-/VS-Py_Rosetta_Stone
  15. The trouble is caused by the special character in node "Info/Bemerkung" remove the "/". The error message was hard to understand.
  16. When I want to see the implementation of a SDK function I always need to open the cpp file by the explorer like "..VW2023_WIN64\SDKLib\Source\VWSDK\VWFC\Tools\ProgressDlg.cpp". Does any one know the trick to jump directly with visual studio to the source like you can do on the local cpp files? I tried it with adding the directory to "VC++ Source Directories" and "Additional Include Directories" but that didn't help. regards, Patrick
  17. I think it would be more easy to save the most recent created handle + timestamp as static parameters. If the move event is within a specific time after the create ignore it.
  18. This should do it: https://developer.vectorworks.net/index.php/VS:IsObjectFlipped regards, Patrick
  19. have you tried importing it withgout the .py ending:
  20. I used to create a "update" script in the resource palette for this. Import all modules that should be updated within there and execute it when changes have been made before running the real script.
  21. It means apply rotation before applying the offset. Addition: Rotations use always the 0,0,0 as anchor. Whne you want to rotate some object about his own axis you would have to move it first with the axis on 0,0,0 then rotate and move it back where it was. This step is saved by the RotateBefore function. regards, Patrick
  22. You can also directly check "if ! h" the handle class has the boolean method implemented. regards, Patrick
  23. PythonBeginContext; PythonExecute( 'import os' ); PythonExecute( 'os.remove( r"C:\Users\admin\Desktop\remove.txt")' ); PythonEndContext; This should do it. Make sure the file is in a dir where VW has the permission to delete it. regards, Patrick
  24. PatW

    Truss Pickups

    1. Import the sym from my attached drawing, replace existing 2. Select the hoist where this symbol is used and select the pickup in the OIP as when you set it up the first time, this provokes a refresh. Be sure to select the local pick up symbol from the file and not the one from the libe. regards, Patrick
  25. PatW

    Truss Pickups

    Attached is the modified symbol that fits to the truss. Please replace it in your file and then reselect it in the Hoist OIP "Select PickUp Symbol..." regards, Patrick 24PinTrussPick.vwx
×
×
  • Create New...