Jump to content

MullinRJ

Member
  • Posts

    2,024
  • Joined

  • Last visited

Everything posted by MullinRJ

  1. 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
  2. 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
  3. 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
  4. PS - Also try setting the fill colors to something other than WHITE. It may make it easier to spot when it does get applied.
  5. 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
  6. 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 :-)
  7. 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
  8. 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
  9. 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
  10. 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
  11. 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
  12. 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);
  13. 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
  14. 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
  15. 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
  16. 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
  17. 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!
  18. 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
  19. 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
  20. 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
  21. 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
  22. Gonda, You only need one instance of the variable conversion. I showed two instances to illustrate with, and without, the units showing. Try: save163state = vs.GetPref(163) # save Show Units setting vs.SetPref(163, True) # Show Units ON S = vs.Num2StrF(your_VARIABLE_here) vs.SetPref(163, save163state) # restore Show Units setting If you are going to format a lot of values, you should turn the above snippet into a user defined function. HTH, Raymond
  23. Dom, In Sam's original post he said he wanted the RADIUS of an ARC formed by 3 points. Your solution provides a CIRCLE through those points. With my inability to read things precisely the first few times through, I thought he also wanted the ARC defined by those points. I finally finished a script that returns the ARC that starts at the 1st point, proceeds through the 2nd point and ends at the 3rd point. If Sam doesn't need it, maybe somebody else will. I should have quit with the RADIUS solution. Here's a VW 2014 file with my script loaded in a script palette. Arc By 3 Points v2014.vwx Run the script and click in the drawing 3 times to provide 3 points. The script will draw the ARC passing through those points and place 2D Loci at the three click points and at the arc's center, then it will wait for you to click 3 more times for another arc. To end, press the ESC key or click 3x in the same place. If anyone can find a way to simplify this solution please post back here. Raymond
  24. Well, Gonda, actually there is. ;-) Try this script: import vs # show how to turn the units suffix ON and OFF when using Num2StrF() CR = chr(13) # Carriage Return # main # vs.SetPref(163, True) # Show units S = vs.Num2StrF(3) vs.SetPref(163, False) # Hide units S = vs.Concat('With units: ', S, CR, 'Without units: ', vs.Num2StrF(3)) vs.AlrtDialog(S) HTH, Raymond
×
×
  • Create New...