GVRT Posted September 3, 2017 Share Posted September 3, 2017 (edited) I’m using VW2017 with Spotlight and I use the ‘rotate left 90 degrees’ command as a keyboard shortcut a lot. I’d like symbols to automatically rotate around their insertion point but mine don’t when I’ve got a label legend applied to them. When the label legend is applied the symbol rotates around the centre point of the symbol and the legend combined instead. I've explored using a vectorscript to help here but haven't got enough knowledge to make it work. I've noticed when I insert a locus on top of the insertion point and highlight both the symbol and the locus, the symbol will rotate around the locus. Could a script: insert locus on insertion point, rotate left 90degs, delete locus? Many thanks in advance! Edited September 3, 2017 by GVRT Quote Link to comment
SamIWas Posted September 3, 2017 Share Posted September 3, 2017 I feel your pain. If you were scripting it, you wouldn't have to even go as far as adding the locus and whatnot. The script would simply get a handle to the object, get the coordinates of the object (which would be the insertion point), then use HRotate(90) to rotate the object 90˚ counter-clockwise about that point. PROCEDURE RotateObject; h : HANDLE; sx,sy : REAL; BEGIN; h:= FSActLayer; GetSymLoc(h,sx,sy); HRotate(h,sx,sy,90); END; Run(RotateObject); At one point, when keyboard commands actually worked reliably, i had mapped a version of this script with 5˚ increments to my scroll wheel, so I could select a fixture and rotate it using the scroll wheel. Quote Link to comment
GVRT Posted September 3, 2017 Author Share Posted September 3, 2017 Hi Sam, Thank you for this. I just tried running this script but it comes up with the errors shown in the attached image. Apologies I have no knowledge of scripting! Many thanks in advance for your help. Quote Link to comment
michaelk Posted September 3, 2017 Share Posted September 3, 2017 Sam I love that idea of using the scroll wheel to rotate by 5º!!! Might have to steal that. :-) GVRT Try this one. It's the same idea as Sam's, but it works when you have multiple instruments selected. Rotate Instruments.vwx Quote Link to comment
michaelk Posted September 3, 2017 Share Posted September 3, 2017 Sam's script is missing the statement VAR If you add VAR on its own line like this: PROCEDURE RotateObject; VAR h : HANDLE; sx,sy : REAL; BEGIN; h:= FSActLayer; GetSymLoc(h,sx,sy); HRotate(h,sx,sy,90); END; Run(RotateObject); that should make it work. Quote Link to comment
GVRT Posted September 3, 2017 Author Share Posted September 3, 2017 Thank you everyone. Both scripts work now. Michael, your one is brilliant for working on multiple symbols. I have no idea why rotating around the insertion point when label legends are applied isn't default in VW anyway! 1 Quote Link to comment
Gadzooks Posted September 4, 2017 Share Posted September 4, 2017 (edited) 18 hours ago, GVRT said: I have no idea why rotating around the insertion point when label legends are applied isn't default in VW anyway! Guys - I can't even get this to work in a simple manner. On reading this thread, I thought I would have a look for any answers to help @GVRTand came across the the following glitch (or feature?). To establish an insertion point for a simple symbol looks easy.... (Just to make clear - they were dashed lines before I did a screen capture ---------------------- Edit - I've just seen that should of course say leftmost part of the symbol (doh!!) ---------------------- Either this is.. My ineptitude - And someone will point this out to me. (gently does it!) Vectorworks problem - And this is a known issue.. Vectorworks new issue (can't believe this really, as someone else will have raised it and I haven't seen anything on this forum) I need new glasses. Sorry to jump on this thread BTW, but it seemed appropriate. Edited September 4, 2017 by Gadzooks Quote Link to comment
MullinRJ Posted September 4, 2017 Share Posted September 4, 2017 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 1 Quote Link to comment
Gadzooks Posted September 4, 2017 Share Posted September 4, 2017 Thanks - rookie mistake then. Or more likely I'll convince myself I was in too much of a rush. I believe (of my earlier options) it's the new glasses then. Thanks again. Quote Link to comment
Pat Stanford Posted September 4, 2017 Share Posted September 4, 2017 I amy be late to the party, but I posted a script in 2015 (originally in 2008 and 2010) that rotates Symbols and PIOs around their insertion point. Here is the 2015 post. Quote Link to comment
GVRT Posted September 4, 2017 Author Share Posted September 4, 2017 Thanks Pat, that is brilliant. I especially like that it can distinguish between symbols and other objects. Is it easy to make it rotate the objects by a set amount without the dialogue box? Many thanks Quote Link to comment
Pat Stanford Posted September 4, 2017 Share Posted September 4, 2017 Very easy to change. Change the line that reads R1:=RealDialog('Enter the amount to rotate each object by','90.0'); to something like R1:=45; make sure the line ends with a semicolon ( ; ) [No that is not a smiley face, just trying to show the character] ;-) [That one is a smiley face using a semicolon] 1 Quote Link to comment
GVRT Posted September 4, 2017 Author Share Posted September 4, 2017 Thanks again Pat. One more question and then I'll leave you alone! With the version I've just made that rotates 45degs, is it possible for the symbol to stay selected so I don't have to keep on re-selecting the symbol to rotate it multiple times? Many thanks Quote Link to comment
Pat Stanford Posted September 4, 2017 Share Posted September 4, 2017 I don't have time to test right now, but try deleting or commenting out (enclose the line in curly braces/parentheses {} ) the line that reads. SetDSelect(FSActLayer); That should leave all of the selected objects still selected. Pat Quote Link to comment
GVRT Posted September 4, 2017 Author Share Posted September 4, 2017 Thanks Pat, that works a treat The only thing your script still doesn't do, that Michael's does (who posted at the top of this thread) is rotating multiple symbols at once. Could that be incorporated into your super-script?! Michael's script quoted below: Quote Procedure InstrumentTurnLeft; {Badly scripted by Michael Klaers} {Select instrument(s). Run the script. All the instruments will keep their insertion points and rotate left 90º} VAR SymbolHandle : Handle; CurrentAngle, xLoc, yLoc : Real; PROCEDURE RotateIt(SymbolHandle:HANDLE); BEGIN GetSymLoc(SymbolHandle, xLoc, yLoc); CurrentAngle := HAngle(SymbolHandle); HRotate(SymbolHandle, xLoc, yLoc, 90); END; BEGIN ForEachObject (RotateIt,((SEL=TRUE))); END; RUN(InstrumentTurnLeft); Quote Link to comment
michaelk Posted September 4, 2017 Share Posted September 4, 2017 GVRT It's really funny that you're asking Pat if his script can do something mine does. He probably taught me how to do it. :-) In my script you can also change the amount of spin by changing the 90 in the line HRotate(SymbolHandle, xLoc, yLoc, 90); to whatever you want. Quote Link to comment
GVRT Posted September 4, 2017 Author Share Posted September 4, 2017 Ha - I'm unaware of hierarchy! The bit that's really clever about Pat's script is that it can tell between a symbol and an object that isn't a symbol. That's why I'm using his at the moment. However, as I said, Pat's doesn't work like yours when multiple symbols are highlighted. I'm aware this isn't just a script order factory so I very much appreciate your guy's help. Quote Link to comment
MullinRJ Posted September 4, 2017 Share Posted September 4, 2017 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 1 Quote Link to comment
michaelk Posted September 4, 2017 Share Posted September 4, 2017 Raymond's right. It sort of is a script factory. While there isn't a real hierarchy, in my mind there is a simple two layer hierarchy. I'm the sole occupant of the lower level :-). I've found that if you're looking for something simple like this, someone who really enjoys these kind of puzzles will often have already written it, written something close to it, or be able to blast it out quickly. And if you want to learn how to do it: Read the documentation, give it a shot, and then ask questions. Pat, Raymond, Josh, Sam, Sam J, Miguel, and many others have patiently explained the dark art to me. Scripting in VW can be powerful. I'm pretty bad at it and I saved hours of work just in the last couple days with simple scripts. In the case of your script it would be pretty easy to put the very clever logic test to check if the selected object is a plug in object or symbol into my script. I'd have to look more closely at Pat's script to see how to alter his. - I think it already does almost what you want. Dynamic arrays make my head hurt a little bit. Quote Link to comment
Pat Stanford Posted September 5, 2017 Share Posted September 5, 2017 3 hours ago, GVRT said: The only thing your script still doesn't do, that Michael's does (who posted at the top of this thread) is rotating multiple symbols at once. Could that be incorporated into your super-script?! Are you sure? The script was written to specifically rotate all selected object around their individual insertion points. When I run Michaels script, it seems to group the instruments together and then rotate the whole blob. With mine, the individual instruments stay in place just turn around that point. Raymond and Michael are correct. There are a few of us who are more than happy to work on scripts for kind of specialty tasks just for fun or to prove it can be done. Most of these are not going to be fancy. They are mostly one-trick ponies, and often a little ugly under the hood, but they serve as a kind of learning framework for those who need help understanding the guts of VW. My guess is I have probably posted 100+ scripts and snippets since 2008. I (and others) are usually more than happy to help you with a specific problem. Especially if you appear to be trying to help yourself rather than just looking for a handout. Some of the scripts we tend to do are to improve repetitive actions. Others are to expose things that are not easily accessible through the normal UI. It never hurts to ask. Many times one of us has already done something similar and can give you a solution fairly quickly. Or it just will tickle our fancy or that Pavlovian center in our brain and be something we just have to work on. Can Not Let The Computer Win! You are unlikely to get a huge project for free (if you want a new stair tool you are probably out of luck), but if you want to take on a huge project we will be more than happy to try and point you in the right direction. And if you happen to run into us at the Design Summit or some other event, I don't think any of us would turn down a beer ;-) 1 Quote Link to comment
MullinRJ Posted September 5, 2017 Share Posted September 5, 2017 Now it's official. You two are bound by Script-ure. ;-) 2 Quote Link to comment
GVRT Posted September 5, 2017 Author Share Posted September 5, 2017 Hi Pat, I'm using VW2017 and Michael's script rotates multiple symbols around their individual insertion points for me. Your script behaves very strangely with multiple symbols. Sometimes it only rotates one of the selected symbols, sometimes it rotates one of the selected symbols but by double the angle that's specified. I'm still using your script because it can distinguish between symbols and other objects. The multiple symbol selection would just be the icing on the cake! Thanks Quote Link to comment
michaelk Posted September 5, 2017 Share Posted September 5, 2017 Raymond, you crack me up. GVRT, attached is an updated version of my scripts with Pat's magic IF/THEN/ELSE statement added stolen to take care of non symbol, non plugin objects. Again, you can change the 90 degrees to whatever you want. Just like Pat said above, most of my scripts are not fancy. They have work to do and they aren't pretty. :-) Because I find writing dialog boxes to be slow going, I usually do something like duplicate this script and make versions that are 5º, 15º, 22.5º, 30º, 45º, 90º left and right. Put them in a script palette and call it good. Rotate Instruments update.vwx Quote Link to comment
GVRT Posted September 6, 2017 Author Share Posted September 6, 2017 Brilliant. yet again! Thank you Quote Link to comment
Vectorworks, Inc Employee Matt Panzer Posted September 7, 2017 Vectorworks, Inc Employee Share Posted September 7, 2017 On 9/5/2017 at 4:39 AM, MullinRJ said: Now it's official. You two are bound by Script-ure. ;-) LOL! Nice job Raymond! However, Mike looks a little pale... Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.