Jump to content

Peter Vandewalle

Member
  • Posts

    218
  • Joined

  • Last visited

Reputation

51 Excellent

About Peter Vandewalle

Personal Information

  • Occupation
    Senior Product Specialist - Design Express
  • Homepage
    www.designexpress.eu
  • Hobbies
    Architecture, Music, Bass, Mac
  • Location
    Belgium

Recent Profile Visitors

1,295 profile views
  1. Move a resource to a folder: I think SetParent()…
  2. Documentscript with Message(GetTypeN(GetObject(‘textstylename’))) will get you the answer.
  3. You can make database formulas smarter by using a "Databasebyscript" formula. Of course you'll need to script the list of shown objects yourself.
  4. Pat is right. But I think a script could make it semi-automatic. If the worksheets have a name beginning with something recognizable, you could select them, get the instance layer and update the database formula. Also, have the layer name in a cell and have the database formula use that cell as a reference. Like “(L=A1)”. That’ll make it easier to update your worksheet.
  5. Libraries are always version dependent. You’ll need a folder by version, just like the user folders.
  6. Workgroup folders are the way to go. Google Drive has a sync option, you can just create your workgroup folder in the drive. You CAN also update your workgroup folder library directly from within Vectorworks. if you add a workgroup folder in the Vectorworks preferences, the correct structure will be created at the chosen location. To add you library to it, just copy it via Explorer/Finder. Once the library has been added you can add new symbols by dragging them in the ressource browser from your active file to the wanted location in the workgroup folder.
  7. This sounds more like a command. Typically in Vectorworks, commands are menu commands. You can of course attach a keyboard shortcut to a command. Tools and Objects always need a click in the drawing to execute.
  8. Actually "vs.WSScript_GetEdit" returns a boolean if a change was made by the user and returns the user-entered value. But the "vs.WSScript_GetEditObj" should return a handle to the edited object.
  9. Sorry for my misunderstanding. I don’t think there is a way to script the collapsing.
  10. Yes there is. The PIO must be event-enabled. I'm doing this in Python, but it should also work in Vectorscript. In the Event 5 (kObjOnInitXProperties) routine, include these 3 lines: Python: _bResult = vs.SetObjPropVS(8, True) # kObjXPropHasUIOverride _bResult = vs.SetObjPropCharVS(81, vs.Chr(2)) # kWidgetGroupMode, kWidgetGroupAutomatic object_info_palet(_sPIOName) Vectorscript: bResult = SetObjPropVS(8, TRUE); {* kObjXPropHasUIOverride *} bResult = SetObjPropCharVS(81, Chr(2)); {* kWidgetGroupMode, kWidgetGroupAutomatic *} ObjectInfoPalet(sPIOName); The last line calls these procedures. At least that's how I do it. Python: def object_info_palet(_sPIOName): _iPIOID = 100 _iPIOID = insert_separator(_iPIOID, _sPIOName, "Global", 0) _iPIOID = insert_parameter(_iPIOID, _sPIOName, "LineLength", 1) _iPIOID = insert_parameter(_iPIOID, _sPIOName, "Diepte", 1) def insert_separator(_iID, _sPIOName, _sParameter, _iIndent): _bResult, _sTmp = vs.GetLocalizedPluginParameter(_sPIOName, _sParameter) if _bResult: _bResult = vs.vsoAddWidget(_iID, 100, _sTmp) _bResult = vs.vsoAppendWidget(100, _iID, _sTmp, 0) vs.vsoWidgetSetIndLvl(_iID, _iIndent) return _iID+1 def insert_parameter(_iID, _sPIOName, _sParameter, _iIndent): _bResult, _sTmp = vs.GetLocalizedPluginParameter(_sPIOName, _sParameter) if _bResult: _bResult = vs.vsoAddParamWidget(_iID, _sParameter, "") _bResult = vs.vsoAppendParamWidget(_iID, _sTmp, 0) vs.vsoWidgetSetIndLvl(_iID, _iIndent) return _iID+1 Vectorscript: PROCEDURE ObjectInfoPalet; VAR iPIOID: INTEGER; BEGIN iPIOID := 100; iPIOID := InsertSeparator(iPIOID, sPIOName, 'Global', 0); iPIOID := InsertParameter(iPIOID, sPIOName, 'LineLength', 1); iPIOID := InsertParameter(iPIOID, sPIOName, 'Depth', 1); ... END; FUNCTION InsertSeparator(iID: INTEGER; sPIO, sField: STRING; iIndent: INTEGER): INTEGER; VAR bResult: BOOLEAN; sTmp: STRING; BEGIN bResult := GetLocalizedPluginParameter(sPIO, sField, sTmp); IF bResult THEN BEGIN bResult := vsoAddWidget(iID, 100, sTmp); bResult := vsoAppendWidget(100, iID, sTmp, 0); vsoWidgetSetIndLvl(iID, iIndent) END; InsertSeparator := iID + 1; END; FUNCTION InsertParameter(iID: INTEGER; sPIO, sField: STRING; iIndent: INTEGER): INTEGER; VAR bResult: BOOLEAN; sTmp: STRING; BEGIN bResult := GetLocalizedPluginParameter(sPIO, sField, sTmp); IF bResult THEN BEGIN bResult := vsoAddParamWidget(iID, sField, ''); bResult := vsoAppendParamWidget(iID, sTmp, 0); vsoWidgetSetIndLvl(iID, iIndent); END; InsertParameter := iID + 1; END; I hope the Vectorscript is correct, I do more Python these days.
  11. You can set the starting position of the control point in the parameter settings in the plug-in creation dialog.
  12. Your GiveMeAX and GiveNeAY are constants. You don’t read the ControlPoint values. Try this (I did this on my iPhone so there are no indents): Procedure Test; CONST CR = CHR(13); VAR objHd,recHd,wallHd, ControlGeometry : HANDLE; resultStatus : BOOLEAN; objName, currentClass : STRING; i : INTEGER; rX, rY: REAL; BEGIN PushAttrs; currentClass := ActiveClass; resultStatus := GetCustomObjectInfo(objName,objHd,recHd,wallHd); ControlGeometry := GetCustomObjectPath(objHd); SetObjectVariableBoolean(objHd, 800, TRUE); rX := pControlPoint01X; rY := pControlPoint02Y; RectangleN( 0, 0, 1, 0, rX, rY); RectangleN( rX, rY, 1, 1, 20mm, 20mm); NameClass(currentClass); PopAttrs; END; RUN(Test);
  13. You’ll need to start by creating a parametric object in the plug-in editor in the tools menu. You could create a rectangular object, that’s one of the options. In the same plug-in editor you can also add parameters and add the script. That can be Vectorscript or Python. you can also import an external file into that script. That external file can then hold the main part of the script.
  14. For Pats example ‘door’.’usrfield1’ use this line to get the value into an internal variable: var = vs.Pusrfield1 or: var = vs.GetRField(<handle to PIO instance>, “door”, “usrfield1”)
  15. You’ll find the plug-in editor in the tools menu. In the plug-in editor you can create an additional plug-in. I think the reducer would be a point object or a line object. You ‘ll need to add a few parameters to the plug-in object. This can be done in the plug-in editor. Last but certainly not least, you’ll need to write the script. This can be Vectorscript or Python. The script can be written in the plug-in editor or referenced to an external text file (.px for Vectorscript, .py for Python). Also, check the developer website for reference. developer.vectorworks.net Of course there are at least a thousand more things to tell about scripting in Vectorworks.
×
×
  • Create New...