Jump to content

MullinRJ

Member
  • Posts

    1,993
  • Joined

  • Last visited

Everything posted by MullinRJ

  1. Jonathan, Add a wish for Floor and Ceiling functions. Floor is a round down function and Ceiling is a round up function, both found in most popular spreadsheets. VW surely needs more functions for its WS. Raymond
  2. Jakes, Welcome. There is a directory in your User folder :User:Your Acct Name:Library:Application Support:Vectorworks:20xx: where xx = 08, 09, etc. that has all your custom stuff in it. If you modify a workspace, it is stored here in the Workspaces folder. Copy your customized workspace from here to the same place on your other machine. Raymond
  3. This problem is one that has been bug-listed and wish-listed. SetOrigin() and SetOriginAbsolute() work in both Palette Scripts and Menu Commands (Plug-ins) while the script is running, BUT, when Menu Commands quit, VW resets the user origin back to where it thinks it was so your changes are not permanent. VW gets it wrong when the Plan is rotated from a script and the User Origin gets reset to a different place (also bug-listed). Bottom line, run scripts that are intended to move the User Origin from a Script Palette, or from the "Run VectorScript" menu (as you've already figured out) and it will work as you desire. Raymond
  4. You might also try using: SetObjBeginningMarker() / SetObjEndMarker() to see how they work. You'll need a handle to the object, though.
  5. From the VS Func Ref: ???Special Notes: ???Marker is obsolete as of VectorWorks13.0 (2008) But, as long as the code still works try Option 0: ???Marker(0, 0.125, 15); which will give you a filled arrow. If fill color is not right, try setting it with FillFore or FillBack, OR, SetFillFore / SetFillBack. HTH, Raymond
  6. Timbo, ???If you want a script to be both stand-alone and callable from a larger script you will need a library (folder) of script parts that you can assemble with $INCLUDE statements in other files. For example: ???PROCEDURE SetLW6; ???PROCEDURE SetFillBlue: ???PROCEDURE SetOutline; ???PROCEDURE SelectAllRects; might be routines you want to call individually or from another script. In your library, split the small routines into two pieces; one that has the procedure definition in one file; and the other that has two lines, an $INCLUDE and a RUN(); File "SetLW6.px": ???PROCEDURE SetLW6; ???BEGIN ??????PenSize(6); ???END; File "RunSetLW6": ???{$INCLUDE \YourLibrary\SetLW6.px } ???Run(SetLW6); ???File "RunSetLW6" is the file you would use to make a Menu Command PIO for the stand-alone execution of "SetLW6". ???In a larger script you can access the procedures in your library by adding several $INCLUDE files then calling the included procedures. File BIG_SCRIPT_1: ???PROCEDURE BIG_SCRIPT_1; ??????{$INCLUDE \YourLibrary\SetLW6.px } ??????{$INCLUDE \YourLibrary\SetFillBlue.px } ??????{$INCLUDE \YourLibrary\SelectAllRects.px } ???BEGIN ??????{ Your code here } ??????SetLW6; ??????SetFillBlue; ??????{ Draw something here } ??????DSelectAll; ??????SelectAllRects; ??????{ More of your code here } ???END; ???Run(BIG_SCRIPT_1); ???If you want to call BIG_SCRIPT_1 from other scripts, then split it in two pieces as shown above. With this setup, you can make changes to any of your files and they will be reflected in all procedures that use them. ???One last caveat, always have at least one blank line at the end of each $INCLUDE file. Without it you will get compiler errors. HTH, Raymond
  7. To the best of my knowledge, you cannot call custom Menu Commands from within another Menu Command or Plug-In object. If you find a way to do so, please post it. Raymond
  8. Carl, Do you know what font is used in the logo? Have you tried typing it out in that font and converting Type to Polylines? If you get that far, the edits become manageable. Raymond
  9. Carl, 515 vertices is workable, compared to 16K vertices. It's still high, but you're in the right ballpark. Is there any reason you are converting to Polygons? Polylines will extrude. The built in Poly Smoothing functions in VW are inadequate for this task. There are some 3rd party tools. The one that comes to mind is a VectorBits tool - Purge Polygons. Vector Bits - Donationware There are probably others, but you'll have to search the web. HTH, Raymond
  10. Hi Carl, ???The vertex count is WAY too high in the letters to be useful for any extrusion. The capital S alone has 16589 vertices. You will need to reduce the vertex count by 10X to 100X if you want VW to handle these as extrudes with any alacrity. Raymond
  11. Have you tried: CreateDuplicateObject (objectToDuplicate, containerHandle :HANDLE) : HANDLE; ???and ConvertToPolygon (h: HANDLE; resolution: INTEGER) : HANDLE;?? to do the Convert Copy to Polygons? They look promising. Not sure how to do the Cut 3D Section. Raymond
  12. Not directly in VW, but with the Reshaper plug-in, you can. If you'd like to try it, write me offline at info@siriussolutions.net. Raymond
  13. Extrude the 2D Polygons. That will give you 3D objects you can manipulate in position and/or add and subtract. Raymond
  14. Timbo, ???Since no one else has posted I decided to try this. hMoveBackward() does work. Here's an example that creates a new layer with a stock name, numbers it and sends it to the bottom. It can be easily made into a procedure or function that can be called from within a larger script. Raymond PROCEDURE NewLayerOnBottom; { Create a new layer and send it to the bottom of the stacking order. } CONST BLN = 'Layer'; { Base Layer Name } VAR I :Integer; S :String; BEGIN I := 1; while (GetLayerByName(concat(BLN, ' ', I)) <> nil) do I := I + 1; S := concat(BLN, ' ', I); Layer(S); hMoveBackward(GetLayerByName(S), True); END; Run(NewLayerOnBottom);
  15. Does HMoveBackward() work? I haven't tried it, but that would be my first guess. Raymond
  16. Is your profile open or closed? If open, try closing it. If closed, try opening it. Raymond
  17. SetPref(14, not GetPref(14)); Use this one line VectorScript and it will toggle the "show others while in groups" pref. You can run it from a script palette, or do as most of us do: create a Menu Command in the VectorScript PlugIn Editor, and add it to your workspace(s) with a keyboard shortcut. If you need help doing the latter, write back, but you can start by reading Robert Anderson's post The VectorScript Advisor: What do I do with a VectorScript, anyway? Raymond
  18. I've not tested this, but if you know the name of the texture beforehand, GetObject() should return a handle to the resource. Raymond
  19. Don't forget the CONCAT function. If you want to see the value in a string and don't care about the number of decimals, CONCAT is quick and easy. It works on a whole bunch of data types, too. MESSAGE does the same thing including posting the string to the Message Window. These are both great functions for debugging. Raymond
  20. Try: ???PickObject() - for picking the object under the cursor ???GetPickObjectInfo() - same as above, but will also return a handle for an object inside a container, such as a symbol in a wall. Not sure if it will find an object inside a group (from the outside a group), but it's worth a try. ???ForEachObjectAtPoint() - this is a procedural routine that will return all the handles that are under the cursor and allow you to do something with each of them. HTH, Raymond
  21. TextWrangler is just a word processor. Yes, you use $Include in your PIO to reference a text file on disk, which makes debugging your script faster than opening the PIO Script editor each time you want to effect a change. You keep the file open in TextWrangler (or any text based word processor), make a change, save the file to disk and run your PIO again to see the effect of your change. One nice thing about using TextWrangler is that it allows for text coloring of key words in VS by adding a plugin to TW. Orso Schmid posted such a PlugIn to TW with the list of keywords that TextWrangler will recognize when your file extension is .px, .vs, or a few others. You can find it and installation instructions here: http://www.vectorlab.info/index.php?title=VSS_Language_Module_for_BBedit_%26_TextWrangler You will also want to turn the Compiler Mode preference on, so your script gets compiled each time it is run. Tools>Scripts>VS Compiler Mode Raymond
  22. No problem here, but I'm using 2009. I see nothing in your script that would trigger a problem in any version. How are you running your script? From a script palette? Please describe in greater detail. It may have something to do with your OS. Raymond
  23. Hi Charles, ???You can, if you indent your source code with tabs. First, replace all tabs with three option-space (NBS = non-breaking space) characters, select all and copy, then undo (to restore your tabs). You can then paste on the tech-board and your indents remain. If you indent with spaces, it will be a bit trickier. (It appears you indented some of your code this way, just not all of it. I used NBS characters in my pasted code above and in my paragraph indents here.) ???The only issue I have with using arrays, especially static arrays, is that the code is not general enough. It will fail at the 1001'st object (citing yours and Petri's examples.) This is easy to adjust for us programmer types, but there are a lot of people who cringe at thought of modifying a script. ???The use of dynamic arrays can get around the static array limit, but you have to count everything first then declare your array size, and even then you are limited to 32K elements, which should be enough for most everything, but it's still not bullet proof. ???The method I used does not have a well defined upper limit, but speed may be the limiting factor for it. Remove the italicized lines and it will run faster, but then the replaced objects will be on the bottom of the stacking order instead of on the top. This may or may not be an issue. Tagging everything with a record for reselection is another way to tackle this problem, but it's also cumbersome to write and debug. ???The best part of this thread is there are four examples (actually five with Pat's two posts) of the same idea that a beginning scripter can compare. Happy scripting, y'all. Raymond
  24. So, how long is easy-as-pie? My guess is 2+ hours. OK, this appeared easier that it was, but with a little bit of effort, you can have your cake ? I mean pie ? and eat it, too. I think Petri's suggestion of using an array would have been easier, but we hates arrayssss. Raymond Procedure ReplaceWithSymbol; {Replaces every selected object with the active symbol definition} {Displays a message if no symbol definition is active.} {November 17, 2008} {? 2008, Coviana, Inc - Pat Stanford pat@coviana.com} {Licensed under the GNU Lesser General Public License} {February 26, 2009} {modified to select all symbols of the type used in the replace} {February 27, 2009 - RJM} {Move new symbols to back, so they stay selected.} {Uses HCenter to place symbol at center of selected object.} {Optionally, move symbols to front, so they keep relative stacking order.} Const ???SQ = chr(39);??????{ Single Quote } Var ???H, Hfo : Handle; ???X1, Y1 : Real; ???S1 : String; ???Procedure ReplaceObject(H1:Handle); ???Begin ??????HCenter(H1, X1, Y1); ??????Symbol(S1, X1, Y1, 0); ??????HMoveBackward(LNewObj, True);????????????{ move to back instead of deselect } ??????DelObject(H1); ???End;??????{ ReplaceObject } Begin ???if (ActSymDef <> nil) then begin ??????Hfo := FActLayer;??????????????????????????????{ handle to first object on layer } ??????if Selected(Hfo) then Hfo := nil; ??????S1 := GetSDName(ActSymDef); ??????ForEachObject(ReplaceObject, SEL); ??????{ omit the following if stacking order is not important, } ??????{ otherwise this moves all new symbols to the front. } ??????if (FSActLayer <> nil) then begin????????????{ there were selected objects converted } ?????????if (Hfo = nil) then Hfo := NextDObj(FActLayer);???{ first deselected obj } ?????????if (Hfo = nil) then Hfo := LActLayer;??????{ top selected symbol } ?????????H := PrevObj(Hfo); ?????????while (H <> nil) do begin ????????????HMoveForward(H, True); ????????????H := PrevObj(Hfo); ?????????end;??????{ while } ??????end;??????{ if (FSActLayer <> nil) } ???end ???else Message('No Symbol Definition Selected.'); End; Run(ReplaceWithSymbol);
  25. Assembly, ???Have you tested that "hobject" has a non-NIL value after CreateCustomObjectN() is executed? Your code gets executed several times when it is first placed. The order of events is very cryptic, to say the least. Tracking down when things happen is almost fun. ???Next question; on the line before Reset() you have: ??????SetRField(hobject, objectname, 'framedepth', 'width'); Shouldn't WIDTH be unquoted, as it is in all the other SetRField statements? Raymond
×
×
  • Create New...