Jump to content


  • Content Count

  • Joined

  • Last visited

Everything posted by MullinRJ

  1. I knew someone (@Pat Stanford) would have an elegant way to get inside. Thanks, Pat. Raymond
  2. Using: Message(GetTypeN(FSActLayer)); If I select a free standing Door I get type 86 (Plug-In object). If I select a a Door in a Wall I get type 68 (Wall object). To see the Door on a test wall I have in an open document, I needed to use: Message(GetTypeN(NextObj(NextObj(NextObj(NextObj(NextObj(NextObj(NextObj(FIn3D(FSActLayer)))))))))); As you can see, the door object is deep inside the Wall object. The number of objects in front of it are not exact, and are determined by the wall's construction. You should use a loop to look for the Door, or possibly try ForEachObjectAtPoint(). There may be a more direct way to get to the Door-in-Wall that someone else can point to. I've just done a cursory quick dive at this. Again, make sure your handle is pointing to a Door object before trying to access its record. HTH, Raymond
  3. Are you sure you have a handle to the Door and not the Wall? Raymond
  4. @Paolo , I did a quick test and it looks like the function HasPlugin() only returns TRUE if you have the plug-in installed in your workspace. Loading a plug-in after you have a resource/object of the same name will cause a conflict, but I don't know how VW responds in that scenario. I can only assume it causes more confusion. Raymond
  5. @Pat Stanford , You must know, as I do, that you have to get up pretty early if you want to beat @Pat Stanford to the post. 😉 LOL, Raymond
  6. Hi @Paolo , No, Plug-in names use the same name space as custom objects that you name manually, or by script. The only name space that I know of that is managed separately are the Layer Names. You can have objects, like Symbols, with the same name as a Layer and VW will not raise a conflict. I know this is confusing, but you are now on the right track. Raymond
  7. @herbieherb , It requires accessing two preference numbers – 45 & 6728 – to determine or set the current NavGraphics State. Use GetPref() and SetPref() to read and set these parameters respectively. If you still need help writing your script, please write back. Raymond
  8. Hi @Paolo. I know from testing on several versions of VW that "Siding" is not a reserved word. Would you please post a problem file so that we may investigate further? It's possible that your Mouldings Plug-ins package is using the name "Siding" and that is preventing you from using it again. Also, have you restarted VW to see if the issue goes away? If it does vanish after a restart, does it reappear a little later? Thank you, Raymond
  9. Hi @Paolo , Your test script needs an EndFolder command to compile correctly and run. Also, Name2Index() will always return "0" for a name that does not exist. PROCEDURE test; VAR h : handle; BEGIN h := GetObject('Siding'); if (h = nil) then message('No object with this name! ''Siding'' exists'); NameObject('Siding'); BeginFolderN(16); EndFolder; END; Run(test); Another problem with your script is if the folder "Siding" exists, VW will not delete it and create it again, a new folder named "Folder" will be created, then after that VW will create "Folder-2", then "Folder-3", etc., each time your test script is rerun. I believe @Pat Stanford 's approach is the right way to go – test for the handle's existence, then test for the handle's type – but you have to do different things based on: 1) if "Siding" does not exist (create your folder) 2) "Siding" exists, and it IS a Folder Type (do nothing; or delete the existing folder and recreate it from scratch) 3) "Siding" exists, but it IS NOT a Folder Type (execute your escape plan) HTH, Raymond
  10. Hello Kars (@Kars Keizer), I'm not to sure this is related, but it is confusing. From the Script Reference Appendix I get: and 6 appears to be "Final Shaded". When I run your script I get "Hidden Line", as read from the VW View>Rendering menu. I tried different constants and 5 gave me "Final Shaded Polygon", again as read from the VW View>Rendering menu. On a whim, try different constants. It may or may not work as it may also be platform dependent. I am on a MAC and you are on a PC. It's worth a try. If you find the numbers are wrong, you may have found a bug in the documentation. Raymond
  11. Hello @WhoCanDo , The constraint settings can be accessed by preference numbers. Here's a routine I wrote a couple of years ago that will do what you're looking for. function GetSnaps :String; { Return a string with the current SNAP settings. } Var S :String; Begin S := ''; if GetPref(37) then S := 'A'; { Snap to Grid } if GetPref(1312) then S := concat(S, 'S'); { Snap to Angle } if GetPref(1314) then S := concat(S, 'D'); { Smart Points } if GetPref(1316) then S := concat(S, 'F'); { Smart Edge } if GetPref(38) then S := concat(S, 'Q'); { Snap to Object } if GetPref(1313) then S := concat(S, 'W'); { Snap to Intersection } if GetPref(1315) then S := concat(S, 'E'); { Snap to Distance } if GetPref(1317) then S := concat(S, 'R'); { Snap to Tangent } GetSnaps := S; End; { GetSnaps } Enjoy, Raymond
  12. Hi Lyle, There is now. This script gives you an option to draw the circles on the Ground Plane, or elevate them to the height of the 3D Locus by changing the value of constant "Circles3D". See comments in script. I also added a dialog to let you specify the circle's diameter before the script runs. Procedure Loci3DToCircle; { Replaces every Loci in a drawing with a Circle } { centered at the insertion point of the loci. Use with care after backing up } { the original drawing. Use at your own risk. Here there } { be dragons. No warranty expressed or implied. ;-) } { Adjust the Const Radius = 1' to a unit an size appropriate to the requirement } { All Circles created will use the default class, color, etc of the document. } { January 28, 2015} { July 15, 2011} { © 2011-2015, Coviana, Inc - Pat Stanford pat@coviana.com} { Licensed under the GNU Lesser General Public License} { 08 Aug 2020 - Raymond J Mullin } { This is a modification of Pat Stanford's script to convert 2D Loci to circles. } { This script will convert 3D Loci to Circles on the Ground Plane if constant Circles3D is FALSE, } { or it will elevate the circles to the Z height of the 3D Loci if constant Circles3D is TRUE. } { This script will also use a dialog for the user to set the Circle's Diameter. } Const Radius = 6"; Circles3D = TRUE; { Circles on Ground Plane if FALSE. Floating circles if TRUE. } Var Diam :Real; Procedure DoAction(H :Handle); Var X, Y, Z : Real; Begin GetLocus3D(H, X, Y, Z); ArcByCenter(X, Y, Diam/2, 0, 360); SetObjectVariableBoolean(LNewObj, 1160, FALSE); { circle on Gnd Plane } if Circles3D then Move3DObj(LNewObj, 0, 0, Z); { elevate circle } DelObject(H); { delete 3D Locus } End; { DoAction } BEGIN Diam := RealDialog('What Diameter?', Num2StrF(Radius*2)); if not DidCancel then ForEachObject(DoAction, T=LOCUS3D); END; Run(Loci3DToCircle); Have fun, Raymond
  13. Perhaps it is because the DrawingLabels update after your script finishes, in which case you have already reset the Automatic Drawing Coordination back before any DrawingLabel code runs. If this is the case, I don't know of a way to get around it in one script. Raymond
  14. Hi Julian, Here's one for lower case. PROCEDURE TEST; CONST CR = chr(13); VAR S :String; function LowerCase(S :String) :String; { Convert string S to lower case. } Var Ch :Char; I, StrLen, ChVal :Integer; T :String; Begin T := ''; StrLen := len(S); for I := 1 to StrLen do begin Ch := copy(S, I, 1); ChVal := ord(Ch); if (ChVal > 64) & (ChVal < 91) then T := concat(T, chr(ChVal+32)) else T := concat(T, Ch); end; { for } LowerCase := T; End; { LowerCase } BEGIN S := '0123456789 !@#$%^&*()_+ ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz'; message(S, CR, LowerCase(S)); END; Run(TEST); Raymond
  15. Thanks, Josh. I do miss those days and the mailing lists. Raymond
  16. Hi Josh, In all the documentation I've got (limited as it may be), I've never seen an ObjVar in the 9000 range. Is there anything online with that info, or do tap into guru's in the factory? TIA, Raymond
  17. Good morning, @Pat Stanford . Yes. You, me, and _c_, (and Tui). I just reread the thread and at the end I wrote that it works in VW 2020, but not in earlier VW versions. Also, you cannot export a VW 2020 file back to earlier versions with a popup field defined. Well, you can, but the popup field type will not work anymore. So, @Jesse Cogswell , the question to you is, "What version of VW are you using?" Raymond PS - Thanks for the memory jog, Pat. I'd almost forgotten about that issue.
  18. Hi David, Yes, I have seen the 6 digit rounding when using Python for PIOs. The OIP will display 10 digits, and VS functions like Concat(pRealPIOParam) will display 15 decimal places when they convert Reals to Strings. Example from a VS PIO script I am currently working on showing 15 significant digits: ControlPoint01X= 0 ControlPoint01Y= 15.8676746286034 ControlPoint02X= 0 ControlPoint02Y= 26.1038951010443 I do not have a workaround for Python. Perhaps someone else does. Raymond
  19. Hi David, I think it's a "feature" of Python, and not a limitation of VW. In VectorScript you get 15 decimals displayed for REALS. Is there a way to declare your variables as double precision REALS before you use them? If so, I'm not sure how you would do that for Control Point variables in a PIO. Raymond
  20. The Script Function Reference can be found in your VW application VWHelp folder undoer VWHelp > Script Reference. The same documentation is also available online at https://forum.vectorworks.net/index.php?/announcement/14-developer-wiki-and-function-reference-links/ HTH, Raymond
  21. Just for variety, here is a vector approach to do the same thing. It's just a little more code than Julian's scaling approach, and to the original request it will increment every line on visible layers. If you want the script to only work on the Active Layer, then change the last "2" to a "0" in the following line: ForEachObjectInLayer(GrowLine, 0, 0, 2); { All objects, Shallow, Visible layers } ForEachObjectInLayer(GrowLine, 0, 0, 0); { All objects, Shallow, Current layer } Procedure GrowLinesByInc; { Grow each line on visible layers by a user input length. If the user input is positive } { the line length increases, if it is negative, the line length decreases. } VAR dLength : REAL; function GrowLine(H :Handle) :Boolean; { Use global variable "dLength" to calculate a vector in the same direction } { of each line and add half of it to each end. } Var P1, P2, Vdelta :Vector; Begin if (GetTypeN(H) = 2) then begin { type 2 is a LINE } GetSegPt1(H, P1.x, P1.y); { start point of line } GetSegPt2(H, P2.x, P2.y); { stop point of line } Vdelta := UnitVec(P2 - P1) * dLength/2; P1 := P1 - Vdelta; { move away from center } P2 := P2 + Vdelta; { move away from center } SetSegPt1(H, P1.x, P1.y); { new start point of line } SetSegPt2(H, P2.x, P2.y); { new stop point of line } end; { if } end; { GrowLine } BEGIN dLength := RealDialog('Length increment?', '0'); if not DidCancel do ForEachObjectInLayer(GrowLine, 0, 0, 2); { All objects, Shallow, Visible layers } END; Run(GrowLinesByInc); Raymond
  22. If there's no way to add a 3D fillet by script, you can always do a solid subtraction. Yes, it's a lot more work, but it is doable for simple shapes. Raymond
  23. Hi Julian, That is not what I was hoping for. CreateControl(), option 2, creates a button to select a color from a system color palette. I was hoping to set the color of a PushButton, so I guess I mis-interpreted the function's use. Thank you for clarifying it. Raymond
  24. It is my understanding, flawed as it is, that "vst" commands apply to TOOLS, where "vso" commands apply to OBJECTS. There may be some crossover, so like Sam, I await someone else's answer. Raymond
  25. Has anyone ever gotten SetColorButton() to work? It is advertised as being introduced in VW 9.0, but I could not get it to affect a color change on a Modern Dialog PushButton in VW 2019, VW2014, or VW 2009, which is as far back as I can test without switching computers. Is it designed to work on a different kind of control? Documentation is sparse in both the HTML Script Function Reference and the online Developer's WIKI. If no one answers to the affirmative in a day I'll file a bug. Thank you, Raymond


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