Jump to content

MullinRJ

Member
  • Posts

    2,007
  • Joined

  • Last visited

Everything posted by MullinRJ

  1. Yes, selecting by opacity criteria is new in VW 2012. For VW versions that have Opacity (VW 2008 and later), you can use the follow script to select object in a range of opacity values. It is similar to a script I posted a couple of weeks ago that selects 3D Symbols based on the Z Heights. You may see a pattern emerging. PROCEDURE xxx; { 27 Mar 2012 - R. Mullin } { A way to select objects in a range of opacity values. } { Opacity values are in the integer range of 0 to 100, inclusive. } { Only visible objects on the current layer are affected. } CONST OpacityHi = 90; { Edit value to suit needs } OpacityLo = 50; { Edit value to suit needs } VAR H :Handle; OP :Integer; function SelectByOpacity(H :Handle) :Boolean; { Select objects in the range of OpacityLo <= OP <= OpacityHi. } Begin GetOpacity(H, OP); if (OP <= OpacityHi) & (OP >= OpacityLo) then SetSelect(H); End; { SelectByOpacity } BEGIN DSelectAll; { remove this line if you want to add to existing selection } ForEachObjectInLayer(SelectByOpacity, 1, 0, 0); { Visible, Shallow, Current layer } END; Run(xxx); HTH, Raymond
  2. sleg, ???In the Resource Browser, select the symbol you want and right-click on it. Choose "Attach..." and you'll get a dialogue with your record format choices. Pick one, or more, by placing a check-mark in front of the record format name(s). Now when you place that symbol in your document you'll have your record(s) attached. Previously placed symbols of the same name will be unaffected. Raymond
  3. Hi Dan, ???Inside your VW application folder is a folder called VWHelp. There is a PDF of the VS Language in the Additional Documentation sub-folder. For basic language guidance, you can also pick up any book on Pascal to get detailed instructions on structuring a program. ???Inside the other folder, VS Reference, is the VSFunctionReference.html, which has a description of most of the available VS calls. There is also an online version of the same thing at "http://developer.vectorworks.net/". It is slightly more up to date. ???One quick way to see how to draw objects w/ VS is to take a simple document and export it as VectorScript. You'll get a text file with your shapes in it. There will be a lot of header stuff you can ignore, like record format definitions and class attributes settings, but the calls to Lines, and Arcs, and Rectangles, etc. will be there. ???And, you can subscribe to the VS Mailing List, and/or peruse the two VS sections of this Board. There a re lots of gems in them. HTH, Raymond
  4. Too many parentheses. Try: SelectObj(test); { selects all text objects } If you want extra parentheses, put them in your concat statement: S := concat('(T=', S, ')'); { create (T=TEXT) to select all text objects } SelectObj(S); { selects all text objects } Raymond
  5. Hello Dan, ???Here's a very short routine that does what you are looking for. You'll have to edit the constants TopZ and BotZ to make it work for you. If you intend to use it a lot, then a dialogue can be added to allow user input from the screen. HTH, Raymond PROCEDURE xxx; { 12 Mar 2012 - R. Mullin } { Quick and dirty way to select 3D Symbols in a range of Z values. } { Only visible symbols on the current layer are affected. } CONST TopZ = 2.5; { Edit value to suit needs } BotZ = 1.0; { Edit value to suit needs } VAR H :Handle; X, Y, Z :Real; function SelectByZ(H :Handle) :Boolean; { Select 3D Symbols in the range of BotZ <= Z <= TopZ. } Begin GetSymLoc3D(H, X, Y, Z); if (GetType(H)=15) & GetObjectVariableBoo(H, 650) & (Z <= TopZ) & (Z >= BotZ) then SetSelect(H); End; { SelectByZ } BEGIN ForEachObjectInLayer(SelectByZ, 1, 0, 0); { Visible, Shallow, Current layer } END; Run(xxx);
  6. You could convert the text to paths, but you lose the textiness of it all. If what you want is just the center point, then you could write a script to convert a duplicate text object to paths, find its center, delete the path object and place a locus at that point. I know, it's like using a bazooka to kill a mosquito, but how often do you get to fire a bazooka? Raymond
  7. Hi Michael, ???To be honest, I guessed. It's one of the few times I took a shot in the dark and hit it on the first try. Saddly, I have never needed SetdownDialogC. ???As Joshua said, nothing happens during these dialog events that you don't explicitly program. They are just 2 events that get passed to your handler to start things up and finish them off. No magic involved. If you don't put any code in these sections, the dialog will run as if they never existed. Raymond
  8. I always thought of the C as standing for "Constant". Statements in this section are executed BEFORE the dialog is presented to the user. Do all of your setup here. There is also a SetdownDialogC. Statements in this section are executed AFTER the dialog is closed by the user. I don't know if you'll ever need SetdownDialogC, but it's there for completeness. Raymond
  9. Michael, When your program starts, userString is uninitialized. When your dialog starts, the first thing that happens is you write userString into field 4, thus overwriting the starting value of field 4 with a null string. In the code below, I removed that one line in the SetupDialogC section and it runs with your initial text string displayed in the field. HTH, Raymond Procedure TextDialogQuestion; {Badly scripted by Michael Klaers} VAR DialogID :INTEGER; DialogResult :INTEGER; userString : STRING; PROCEDURE Dialog_Handler(VAR item :LONGINT; data :LONGINT); BEGIN CASE item OF SetupDialogC: BEGIN END; { SetupDialogC } 1: BEGIN GetItemText(DialogID, 4, userString); END; { 1 } END; { case } END; { Dialog_Handler } BEGIN DialogID := CreateLayout('Get User String', FALSE, 'OK', 'Cancel'); CreateEditText(DialogID, 4, 'enter text here', 24); SetFirstLayoutItem(DialogID, 4); DialogResult := RunLayoutDialog(DialogID, Dialog_Handler); Message('User Entered String is: ', userString); END; RUN(TextDialogQuestion);
  10. Thanks for sharing. I have some trees in Texas I'd love to know more about, but can't find any pictures anywhere that match. Even people in local nurseries are stymied. I hope this site grows fast. Raymond
  11. Michael, ???In Maarten's example, variable "a" is the ITEM number of the dialog item that was clicked on, or typed in. Every dialog event passes the relevant item number to a "Dialog_Handler" routine. If you want to do something for an event, then you need to have that item number enumerated in the CASE statement in the dialog handler routine with some code to be executed. ???Variable "b" in Maarten's example is "DATA". For the most part DATA is not used by the user. I have only found one instance in 10 years where I've used it and am waiting patiently for another. I'm not holding my breath. ???The formal declaration of the event handler procedure should look something like this: PROCEDURE Dialog_Handler(ITEM :Longint; DATA :LONGINT); ???This procedure is called from the "RunLayoutDialog()" command. Its declaration is defined in the VS Function Reference. "RunLayoutDialog" is a function that starts a dialog then returns the result of the dialog in an integer when the dialog closes ? 1 for OK and 2 for CANCEL. ???The name of the event loop, in this case "Dialog_Handler", is passed in the second parameter of "RunLayoutDialog()". Though the example cited above is a bit cryptic at first glance, a simpler example of this call would be: Result := RunLayoutDialog (dialogID, Dialog_Handler); ???While a dialog is running, the Modern Dialog machinery passes the item number of every item that is invoked to the callback procedure, which again in this case is "Dialog_Handler". The parameter list of "Dialog_Handler" is understood to be two Longints, ITEM and DATA, and does not get spelled out in your code. HTH, Raymond
  12. It's more than theory. I do this for a special case in Reshaper; open a second dialog from inside a first dialog. It may not be the best interface design, but it may work for some instances. The dialogID allows you to have the same item numbers in multiple dialogs. If this were not the case, confusion would ensue if you tried to modify an item number that existed in multiple dialogs. The idea of the dialogID acting as a HANDLE to the dialog window is exactly the right way to think of it. It's assigned at runtime when the dialog opens, and disappears when the dialog closes. Raymond
  13. Usually, you can pass an INTEGER where a LONGINT is required. Often, you can do the reverse, but the result can be garbage.
  14. I should read prior posts more closely before responding.
  15. Who, ???If you've ever read any of my posts, you have seen I use indenting all the time. Is this what you're looking for? for i := 4 to 6 do ??begin ????CreateThreeStateCheckBox (DialogID, i, Concat (' ', i)); ????SetBelowItem (DialogID, i - 1, i, 0, 0); ??end; for i := LayerCount -1 downto 1 do ??begin ????h := NextLayer (h); ????LayerName := GetLName (h); ??end; ???As you've noticed, the TechBoard removes leading white spaces (Sp & Tb), and compresses multiple white spaces in the middle of lines to a single space character. ???The character you want to enter is Non-Breaking-Space (NBSP). On the MAC, use Option-Space. On Windows, try Alt+0160 or Alt+255 (on numeric keypad). The Windows info comes from Wikipedia, and I haven't tried it. Please, only do this for short code segments you want to post inline. For longer code blocks that other people might want to copy, preserve your tabbed formatting with the [/code ] headers. Otherwise, people will have to convert your NBSP characters to Tabs, and that's a pain. ???As for using [kode] [/kode] (misspelled intentionally to prevent it from working), you need to place your CODE between the ] [ characters. [b][kode] Your Code Here [/kode][/b] It will keep its formatting and be placed in a nice little gray box as seen in Pat's post. Raymond
  16. Nearly 2 years ago I posted a PDF of an annotated VW Pref Constants to the Techboard. It's not a complete listing of all preferences, but it has all of the VW prefs that you can set from the VW Preferences Dialog. Document Prefs and Unified View Prefs windows can be found in the second posting in the following thread. Of course, some new settings may have been added since then, but not too many have been. You can find the PDF files here: VW Preference Constants HTH, Raymond
  17. The Use Layer Color pref constant is 11. A list of constants can be found in the VectorScript Function Reference Appendix. The following one line script can be used to toggle the Use Layer Color preference: SetPref(11, not GetPref(11)); Raymond
  18. I was surprised last week when I opened an old file for someone and found that VW 2012 opens files all the way back to MC 7 format. I'm sure NV has mentioned this at some point, but I think they should mention it again and say it a little louder and more often. This gives the software quite a bit of flexibility that it did not have before. As for saving VW files, VW 2012 will save back to VW 12 format. Raymond
  19. You can also save a file as a template using the menu File>Save As Template... It will be saved in your User folder. I have created several templates for starting new documents where I set the Font, Units, Page Scale, Dimensions, and Script Palette. The big distinction for me is the Units (mm, microns or inches). Obviously, your needs will differ from mine, but the concept is the same. You can also add record formats, spreadsheets, layers, viewports, symbols and other resources you use all the time. For resources you use sometimes, save them in a library file. HTH, Raymond
  20. Chris, ???Would you please post your website? I tried "www.AR-works.com", but that's not it. Arlene Best probably doesn't mind, though. Thanks, Raymond
  21. I tried the script on a small file and it did not crash. Perhaps it has to do with a specific object in your file. In a copy of your file, you might try removing symbols to try and locate the offending object. If it still crashes with an empty symbol folder then it is something else. Write back with more info and hopefully someone will be able to help further. Please, work in a COPY of your file. Raymond
  22. Hi Pat, ???Your script will only work on the first layer. NextObj() will return NIL at the end of the first layer and will not return a handle to the first object on the second layer. Of course, if your file only HAS one layer, it works perfectly. ???You could encase your loop inside a loop that steps through the layers and use FActLayer instead of FObject (been there, done that), but I'd suggest using ForEachObject() or ForEachObjectInLayer() which will step through every object in the drawing. Using the GROUP or DEEP options in the latter call will remove the need for recursion. ???This example is definitely not as sexy as your example, but it's fast and thorough; and like your example, it's untested, so caveat emptor and always wear your galoshes when it's raining. Procedure UnlockAll; function Unlock(ObjHandle: Handle) :Boolean; Begin SetObjectVariableBoolean(ObjHandle, 700, False); End; { Unlock } BEGIN ForEachObjectInLayer(Unlock, 0, 1, 1); { All Objects, All Layers, Enter Groups } END; Run(UnlockAll); Raymond
×
×
  • Create New...