Jump to content

Rotating a symbol around it's insertion point


GVRT

Recommended Posts

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 by GVRT
Link to comment

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.  

Link to comment
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....

 

59ad1dcdbda5a_SymbolInsertion.png.062aafdf23ce9665a5d517fe6f95f5fc.png

 

(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.B|

 

 

Sorry to jump on this thread BTW, but it seemed appropriate.

Edited by Gadzooks
Link to comment

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

Link to comment

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);

 

Link to comment

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.

 


 

Link to comment

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.

Link to comment

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

  • Like 1
Link to comment

:D:D:D:D:D

 

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.  :P

Link to comment
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 ;-)

  • Like 1
Link to comment

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 :)

 

 

Link to comment

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

Link to comment

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...