Libraries & objects
About Archicad and BIMcloud libraries, their management and migration, objects and other library parts, etc.

GDL prob with text anchor pt rot and maintain text orient

Erika Epstein
Booster
I am adding some graphical hotspots to some 2D symbols so I can move the text when necessary. I also have 3 options for text orientation horizontal, vertical, and 'smart' (rotates w/sym but mirrors so not seem upside down).

When I have the text orientation options the anchor point of the text no longer is the same as the graphical hotspots. I tried many ADD2 and ROT2 options for the text location textx and texty with no acceptable results.Can someone point me in the right direction?

! graphical hotspots seripting
!!!!!Text ----------------------------------------
PEN txtpen
IF tr=1 THEN !HORIZONTAL TEXT
ROT2 -symb_rotangle
ENDIF

IF tr=2 THEN ! VERTICLE TEXT
ROT2 -symb_rotangle+90
ENDIF

IF tr=3 THEN !SMART ORIENTATION
mul2 1-2*symb_mirrored,1
IF symb_rotangle>90 AND symb_rotangle<270 THEN
ROT2 180
ELSE
ROT2 0
ENDIF
ENDIF


DEFINE STYLE "symtextstyle" font, 1/(2.83464567)*fontsz, txtanchor, txtFaceCode
SET STYLE "symtextstyle"
TEXT2 textx,texty , switch_text
DEL 1
Erika
Architect, Consultant
MacBook Pro Retina, 15-inch Yosemite 2.8 GHz Intel Core i7 16 GB 1600 MHz DDR3
Mac OSX 10.11.1
AC5-18
Onuma System

"Implementing Successful Building Information Modeling"
29 REPLIES 29
Anonymous
Not applicable
Hi Erika,

My first impression is that you miss to DEL the MUL transformation...

Try:

ROT2 -sgn (1 - 2 * symb_mirrored) * (symb_rotangle * (tr >= 1) - 90 * (tr = 2))

DEFINE STYLE "symtextstyle" font, 1/(2.83464567)*fontsz, txtanchor, txtFaceCode
SET STYLE "symtextstyle"

TEXT2 textx,texty , switch_text

DEL 1
HTH

edit: I did a little modification on the transformation... it seems to work now.

...and I have a question... Why a 3rd status "Smart"?... Shouldn't they all be smart?...
Erika Epstein
Booster
Hi Paulo,
I tried your code, but it isn't giving me the results I am hoping for. When we are working in AC often we place for example a light switch symbol and mirror and rotate copies of the symbol as we go about placing them. My test is to place a symple in the plan and then rotate 15 copies and then mirror this wheel of symbols to see what happens.

I am attaching two screenshots to show. When I select one of the nonvertical switches, I notice the anchor point of the text no longer matches the graphical hotspot. Moving the graphical hotspot to move the text is now bizarre. It is difficult to accurately move the actual text.
The text keeps being placed relative to the base of the switch.


As to the three text orientations, I work with a number of firms. While I use the 'smart' option, some firms have strict rules about all texts being vertical or horizontal relative to the screen. I added this drop down choices for them and also as an exercise for me with value lists .
rotated symbol.jpg
Erika
Architect, Consultant
MacBook Pro Retina, 15-inch Yosemite 2.8 GHz Intel Core i7 16 GB 1600 MHz DDR3
Mac OSX 10.11.1
AC5-18
Onuma System

"Implementing Successful Building Information Modeling"
Erika Epstein
Booster
Hi Paulo,
I tried your code, but it isn't giving me the results I am hoping for. When we are working in AC often we place for example a light switch symbol and mirror and rotate copies of the symbol as we go about placing them. My test is to place a symple in the plan and then rotate 15 copies and then mirror this wheel of symbols to see what happens.

I am attaching two screenshots to show. When I select one of the nonvertical switches, I notice the anchor point of the text no longer matches the graphical hotspot. Moving the graphical hotspot to move the text is now bizarre. It is difficult to accurately move the actual text.
The text keeps being placed relative to the base of the switch.


As to the three text orientations, I work with a number of firms. While I use the 'smart' option, some firms have strict rules about all texts being vertical or horizontal relative to the screen. I added this drop down choices for them and also as an exercise for me with value lists .
Erika
Architect, Consultant
MacBook Pro Retina, 15-inch Yosemite 2.8 GHz Intel Core i7 16 GB 1600 MHz DDR3
Mac OSX 10.11.1
AC5-18
Onuma System

"Implementing Successful Building Information Modeling"
Anonymous
Not applicable
Hello,

I would suggest to keep the anchor point in the middle and doing
...all the moving first
...then text rotation
...and lastly place the text at point 0, 0

Hope this helps, works nicely with my little projects.

--
Regards, Juha
Erika Epstein
Booster
Juha,
You jumped ahead to the anchor point problem. Some symbols have two lines of text. How do you keep them from running into one another when the scale changes? Or when someone changes the font size?


thanks!
Erika
Architect, Consultant
MacBook Pro Retina, 15-inch Yosemite 2.8 GHz Intel Core i7 16 GB 1600 MHz DDR3
Mac OSX 10.11.1
AC5-18
Onuma System

"Implementing Successful Building Information Modeling"
Anonymous
Not applicable
Hello,

Could be arranged by using anchor point 5 with the
one line text. If there are two lines then the upper
has anchor point 8 and the lower line has 2.

The textblock command is a powerful solution if the
number of the lines is not known ie. the text is long
and the user is allowed to adjust the text field width.
You can request a textblock's dimensions before placing it
so centering it is not a problem.

Might be an overkill solution if only a couple of words and
lines are used.


--
Best regards, Juha
Anonymous
Not applicable
"Erika Epstein" but it isn't giving me the results I am hoping for.[/quote wrote:


Sorry Erika... I didn't test the script...

Here is a screen shot of an object which I have created based on your script... It seems to be ok on your "crash test"...
Anonymous
Not applicable
And here is the object...

HTH
Erika Epstein
Booster
Thank you Paulo!
Erika
Architect, Consultant
MacBook Pro Retina, 15-inch Yosemite 2.8 GHz Intel Core i7 16 GB 1600 MHz DDR3
Mac OSX 10.11.1
AC5-18
Onuma System

"Implementing Successful Building Information Modeling"

Didn't find the answer?

Check other topics in this Forum

Back to Forum

Read the latest accepted solutions!

Accepted Solutions

Start a new conversation!