Jump to content

MullinRJ

Member
  • Posts

    1,987
  • Joined

  • Last visited

Everything posted by MullinRJ

  1. If the loci were placed in the order they are to be connected, then it is a simple exercise to step through the stacking order and connect them with a script. If they were randomly placed then the algorithm needs a bit more refinement. Raymond
  2. Ah, so it is. How quickly I forget. I'm not sure I know what dimension you are looking for; texture size before or after it's applied. If it's the size of the texture before it's used, I get some numbers with: BitSize := GetTexBitFeatureSize(hbitmap); GetTexBFeatureStart(hbitmap, X1, Y1); GetTexBFeatureEnd(hbitmap, X2, Y2); message(BitSize, ' - ', X1, ', ', Y1, ' - ', X2, ', ', Y2); BitSize is in inches, but the units of the other numbers, your guess may be better than mine. Raymond
  3. After a quick scan through the html VSFuncRef I found the function GetTextureBitmap ( shaderRecord :HANDLE ) :HANDLE; Have you tried it? I'm not sure if it will work, as I've never used it. Good luck, Raymond
  4. I use ObjectVariableLongint() in Reshaper to get the size of bitmaps and it works. I guess I didn't read the online developer reference. One of them is obviously wrong. I'm not sure how to extract the underlying bitmap from a texture. Raymond
  5. Are your handles valid at each step? If one of them returns NIL (0) then all subsequent commands will not work. You can check your handles with this statement placed after your code unless you are inside a Modern Dialog handler routine. message('texture = ', htexture, ' shader = ', hshader, ' bitmap = ', hbitmap); If your handles all have non-zero values, then you can check that the type of the last handle is indeed a bitmap with: message('handle type = ', GetType(hbitmap)); It should return 14 for a bitmap. I haven't tried what you are doing, so I'm not sure if it will work the way you are headed. HTH, Raymond PS - Thank you for your English. My Italian couldn't hold a candle to your English.
  6. Steve, ???The problem appears to be that DUPLICATE() does not update LNewObj, whereas LOCUS() does. So, using the Waldo technique will return the handle you are looking for. ???Waldo works because creating a locus will always create it in the present drawing context of the program - i.e., on a Design or Sheet Layer, or inside a Symbol, Group or other container object; and Locus() always updates LNewObj. Since new objects are always created on the top of the drawing stack, the PrevObj() to the locus (the one directly beneath it) is the Last-New-Object you were looking for. Once you get a handle to your object the locus can be (should be) thrown away. Now you know where Waldo 'was'. HTH, Raymond
  7. Tyler, ???If it's a Menu Command plugin or Tool plugin you're writing, you'll need to use something like: GetPt(pX, pY); Symbol( 'My Symbol', pX, pY, rotationangle);?????{ explicit name } or GetPt(pX, pY); symbolName := 'My Symbol'; Symbol(symbolName, pX, pY, rotationangle);?????{ variable name } ???If you're writing another type of object please describe more of what you are doing. Answers will vary. HTH, Raymond
  8. 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
  9. 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
  10. 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
  11. 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
  12. 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);
  13. 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
  14. 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
  15. 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
  16. 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);
  17. 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
  18. 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
  19. 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
  20. Usually, you can pass an INTEGER where a LONGINT is required. Often, you can do the reverse, but the result can be garbage.
  21. I should read prior posts more closely before responding.
  22. 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
×
×
  • Create New...