Jump to content

Julian Carr

  • Content Count

  • Joined

  • Last visited

Community Reputation

86 Excellent


About Julian Carr

  • Rank

Personal Information

  • Location

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. In my experience, user input interruptions in Vectorscript are very very limited and often unreliable, and I suspect it would be the same in Python. You really need to go to the SDK for things like this.
  2. While is seems logical to try and emulate how you work with the mouse to select objects then edit them in some way, if you want to get into scripting then you'll find it much easier to work with handles. And the single most useful call for this is ForEachObject(), because it uses criteria to choose what gets processed. This can be object type, class, layer, colour, selection state, etc. Using FEO would look something like this: Procedure T; VAR grNewLen : REAL; Procedure DoIt(h1 : HANDLE); VAR rCenterX, rCenterY : REAL; rScaleFactor : REAL; rExistLen : REAL; BEGIN HCenter(h1, rCenterX, rCenterY); rExistLen := HLength(h1); rScaleFactor := (rExistLen + grNewLen) / rExistLen; HScale2D(h1, rCenterX, rCenterY, rScaleFactor, rScaleFactor, False); END; BEGIN { main } grNewLen := RealDialog('New Length?', '2'); IF NOT DidCancel THEN ForEachObject(DoIt, (T = Line)); Redraw; END; Run(T);
  3. Pat is right. Scaling the line using HScale2D is the way to go and it is easy enough: Procedure T; VAR h1 : HANDLE; rCenterX, rCenterY : REAL; rScaleFactor : REAL; rExistLen, rNewLen : REAL; BEGIN h1 := FSActLayer; HCenter(h1, rCenterX, rCenterY); rExistLen := HLength(h1); rNewLen := RealDialog('New Length?', Concat(rExistLen)); rScaleFactor := rNewLen / rExistLen; HScale2D(h1, rCenterX, rCenterY, rScaleFactor, rScaleFactor, False); Redraw; END; Run(T);
  4. Yes, in an old PIO. It still works in 2020. Here is the code: Function GetColourIndex(CurrentIndex : INTEGER) : INTEGER; VAR DialogID, DlogResult : INTEGER; Function Define_Dialog: INTEGER; VAR dialogID : INTEGER; BEGIN dialogID := CreateLayout('Choose Colour', False, 'OK', 'Cancel'); CreateGroupBox(dialogID, 4, '', False); CreateControl(dialogID, 5, 2,'',0); SetFirstLayoutItem(dialogID, 4); SetBelowItem(dialogID, 4, 5, 5, 0); Define_Dialog := dialogID; END; Procedure Drive_Dialog(VAR item:LONGINT; data:LONGINT); VAR red, green, blue : LONGINT; BEGIN CASE item OF SetupDialogC: BEGIN ColorIndexToRGB(CurrentIndex, red, green, blue); SetColorButton(DialogID, 5, red, green, blue); END; 1: BEGIN GetColorButton(DialogID, 5, red, green, blue); RGBToColorIndex(red, green, blue, GetColourIndex); END; 2: GetColourIndex := CurrentIndex; END; END; BEGIN DialogID := Define_Dialog; IF VerifyLayout(DialogID) THEN DlogResult := RunLayoutDialog(DialogID, Drive_Dialog); END;
  5. There is no official way to do it, however if you used CreateImageControl2() to insert the image as the first item in the dialog, you could probably then use SetBelowItem() with a large negative Y value to place the next item over the image and subsequent items below that. You will need to create a VWR file to store the image, which is simply a zip file of the image or images (without a parent folder), which you then just change the file suffix from .zip to .vwr. If your zip/vwr file was called MyImages.vwr, and the image in there was called image1.png (use png images), then the call to place the image would be something like this: CreateImageControl2 (Dialog1, ItemID, 500, 400, 'MyImages/image1.png'); The VWR file lives in the Plug-ins folder and 500/400 is the pixel size you want the image to appear in the dialog. Just make sure to preserve the image proportions. For example, this would work if the actual image was 1000 x 800 pixels, or 1500 x 1200, etc.
  6. Thanks a lot Pat and Ray. I cobbled something together from what you sent.
  7. Anyone have a script handy that will export a list containing sheet layer names and numbers? TIA.
  8. I guess the first question is why does your PIO need to reset when the zoom level changes? Generally this should not be necessary. Ignoring that for the moment, if this were possible it could only work in an event enabled PIO using SetObjPropVS(). I don't have the full list at hand, but this is the function that allows PIOs to reset if there are layer scale or layer elevation changes, for example.
  9. I don't recall a script, but you can just select all the sheets in the Nav palette, right click, choose Edit, then change the DPI there. Only takes a few seconds.
  10. This works for me: Procedure T; VAR BeamHandle : HANDLE; BEGIN BeamHandle:=CreateCustomObjectN('Wide Flange - 3D',0,0,0,FALSE); SetRField(BeamHandle,'Wide Flange - 3D','__series_2', 'AISC (Metric)'); SetRField(BeamHandle,'Wide Flange - 3D','__size_2', 'W200 x 22.3'); SetRField(BeamHandle,'Wide Flange - 3D','Length', '3000mm'); SetRField(BeamHandle,'Wide Flange - 3D','__current_series', '2'); SetRField(BeamHandle,'Wide Flange - 3D','__current_size_2', 'W200 x 22.3'); Set3DRot(BeamHandle,0,45,0,0,0); ResetObject(BeamHandle); END; Run(T);
  11. This will at least explode the object for you: SymbolToGroup(FSActLayer, 1);
  12. Thanks Josh. I worked out another way to achieve the end goal.
  13. Anyone know if there is a way to delete or replace a record field from an existing record using VS? Thanks!
  14. Untested, but something like this should work... Procedure CheckSymbolExists; VAR gsSymNameCurrent : STRING; Function DoIt(h1 : HANDLE) : BOOLEAN; VAR sSymNameExist : STRING; BEGIN IF (h1 <> Nil) & (GetType(h1) = 16) THEN BEGIN sSymNameExist := GetSDName(h1); IF sSymNameExist = gsSymNameCurrent THEN SysBeep; END; END; BEGIN gsSymNameCurrent := StrDialog('Symbol name to search for:', ''); ForEachObjectInList(DoIt, 0, 2, FSymDef); END; Run(CheckSymbolExists);


7150 Riverwood Drive, Columbia, Maryland 21046, USA   |   Contact Us:   410-290-5114


© 2018 Vectorworks, Inc. All Rights Reserved. Vectorworks, Inc. is part of the Nemetschek Group.

  • Create New...