Jump to content

Peter Vandewalle

Distributor
  • Posts

    317
  • Joined

  • Last visited

Everything posted by Peter Vandewalle

  1. 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.
  2. Sorry for my misunderstanding. I don’t think there is a way to script the collapsing.
  3. 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.
  4. You can set the starting position of the control point in the parameter settings in the plug-in creation dialog.
  5. 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);
  6. 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.
  7. 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”)
  8. 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.
  9. The only solutio I'd see is to add a record to all the involved symbols and have a specific field indicate the desired layer upon insertion. So after inserting the symbol a script could read the record field value an move the object (symbol) to the correct layer. It could even create the layer if that one doesn't exist yet.
  10. @drelARCH: Very interesting nodes by @Takeshi_Kimura but unfortunately there's no 'materials popup' node in his list either.
  11. I'm building a simple hybrid object in Marionette. Now I'd like to use materials in the object. There seem to be no nodes for materials in Marionette. I'm missing 2 nodes: A 'materials popup' node to select a material from the available materials in the current document. A 'set material' node to attach a material by name to an object by handle. I've been able to create the latter. But when I create the 'materials popup' node, I'm running into an issue. When I create the node, it lists the materials in the document correctly, but when I add a material to the document, it doesn't update except when I save the current document... I'm attaching my custom nodes. Geëxporteerd bestand Marionette.vwx
  12. I think Pat is handing the best solutions. If your case doesn't act as expected, we need to see the actual drawing and selection you're using. Maybe we can find why it's not acting as you'd expect.
  13. Hello @Edgar RAMEL I solved the issue withe the units in the script, that's why it's working as it does. I just wanted to explain why the previous version was wrong. The fact that the command changes the selected object's settings to class settings was also a choice that I made because it seemed logic to me. You can always remove the class attributes by hand afterwards.
  14. Sorry, didn't find the time to sort it out earlier. There are some issues between reading and writing of the dropshadow values. By reading, they are always in mm, for writing they need to be document units... Finally, you can try this one. Object Attributes to Class_2021_03.zip
  15. New version, should be fixed now. Object Attributes to Class_2021_02.zip
  16. Thanks all, you rock! SetObjectVariableInt(hSymbol, 9743, 0) did it. We found an old post by @klinzey about this. @klinzey: Do you know where can we find this value?
  17. Hi Julian, I tried the editobjectspecial(h, 4) and got an error. Apparently it doesn’t work from within a PIO. And about the profilegroup, it doesn’t seem to be possible to get the content from that group in a point PIO.
  18. I have a PIO that does something similar to duplicate array, but parametric. I also have a command that starts from a selected 2D or 3D object and turns it into a Serial Duplicate PIO. The duplicated object source has to be a symbol because I can’t use the profile group in a point plugin. I’m trying to make a doubleclick on the object edit the symbol content. I tried the EditObjectSpecial, but that doesn’t seem to work...
  19. Worksheet scripts only run when the worksheet is recalculated. And only if the users allows it.
  20. Hi folks, I'm looking into a way to edit a symbol known by its handle. I have a plugin that duplicates a symbol. Now I'd like to edit that symbol by doubleclicking the PIO in the drawing...
  21. This one does work. You'll just need to reset the object after setting the value(s). I noticed that after running the single-line script "SetObjectVariableBoolean(LSActLayer, 1620, TRUE)", the fact that the emitter was activated was only visible in the OIP after deselecting and reselecting the light object. PROCEDURE test; VAR _hObj: HANDLE; _b: BOOLEAN; BEGIN _hObj := LSActLayer; _b := GetObjectVariableBoolean(_hObj, 1620); SetObjectVariableBoolean(_hObj, 1620, NOT(_b)); ResetObject(_hObj); END; Run (test);
  22. Maybe this can help: // Additional Light selectors const short ovLightUseEmitter = 1620; // Boolean const short ovLightEmitterBrightness = 1621; // double_gs - >= 0 values const short ovLightBrightnessUnit = 1622; // short - 0..3 - eLumens, eCandelas, eLux, eFootcandels const short ovLightUseTemperature = 1623; // Boolean const short ovLightTemperature = 1624; // double_gs - >= 0 values const short ovLightCausticPhotons = 1625; // Uint32 - kLightCausticNone = 0, kLightCausticLow = 10000, kLightCausticMedium = 100000, kLightCausticHigh = 1000000, kLightCausticVeryHigh = 10000000 const short ovLightCausticOnly = 1626; // Boolean
  23. That shouldn’t be a problem. just sort the list and take the middle value if the list length is odd. Take the average of the 2 middle values if the list length is even. Will the data come from a region of cells? Or will it just be input in the formula? If your goal is to get the median from a database row calculation, you might try to put the worksheet script outside database header and point to the database rows. Worth trying.
×
×
  • Create New...