Jump to content

Julian Carr

Distributor
  • Content Count

    258
  • Joined

  • Last visited

Community Reputation

111 Spectacular

5 Followers

About Julian Carr

  • Rank
    Journeyman

Personal Information

  • Location
    Australia

Recent Profile Visitors

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

  1. Try this Max: DoMenuTextByName('Wireframe Render Chunk', 1);
  2. If you convert the 3D poly to a NURBs curve using ConvertToNURBS() then you should be able to use one of the NURBs calls like NurbsCurveEvalPt().
  3. Thanks to everyone for your help with this. It was actually for a worksheet script to enable door thicknesses to be listed at smaller increments than the document units settings allowed. Below is the final code. I saved the script with the name 'WSFixDoorThickness' so the cell formula to use it would be: =RUNSCRIPT('WSFixDoorThickness') This replaced the standard: =(Door.DoorThickness) In Vw 2021, it would be possible to use RUNEDITSCRIPT() instead and so allow the door thickness to be modified from the worksheet too. It was beyond the remit of this little project however so currently it only reports door the thickness. { FDT (Fix Door Thickness) - v1.0 - 27/10/2020 } Procedure FDT; VAR gr1 : REAL; gh1 : HANDLE; gs1 : STRING; Function Num2FandI(r1 : REAL) : STRING; Const kBase = 16; VAR DecPart: REAL; IntPart, FracPart: LONGINT; RetFract : STRING; BEGIN IntPart := TRUNC(r1); DecPart := r1 - IntPart; FracPart := Round(DecPart * kBase); Num2FandI := Concat(IntPart, ' ',FracPart, '/', kBase, '"'); CASE FracPart OF 0: RetFract := ''; 1: RetFract := '1/16'; 2: RetFract := '1/8'; 3: RetFract := '3/16'; 4: RetFract := '1/4'; 5: RetFract := '5/16'; 6: RetFract := '3/8'; 7: RetFract := '7/16'; 8: RetFract := '1/2'; 9: RetFract := '9/16'; 10: RetFract := '5/8'; 11: RetFract := '11/16'; 12: RetFract := '3/4'; 13: RetFract := '13/16'; 14: RetFract := '7/8'; 15: RetFract := '15/16'; 16: BEGIN IntPart := IntPart + 1; RetFract := ''; END; END; Num2FandI:=Concat(IntPart, ' ',RetFract, '"'); END; { Num2FandI } BEGIN gh1 := WSScript_GetObject; gs1 := GetRField(gh1, 'Door', 'DoorThickness'); IF ValidNumStr(gs1, gr1) THEN WSScript_SetResStr(Num2FandI(gr1)); END; Run(FDT);
  4. Anyone have a routine for converting decimal inches into fractions, irrespective of the document unit settings? For example: 1.375 -> 1 3/8" 1.188 -> 1 3/16" 1.75 -> 1 3/4" 1.5 -> 1 1/2" 4.25 -> 4 1/4" Thanks!
  5. Thanks Josh. This enabled me to discover that the array size is fixed at 20, which means you can only apply a maximum of 20 tags to an object.
  6. The function GetObjectTags() returns a string array of all the tags attached to a class, layer or other object that supports tags (not to be confused with Data Tags). Once you have the string array, how can you extract each tag when you don't know the separator or quantity of strings? The separator is likely to be a line feed or carriage return, but could be different on each platform. One way would be to keep extracting strings s[1], s[2], s[3], etc until there was an error, but that seems crude. Any ideas?
  7. You cannot do this: AlrtDialog: STRING; because you are declaring a procedure as a string. Either delete that line or try this: AlrtDialog2: STRING; Either way it will work.
  8. Two things wrong. 1. N should be an integer not a string. 2. AlrtDialog cannot be used as a string because it is a reserved word being a procedure.
  9. You need to get the insertion point of the PIO using GetSymLoc() then add the internal offset within the PIO to that.
  10. You could try : PtInPoly(pX, pY : REAL; h : HANDLE):BOOLEAN;
  11. You cannot access the printer settings in Vectorscript. There may also be a physical limit on the page dimensions in the OS. At least that used to be the case.
  12. This is what I use to get the page dimensions. Note it works on the active layer so you have to store the active layer name, switch to the layer you are querying, then back again on completion. Also note it is returning mm: Procedure GetDrawingSizeRect2(VAR dx1, dy1, dx2, dy2 : REAL; VAR PageWdth, PageHght : INTEGER); VAR s1, s2 : STRING; r1 : REAL; BEGIN IF NOT IsNewCustomObject(gPIOName) THEN BEGIN s2 := GetLName(ActLayer); s1 := GetLName(GetLayer(ghParm)); IF (s1 <> '') & (GetType(GetObject(s1)) = 31) THEN Layer(s1) { switch layers so that GDSR() measures active layer (for use with RIP command } ELSE s1 := ''; END; GetDrawingSizeRect(dx1, dy1, dx2, dy2); r1 := GetLScale(ActLayer); { use this here instead of gLScale because GetDrawingSizeRect() is using the active layer, not the PIO layer } IF s2 <> '' THEN Layer(s2); PageWdth := Abs(dx2 - dx1) / r1 * 25.4 / gUPI; { page width in mm } { use gLScale here so that comparisons are in real world sizes, not scaled } PageHght := Abs(dy2 - dy1) / r1 * 25.4 / gUPI; { page height in mm } END; You can use SetDrawingRect() to set the page size, though you need to consider that the drawing size rectangle represents the printable area for the currently selected printer, not the actual page size. I have a routine that tries to match the drawing size rectangle to the metric or imperial page size. Here's part of it: CONST kPS1m = 148; { ISO Sizes including Super A3 } kPS2m = 210; kPS3m = 297; kPS4m = 420; kPS5m = 594; kPS6m = 841; kPS7m = 1189; kPS8m = 707; kPS9m = 1000; kPS10m = 1414; kPS11m = 330; { 13" Super A3 } kPS12m = 483; { 19" Super A3 } kPS11i = 229; { 9" } { US Arch Sizes } kPS12i = 305; { 12" } kPS13i = 457; { 18" } kPS14i = 610; { 24" } kPS15i = 914; { 36" } kPS16i = 1219; { 48" } kPS17i = 216; { 8.5" } { ASME Sizes } kPS18i = 279; { 11" } kPS19i = 432; { 17" } kPS20i = 559; { 22" } kPS21i = 864; { 34" } kPS22i = 1118; { 44" } CASE gPageFormat OF { if possible, set page size string from found page dimensions } 1: BEGIN { ISO } IF ((PageWdth = kPS2m) & (PageHght = kPS1m)) | ((PageWdth = kPS1m) & (PageHght = kPS2m)) THEN PageSize := 'A5' ELSE IF ((PageWdth = kPS3m) & (PageHght = kPS2m)) | ((PageWdth = kPS2m) & (PageHght = kPS3m)) THEN PageSize := 'A4' ELSE IF ((PageWdth = kPS4m) & (PageHght = kPS3m)) | ((PageWdth = kPS3m) & (PageHght = kPS4m)) THEN PageSize := 'A3' ELSE IF ((PageWdth = kPS5m) & (PageHght = kPS4m)) | ((PageWdth = kPS4m) & (PageHght = kPS5m)) THEN PageSize := 'A2' ELSE IF ((PageWdth = kPS6m) & (PageHght = kPS5m)) | ((PageWdth = kPS5m) & (PageHght = kPS6m)) THEN PageSize := 'A1' ELSE IF ((PageWdth = kPS7m) & (PageHght = kPS6m)) | ((PageWdth = kPS6m) & (PageHght = kPS7m)) THEN PageSize := 'A0' ELSE IF ((PageWdth = kPS9m) & (PageHght = kPS8m)) | ((PageWdth = kPS8m) & (PageHght = kPS9m)) THEN PageSize := 'B1' ELSE IF ((PageWdth = kPS10m) & (PageHght = kPS9m)) | ((PageWdth = kPS9m) & (PageHght = kPS10m)) THEN PageSize := 'B0' ELSE IF ((PageWdth = kPS12m) & (PageHght = kPS11m)) | ((PageWdth = kPS11m) & (PageHght = kPS12m)) THEN PageSize := 'Super A3' ELSE FlagCustom := True; END; 2: BEGIN { US Arch } IF ((PageWdth = kPS12i) & (PageHght = kPS11i)) | ((PageWdth = kPS11i) & (PageHght = kPS12i)) THEN PageSize := 'US Arch A' ELSE IF ((PageWdth = kPS13i) & (PageHght = kPS12i)) | ((PageWdth = kPS12i) & (PageHght = kPS13i)) THEN PageSize := 'US Arch B' ELSE IF ((PageWdth = kPS14i) & (PageHght = kPS13i)) | ((PageWdth = kPS13i) & (PageHght = kPS14i)) THEN PageSize := 'US Arch C' ELSE IF ((PageWdth = kPS15i) & (PageHght = kPS14i)) | ((PageWdth = kPS14i) & (PageHght = kPS15i)) THEN PageSize := 'US Arch D' ELSE IF ((PageWdth = kPS16i) & (PageHght = kPS15i)) | ((PageWdth = kPS15i) & (PageHght = kPS16i)) THEN PageSize := 'US Arch E' ELSE FlagCustom := True; END; 3: BEGIN { ASME } IF ((PageWdth = kPS18i) & (PageHght = kPS17i)) | ((PageWdth = kPS17i) & (PageHght = kPS19i)) THEN PageSize := 'ASME A' ELSE IF ((PageWdth = kPS19i) & (PageHght = kPS18i)) | ((PageWdth = kPS18i) & (PageHght = kPS19i)) THEN PageSize := 'ASME B' ELSE IF ((PageWdth = kPS20i) & (PageHght = kPS19i)) | ((PageWdth = kPS19i) & (PageHght = kPS20i)) THEN PageSize := 'ASME C' ELSE IF ((PageWdth = kPS21i) & (PageHght = kPS20i)) | ((PageWdth = kPS20i) & (PageHght = kPS21i)) THEN PageSize := 'ASME D' ELSE IF ((PageWdth = kPS22i) & (PageHght = kPS21i)) | ((PageWdth = kPS21i) & (PageHght = kPS22i)) THEN PageSize := 'ASME E' ELSE FlagCustom := True; END; END;
  13. GetSymRot(ghParm) and IsObjectFlipped(ghParm) need to be used in combination to get the flip status. I doubt whether you can find something that will flip a symbol however.
  14. To date I have only ever read this value and never tried to write to it. That said, this seems to work for toggling the setting on or off using Vectorscript: SetPref(544, NOT GetPref(544)); Perhaps someone else with Python knowledge can spot something in your script.

 

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...