Jump to content


  • Content Count

  • Joined

  • Last visited

Everything posted by MullinRJ

  1. David, As Jim stated above, the compiler in SP1 will accept the NBS character ( and maybe others ) without kicking an error. If you can wait a few days (I'm guessing here, based on Jim's "imminent" estimate) you won't have to edit anything. Raymond
  2. My answer to David (in a PM) was his PIO's have Non_Breaking_Space (NBS) characters in his code and the compiler does not like single_byte characters in the Extended ASCII range (#128-255) . The NBS character is a High Order ASCII character (#160 decimal). UTF-8 only accepts ASCII in the 0-127 range. It is a relatively simple process to replace all NBS characters \x{A0} with TABs \t or SPACEs. I was able to edit the .vsm file in TextWrangler (yes, I still have a copy), replace all NBS with TAB, then save. The file then compiled and ran. It would be very easy to 10, 50, or 100 .vsm files in succession. BUT, BE WARNED. THIS SHOULD ONLY BE DONE ON COPEIS OF YOUR ORIGINAL PLUG-IN FILES!!! MAKE BACKUPS, THEN DO YOUR SURGERY. The NBS character is not the only character that will cause compiler problems, but it is a very common character to encounter, AND it is nearly invisible. It looks exactly like the SPACE character (#32 decimal). Any character in the Extended ASCII range (#128-255) will cause problems. For more elusive problems, it may be necessary to use a HEX Editor to see exactly what characters are in your files. HTH, Raymond
  3. David, Would you please send me one of your troubled PIO's? I'll tell you what I find. It shouldn't take posting your code to a website, and copying it back to clear the cobwebs. I'll send you my email address in a PM. Thanks, Raymond
  4. David, I pasted your script into VW 2018 (into both a Palette Script and a Menu Command) and it worked perfectly. Perhaps it is the menu PIO you migrated from VW 2008 that is kicking an error, but I can't test that here. Try creating a new one in VW 2018 and migrate your script to it. If the error persists, it's in your code. If it runs, it's your old Menu Command. If you copy your text out to an external text editor, then copy it from there and paste it back into the VS Editor, does it compile? One trick I've used to clear unseen cobwebs is to CUT everything out of the script Editor, close/save it, run the empty script (which forces the compiler to compile the empty file, which will execute without errors), then reopen the Script Editor and past the text back in. Sometimes that's all it takes. A more likely cause is VW 2018 now runs entirely on Unicode (UTF-8 for scripts, UTF-16 internally). If there are any high-order ASCII characters in your code (chars 128-255 are illegal one-byte characters in Unicode), like a Non-Breaking-Space character, you will get strange errors. BBEDIT or something similar can help you isolate any "odd" characters, or translate them to UTF-8 encoding, at which point they will compile as they always have. Save a Latin-1 encoded file as UTF-8, then copy that text to the script editor and it will work. Let us know how your next round fares. Raymond
  5. Hello Martin, Your problem lies in your choice of variable names. In this case it is "lineType". The compiler must have it tagged with another meaning in criteria statements, although I did not find it listed as a KeyWord. Change it to "lineTypes", or "lineTyp", or "line_Type" and your script will work in VW 2018. That said, your script could be written as a one-line VectorScript: SelectObj( (C = 'sides') AND V ); Unless you intend to expand your script where it needs more lines and/or variables, this one line does the same thing as the 12 lines in your script. Also note that you are using variable and procedure names that are already pre-defined VS commands, like "line" and "Poly". Although this usually works as you intend, it can sometimes cause you problems in more complicated scripts and it should be avoided. Been there, done that, spent hours trying to figure out why a script that compiles doesn't run. Raymond
  6. MullinRJ

    Record fields not updating after script

    There is also ResetBBox(handle2SymbolPlacedInYourPIO). I've used this successfully OUTSIDE a PIO to get updated text to display. No promises, but worth a try. Raymond
  7. MullinRJ

    PIO with text...background color?

    PS - Also try setting the fill colors to something other than WHITE. It may make it easier to spot when it does get applied.
  8. MullinRJ

    PIO with text...background color?

    Sam, Have you tried SetFPat()? This will override the document setting for Fill_Pattern. TextOrigin(0,0); CreateText(concat(distbase, CHR(39))); SetFPat(LNewObj, 1); { sets fill pattern to solid background, which uses the background fill color } or SetFPat(LNewObj, 2); { sets fill pattern to solid foreground, which uses the foreground fill color } HTH, Raymond
  9. MullinRJ

    Vectorworks 2018

    Jim, I want to thank you personally for handling ALL of the advance Teasers, for being the Messenger, and the Dart Board. It is a job extremely well done. You are truly a multifaceted vortex of talent and responsibility. There is no way anybody will know what is on the table before them until AFTER they have supped. May you survive the meal until the dessert plates are cleared. VW 2018's design blended with current technology is a gift to any user who understands the value of a custom tool he or she helped influence, and though I haven't tried most of what is offered, I am thoroughly impressed with the Multiple View Panes, the Unicode implementation, and Plug-In Styles. Multiple View Panes is flashy and everybody will see it in action and understand it right out of the box. The Unicode handling is much more subtle. It will take people longer to appreciate it, but it will be one of the first things they will miss when they try to use older versions of VW. Plug-In Styles may be tricky for some to grasp at first, but it is an excellent way for VW to organize a huge volume of design differences for each manufacturer's library. This approach to managing resources revolutionizes how VW users will handle many large catalogs from an ever expanding source of suppliers. Congratulation to you and all your co-workers. It's time to take a deep breath and relax for 5 minutes. See you at the Summit, Raymond :-)
  10. MullinRJ


    I am not the expert you are looking for, but when I used the PL tool everything was good until I made a mistake. Trying to remove a vertex an add one back was so unintuitive (it was an Arc vertex) that I did better by drawing lines and arcs, composing them, then converting the polyline into a PL object. I'd like a lesson on how to enter and modify data for this tool, too. Raymond
  11. Now it's official. You two are bound by Script-ure. ;-)
  12. Oh, but it IS a "script order factory", and the chefs are lined up at their keyboards. You'd be amazed what you can get with a "please" and "thank you" around here. Right Pat? and Mike? and Wasn'tISam? This place isn't even the right place. If you want some real attention try posting questions in the VectorScript or Python fora. ;-) Raymond
  13. Gadzooks, With the Symbol Insertion tool selected, make sure your symbol insertion mode is set to "Insertion Point" (fourth button in its group). It can be toggled, intentionally or inadvertently, by pressing the "O" key when the Symbol Insertion tool is active. HTH, Raymond
  14. Sam, Can you post some sample code? This is not something I want to mock up from scratch to investigate. Off the top of my head, I don't know if it can be done. It's been a while since I built a List Box and I don't remember what it did or where it is. Maybe I'm suppressing some painful memory, or maybe I'm just getting old. Raymond
  15. MullinRJ

    Scale Objects Script

    You're welcome, That works, too. And, it's better written. I hope you'll keep trying your hand at scripting. It's a great tool and makes VW extremely powerful. If you get stuck with anything, post your questions here. This forum is incredibly helpful. Hope to see around. Raymond
  16. MullinRJ

    Scale Objects Script

    Hello Marc, There are two problems. First, you have an extra "END" in the middle of the program that needs to be removed. Second, when you make individual references to the handles in your array you need to add a subscript to indicate which one you want. Eg. where you have MyH := h; you should have MyH[index] := h;. I marked these below. Make these changes and it will work. HTH, Raymond PS - Your code may be indented on your computer, but the example above is not. If it isn't, doing so will help you see mismatched BEGIN/END's more easily. Procedure Individual_Scale; VAR x,y: REAL; h: HANDLE; i,j: INTEGER; MyH: DYNARRAY [] OF HANDLE; BEGIN x:=RealDialog ( 'Skalierungsfaktor','0.5'); y:=x; h:=ActLayer; j:=NumSObj(h); ALLOCATE MyH[1..j]; h:=FSActLayer; FOR i:=1 TO j DO BEGIN MyH[i]:=h; { need array reference [i] } h:=NextSObj(h); END; { END; <= this END shoud not be here. Remove it. } DselectAll; FOR i:=1 TO j DO BEGIN SetSelect(MyH[i]); { need array reference [i] } Scale(x,y); SetDSelect(MyH[i]); { need array reference [i] } END; FOR i:=1 TO j DO BEGIN SetSelect(MyH[i]); { need array reference [i] } END; END; RUN (Individual_Scale);
  17. MullinRJ

    Select line by length

    Pat, I believe an extra blank line at the end is only needed when you are using $INCLUDE files, and the blank line ensures adjacent files don't create a syntax error when all the text is merged together. I pasted your code into a text file with the file terminating right after the last semicolon and it ran perfectly with menu item "Run Script..." and also with the "Text File... CMD-5" option in the VectorScript Editor. I can only assume @cberg copied a little too much, or little too little. Hard to tell w/o the error message. Raymond
  18. MullinRJ


    In the Mac's System Prefs > Accessibility > Zoom, check the "Use scroll gesture with modifier keys to zoom:" checkbox and choose one of the 3 modifier keys. When you hold that key down and roll the mouse wheel your screen will zoom about the cursor. I use the the Control Key, since VW uses the Option Key on the Mac for almost everything. This is a HUGE saver on aging eyesight and a lot cheaper than those fancy goggles. 8-) Raymond
  19. MullinRJ

    Symbol Height

    Mark, You could also script a tool that would place a symbol where you click, then move it in the vertical direction to a 100 mm elevation. Raymond
  20. MullinRJ

    Worksheet Current Layer Criteria

    Gentlemen, Here's a small file with a custom WS function that returns the active layer name to the cell it's placed into. It should simplify having to type the layer name in manually. If you change a layer's name, the function adjusts automatically when the WS is recalculated. If you're like me, and you sometimes use a worksheet to gather info without placing it on the drawing, then all you need to do is change the Active Layer, open the WS resource, and recalculate to get stats from the current active layer. You'll only need one WS resource for this kind of use. If you want to place a WS instance on multiple layers, then the way Michael set it up in his example file (with 1 WS resource for each layer) will work, but you if use the ActiveLyr function from my example you won't have to type the Layer Name into each WS resource. HTH, Raymond WS ActiveLyr.vwx
  21. Hi Pat, Don't make me laugh (too late). When I read Michael's second post this morning, I thought, "better" way?!? What's wrong with Copy / Paste? I've been using it since 1990 and it's never let me down. And before you threw my name onto the Coliseum Floor, I thought maybe hDuplicate() would work, so I tried it on a single window in a wall. It seemed simpler, but it wasn't working. Nope, this wasn't better, and real work got in the way, so I shelved it. After reading your second post (and laughing) I recreated the file and tried it again. The duplicate and the original windows seem to lock themselves to each other when hDuplicate() is used. I can't drag the duplicate window around after I create it. The new window doesn't cut the wall properly in Plan, though the OIP says it is a "Window In Wall". Lastly, I can't delete it. Select it, yes; delete it, no. If I delete the original window, then both delete – very odd. They seem joined at the hip. Perhaps this is a bug. I don't know if hDuplicate should work on Windows in Walls. Naively, I think it should. I'll send it in and see what comes back. So, after spending more than an hour pushing dead code around, I tried your approach — Copy / Paste (in Place). It works like a champ. The two windows act as separate entities, interactively and programatically. I'm giving your approach 2-thumbs-up. Michael, do what Pat says. He's usually right*. ;-) Raymond * When he's finished his morning coffee, he flies back from Columbia (Maryland). He never has to launder his bed linens, he just creates new spreadsheets. When asked to solve vector problems, he is never wrong, and his answers always follow the Right–Hand–Rule. He IS the Most Interesting Man On The Forum!
  22. MullinRJ

    Script for replacement of symbols

    halfcouple, The code needed to do the symbol replacement is very short and easy –IF– you use the right call. As a seasoned Vector-Scripter I knew there was a call that would swap out the handles of one symbol definition with another, but it took me more than half an hour to find it. "SetHDef" It's not listed with the Symbol routines, but rather with the Object Editing routines. I think it should be listed with both (and others), since it serves multiple object types, but that's another issue entirely. Using SetHDef will literally save you tons of work if you try to manually place a symbol were the old one was and then delete the original. If the existing symbols have Attached Records and/or Names, these will be preserved. The symbol's Position, Rotation, and Flip State are also preserved. And best of all, the original Stacking Order is preserved. If you try to preserve all of these attributes manually, your code will get pretty complicated quickly; and that doesn't include anything you need to do with the User Interface (UI). Here's a short script that swaps all selected symbols with the one named at the top of the script. It has no UI – that's the hard part, and where you will spend most of your time writing scripts. PROCEDURE ReplaceSymbols; { Replace selected Symbols with the symbol named in constant "NewSymName". } { This method preserves: Position, Rotation, Flip State, Name, Attached Records, Stacking Order, and Visibility. } { 03 Jun 2017 - Raymond J Mullin. } CONST NewSymName = 'YourNewSymNameHere'; { new sym - change as needed at the moment } VAR NewSymDefH :Handle; function SwapSym(H :Handle) :Boolean; { swap symbol instance H with NewSymDefH } Begin if (GetTypeN(H) = 15) then SetHDef(H, NewSymDefH); { swap Symbol Definitions } End; { SwapSym } BEGIN NewSymDefH := GetObject(NewSymName); { Handle to new symbol name } if (NewSymDefH <> nil) then ForEachObjectInLayer(SwapSym, 2, 0, 4) { Selected, Shallow, Editable Layers } else AlrtDialog(concat('Symbol "', NewSymName, '" does not exist. Check spelling.')); Sysbeep; { I'm done - tell everyone! } END; Run(ReplaceSymbols); As to crafting a UI, once you decide how your script/tool should run, i.e., whether you use a dialog to pick the new symbol, or pick your new symbol interactively AND whether you work on an existing selection or select symbols with your tool, you can write back for more advice on how to implement it. In the mean time play with this script and tweak the constants in the ForEachObjectInLayer() statement. There a quite a few variations in how that statement works. To change the symbol that does the replacing, modify the symbol name in the CONST section at the top of the program. It's not elegant, but it works. Good luck, Raymond
  23. MullinRJ

    SetWallWidth() replacement

    In VW 11.5 and earlier, the VS command SetWallWidth() set the width of the Wall tool. In VW 12.0 the command was declared obsolete. The VS command SetWallStyle() was introduced in VW 12.5. Though setting a WallStyle does allow me to set the wall width for the Wall tool, the command is not honored in VW Fundamentals, yet VW Fundamentals does support WALLS. The problem I am having is trying to write a script that will work in a VW Industry package and also in VW Fundamentals using non-deprecated commands. Luckily, SetWallWidth() still works in VW 2017, but I would like a solution that will work when the deprecated function no longer compiles. Currently, is there a proper way to set the width of the Wall tool via script so that subsequent uses of the tool will draw walls with the desired width in all VW products? TIA, Raymond
  24. MullinRJ

    SetWallWidth() replacement

    Hi Miguel, If the Wall tool were a Plug-In-Object, then perhaps, but it is built into the program and I don't think it can be accessed that way. Of course, I don't really know, but my first try using your approach failed. Perhaps someone with more insight will enlighten me. Thank you, Raymond
  25. MullinRJ

    Poly TO Vectorscript

    First, do what Pat says. Additionally: If the object is a Polygon, you are good to go. If the object is a Polyline, AND, there are NO holes in the Poly, you are good to go. If the object is a Polyline, AND, there ARE holes in the Poly, the Poly outline will export, but the holes will not. This has been a shortcoming of VS Export from the earliest days of MC/VW. 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.