Jump to content
Developer Wiki and Function Reference Links Read more... ×
Sign in to follow this  
theob

Vectorscript - Keeping Text Horizontal in Symbols

Recommended Posts

I was wondering, first, if it is possible to write vectorscript that would keep all text within a symbol horizontal, regardless of how the actual symbol is placed, and second, if this would be difficult script to write. I know virtually nothing about vectorscript, but now might finally be the time to wade in.

Thanks in advance.

Share this post


Link to post

It is certainly possible to create an object in VS that can be rotated and will keep all of the text horizontal, but it will probably be a Plug-in object (PIO) rather than a symbol.

If you need this for many different types of things, you could probably use a symbols geometry to serve as the basis of the PIO, but there is only one symbol definition. If you rotate an instance of the symbol, all parts rotate. If you edit the definition so the text in one instance is horizontal, then it will change the settings in all the other parts.

What kind of "symbol" are you talking about and how many different "symbol" geometries are there?

Share this post


Link to post

I see. In my case it is actually text within a symbol, which is within another symbol. Since we use window pios nested within symbols, we haven't been entirely happy with the current id tag (it doesn't seem to update when data for the window symbol changes, you have to place them manually for each window, etc). Hence, we've resorted to applying a custom data record to a custom symbol we use to id the window symbols, and we place those identifiers with the window pio inside of a symbol. Therefore, a symbol within a symbol.

This quickly populates the drawing with the appropriate tags for the appropriate window symbols, but the text becomes vertical when the window symbol is placed in a wall running page North to page South.

Here's an example:

Picture1.png

If there's another way to accomplish what we are trying to do, I would certainly be open to it. However, I've spent the past few days trying to sort out a quick and easy way to do windows with ids, create and schedule, while maintaining a good dynamic between the schedule, id and window so if data changes in one place it is reflected everywhere else at the same time. This seems like best solution thus far.

Thanks for the input.

Share this post


Link to post

If you can convert your id tags to a PIO, then you should be able to continue working pretty much like you are, but it will be harder to modify the graphics.

I think the real answer lies in another thread.

If we came up with a way for you to edit the record attached to a symbol definition and then apply that data to every (or selected) instantances of the symbol, then you would not need to use your custom record and could use the built in id tags.

Probably a much easier script to write. I was going to point you to the other thread, but it looks like you started that one also.

Share this post


Link to post

I assume, however, that placing a pio within a symbol will fix the text at the orientation it is given? One of the benefits of placing the tag for the window within the same symbol that contains the window pio is that it saves a bunch of time tagging all of the windows in the drawing (there are a lot in the current drawing I am working on). I believe the ID pios have the same text problem when placed in symbols.

The biggest problem I had with the ID symbol pio is that it didn't seem to automatically update its label when I updated the data record for the window symbol it was identifying. That was the biggest show-stopper for me. Did I set up the custom ID symbol incorrectly? I believe I added all of the pertinent data in the Tag Schema in the ID symbols file, directing the id to use a certain field of the symbol it is identifying through the 'TagSpec' and 'TagText' fields in the data record, but regardless of what I tried, the ID label would initially pick up the correct ID that I had specified for the window, but would not update that ID if I changed the data. That kind of defeats the purpose for me.

Share this post


Link to post

The PIO would have to be written to take into account the rotation of both itself and the "parent" object (the symbol). This should be possible. I don't know if the standard PIOs handle this correctly or not.

I think you may have been using the ID object wrong as it changes here for me with no problem

When I insert a window (not a symbol, but a window object), and the select the ID tool and click where I want the ID to be places and then click on the window, the ID is linked to the window and automatically updates when you make a change in the OIP for the window.

I have not used the ID tool to link it to a custom record, so I can't comment on that part.

Share this post


Link to post

The standard PIOs don't rotate the text appropriately when nested in symbols. However, I did notice that the "Adjust Flipped Text" setting in the vectorworks preferences does affect all of the text in the document, but it does not place all of the text horizontally. It appears to place it horizontally and in one direction vertically. If only I could get access to that script to modify it! That might do the trick.

I think i figured out my problem with the id symbol not auto-updated. I specified the "TagSpec" field in the Tag Schema Record as the field I wanted it to point to as opposed to leaving it named "ID". I think that might solve the problem.

Share this post


Link to post

The text can be kept the horizontal by the way below.

objAng:= GetSymRot(objHdl);

HRotate(textHdl, txtCntrX, txtCntr, -objAng);

Share this post


Link to post

sorry, I made a mistake.

objAng:= GetSymRot(objHdl);

HRotate(textHdl, txtCntrX, txtCntrY, -objAng);

Share this post


Link to post

If there are multiple instances of one symbol definition, would this script work at keeping all of the text horizontal?

How would you target the text handle to the text of one symbol instance, and not the entire definition? Is that possible?

Share this post


Link to post

This is my first attempt to rotate the text within the many symbol instances of the same definition so that the text appears horizontal universally, but I realize that if the vectorscript works at all, it is trying to rotate the text within the original symbol and in that symbol it is probably aligned properly anyway.

additionally, in my drawing the id symbol for the window is a symbol within a symbol, and I realize that I did not address that in the vectorscript as well.

Any feedback would be very helpful. Thanks!

PROCEDURE RotateSymbolText;

VAR

textHdl : Handle;

objHdl : Handle;

textIsMirrored :Boolean;

textOriginX, textOriginY, textAng, objAng :Real;

BEGIN

objHdl := FActLayer;

while (objHdl <> nil) do

begin

if (GetType(objHdl)=15) then

begin

textHdl := FInSymDef (objHdl);

if (GetType(textHdl)=10) then

begin

GetTextOrientation(textHdl, textOriginX, textOriginY, textAng, textIsMirrored);

objAng:= GetSymRot(objHdl);

HRotate(textHdl, textOriginX, textOriginY, -objAng);

end;

textHdl := NextObj(textHdl);

end;

objHdl := NextObj(objHdl);

end;

SysBeep;

END;

Run(RotateSymbolText);

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

 

7150 Riverwood Drive, Columbia, Maryland 21046, USA   |   Contact Us:   410-290-5114

 

© 2018 Vectorworks, Inc. All Rights Reserved. Vectorworks, Inc. is part of the Nemetschek Group.

×