License Delivery maintenance is expected to occur on Saturday, November 30, between 8 AM and 11 AM CET. This may cause a short 3-hours outage in which license-related tasks: license key upload, download, update, SSA validation, access to the license pool and Graphisoft ID authentication may not function properly. We apologize for any inconvenience.
Libraries & objects
About Archicad and BIMcloud libraries, their management and migration, objects and other library parts, etc.

Elect symbol, locatable 2d text makes symbol flip

Anonymous
Not applicable
So here is my challenge for the day:

I have made a basic electrical symbol that shows in 2d and 3d(don't you want your to see your coverplates in elevation?). Now I have tried to get a piece of text to show up next to the symbol and always stay horizontal regardless of symbol rotation(rot2 -SYMB_ROTANGLE). Additionally, I need to be able to locate the text with a mouseclick(hotspot a, b) because one always needs to shuffle things around.


The problem is that when I move the text into one of the negative quadrants, it flips out, literally: The object jumps to a new location that I don't want nor comprehend. Also, when I rotate the object too much(or is it not enough) the text also misbehaves.

I realize the work-a-round is to give the text location separate parameter values, but then the user needs to open the part. Not as elegant.


I'm open to suggestions corrections.

-Nathan
2 REPLIES 2
Anonymous
Not applicable
Controlling the text angle through rotation and mirroring can be very tricky, and can only be tested in plan view since the dialog editor only shows the full view straight up.

Your situation doesn't sound too difficult though. You just need to account for the mirroring of the part. Stretching the a,b coordinate into negative quadrants will mirror, rotate 180°, or both depending on which quadrant it is.

The code to do this is really quite simple, as follows:

symbol_angle = SYMB_ROTANGLE
IF SYMB_MIRRORED = 1 THEN symbol_angle = -SYMB_ROTANGLE

rot2 -symbol_angle
TEXT2 0, 0, "Your text here"


This will keep your text always straight up. It gets more complex for parts like an align marker whose text needs to rotate but not turn upside down.

It is usually best to set the text anchor (in the DEFINE STYLE statement) to the center (a value of 5), though this may vary in some cases. (And don't forget the SET STYLE statement.)

If you still have problems you have probably made the symbol too complicated.

The way I usually test this sort of code is to rotate a bunch of copies in a big circle and then mirror a copy of the whole lot. Any rotational errors will show up as long as you have enough copies (16 in each circle seems to be enough for most conditions).

HTH
Anonymous
Not applicable
Matthew,

Thanks for the help. You're right about the centered text, makes the part much better, and that little bit of script got the thing behaving. I made the mistake of having the symbol located below the x axis, so having fixed it, I think I have most of a gem of a library part.

Maybe I'll post it in its final version....