Jump to content

Julian Carr

Distributor
  • Posts

    305
  • Joined

  • Last visited

Everything posted by Julian Carr

  1. I have never be able to make modifier keys works reliably with scripts, but all power to you if you manage to crack it.
  2. Something like this: IF GetCVis('▲ 00 standard - hairline 0.18') < 0 THEN ShowClass('▲ 00 standard - hairline 0.18') ELSE HideClass('▲ 00 standard - hairline 0.18');
  3. The bounding box is only that. It knows nothing of the rotation state and will only be of use to you if the oval is drawn using the first mode (box mode).
  4. GetBBox() will easily tell you the orientation of the oval if you compare the distance between x1 and x2 with the distance between y1 and y2. If the latter is greater then it was drawn tall. I think IsFlipped() will only work with objects that store the flip status, which likely doesn't happen with symmetrical 2D objects like ovals.
  5. These two calls might help: PROCEDURE GetBBox(h1, x1, y1, x2, y2); FUNCTION IsObjectFlipped(h1) : BOOLEAN;
  6. I think you will find the problem is only with the decimal precision you have set in the Units dialogue. Increase this to 2 or 3 and you should see the decimal places correctly.
  7. I recall years ago someone wrote a script that would create these strings. Can't find it though.
  8. Here's an example that might help: Procedure T; VAR s1 : STRING; BEGIN s1 := Concat('(', '''My Plug-in''','.','''My Field Name''','=','''CS''', ')'); AlrtDialog(s1); END; Run(T);
  9. I think you'll need something like this (untested): Function DoesClassExist(sMyClassName : STRING) : BOOLEAN; VAR i1 : INTEGER; BEGIN DoesClassExist := False; FOR i1 := 1 TO ClassNum DO BEGIN IF ClassList(i1) = sMyClassName THEN BEGIN DoesClassExist := True; i1 := ClassNum; END; END; END;
  10. No worries Peter. Thanks for your noble attempt!
  11. Thanks Peter. Actually I know how to add a separator. The question was, it there a way to expand or collapse a whole separator group to achieve the same result as if you manually clicked the little black triangle on the left of the separator row?
  12. Is there any way to expand or collapse a widget separator group using VS? For example the LABEL line group below... Thanks!
  13. This should get you started. It creates 3D loci not stakes, but maybe someone else will offer that bit: Procedure ReplaceTextWith3DLoci; Procedure DoIt(h1 : HANDLE); VAR pX, pY, rAng : REAL; r1 : REAL; Flag : BOOLEAN; i1 : INTEGER; s1 : STRING; BEGIN s1 := GetText(FSActLayer); i1 := Pos(' ', s1); IF i1 = 1 THEN Delete(s1, i1, 1); i1 := Pos(' ', s1); IF i1 > 0 THEN BEGIN Insert('.', s1, i1); Delete(s1, i1 + 1, 1); END; IF NOT ValidNumStr(s1, r1) THEN r1 := RealDialog('Z value:', s1); GetTextOrientation(h1, pX, pY, rAng, Flag); Locus3D(pX, pY, r1); IF h1 <> Nil THEN DelObject(h1); END; BEGIN IF YNDialog('Replace text blocks with 3d loci?') THEN BEGIN ForEachObject(DoIt, (T = 10) & (Sel = True)); END; END; Run(ReplaceTextWith3DLoci);
  14. If you get a handle to the parent, then use FInGroup() and NextObj() to cycle through the objects in the group, then use Selected(), it might work. An alternative would be to use FInGroup(), check the first object is not selected using Selected(), then jump straight to the selected object using NextSObj(). All just a guess mind you.
  15. Nice one Robert. We've actually had a command like this in the Object Context menu for ages (code below). What I find though, is that it is often a bunch of objects that you want to isolate for a few minutes, so the process in that case is to select the objects, Edit menu > Invert Selection then right click and choose Hide Selected Objects. There should probably be two commands - Hide Selected Objects and Hide Unselected Objects. I added the active layer to the criteria so objects on other layers didn't inadvertently get hidden. We have a matching Show Objects in the Document Context menu. { HideSelectedObjects v 1.1 - Developed by OzCAD Pty Limited } Procedure HideSelectedObjects; VAR gLName : STRING; BEGIN gLName := GetLName(GetLayer(FSActLayer)); Hide((Sel = True) & (L = gLName)); ForEachObject(SetDSelect, (Sel = True) & (L = gLName)); END; Run(HideSelectedObjects);
  16. My vague understanding is that a change was made a few Vw versions ago in how database rows were built. I think now the rows don't actually exist until after the full calculation for all rows is completed, so there is no way to know when the first row is calculating. An alternative approach you could try, is do define the worksheet row formula yourself (example below) then use the following for the DB row formula: =DATABASEBYSCRIPT('LoadDBRow') I have no idea if this would work, but might be worth playing with. Note that the first handle found is not influenced by the sort order of the worksheet, but the creation order of the items found by the criteria you enter, in the document. { the script - add something like this to a script in a script palette called LoadDBRow. Sorry I don't know Python so this is VS } Procedure LoadDBRow; VAR gb1 : BOOLEAN; Procedure DoIt(h1 : HANDLE); BEGIN IF NOT gb1 THEN DoMyCalculationAndLoadCell; { load a spare cell with the first row calculation (done here), then use that cell in your column formula } gb1 := True; WSScript_AddHandle(h1); END; BEGIN gb1 := False; ForEachObject(DoIt, <insert your criteria here>); ClearTheCell; { empty out the spare cell } END; Run(LoadDBRow);
  17. I had actually been working on this for an internal project so this request prompted me to finish it (Layer Manager Worksheet.zip). The worksheet is editable so will push data back to the layers. It includes a short video describing how it works.
  18. Thanks Wouter. Strangely, I could not get it working via a button click, but it does work with a double click on the PIO, which is even better. Thanks again.
  19. If you have a PIO that has something in the profile group, you can enter that group using: DoMenuTextByName('Group Navigation Chunk', 1); That produces an error if called from within the PIO however , which is probably not surprising. Does anyone know of a way to jump into the profile group from say a button click in the OIP? Thanks.
  20. Not sure if it can work for you Sam, but I have two methods for doing this. The first is using symbols folders, so only the source symbols within a particular folder will get make it into the list. The second is using a prefix or suffix within the symbol name in conjunction with GetActualNameFromResourceList(). I don't think you can get a handle to symbols in a list though, which is obviously a requirement for checking for an attached record.
  21. What I want to do is to write to the read-only Plant Record that is attached to Plant objects. Exactly what I want to do is to clear most of the record fields in the Plant Data tab when editing the plant style. Currently you have to do it manually one line at a time so it is quite time consuming. It needs a Clear All button because many users will duplicate an existing plant style to create a new plant, and don't necessarily want this data duplicated. Here is the script I am working with, but I need a way to temporarily write to the plant record. It may not be possible. Procedure CPD; Procedure DoIt(h1 : HANDLE); VAR i1 : INTEGER; BEGIN FOR i1 := 1 TO NumFields(GetRecord(h1, 1)) DO CASE i1 OF 3,4,6,14..39: SetRField(h1, 'Plant Record', GetFldName(h1, i1), ''); END; ResetObject(h1); END; BEGIN ForEachObject(DoIt, (Sel=True) & (PON='Plant')); END; Run(CPD);
  22. Can someone remind me how to set a record format to Read-Only or one that is set that way to NOT Read-Only? Thanks!
  23. Best to use Modify menu > Simplify Mesh because the level of simplification will vary from mesh to mesh, so provided the imported mesh is selected, adding this line to the script will activate this command and allow you to adjust each mesh as you go: DoMenuTextByName('Simplify Mesh', 0); There is no other way I know of to do this in Vectorscript that would fully automate the process.
  24. Richard Diehl actually commissioned me to create the Table and Chairs object for Vectorworks 8 and it has changed very little since then. There are so many things that could be added to it along with the chair position, like using a symbol based chair, place settings, table cloths, etc. It could certainly do with some love.
×
×
  • Create New...