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

controlling text rotation

Anonymous
Not applicable
I'm working on a duplex receptacle part that uses the object ID to add text to indicate mounting height and other information. I've got the ID request working, but I need to know how to do 2 things:

1. Change the rotation of the text so it reads from the bottom of the page when the object rotation is >0. I assume I can use ><= with a range if numbers in an IF/THEN, arrangement to add some rotation adjustment around the anchor point, but if anyone knows a better way, please let me know.

2. How to properly make use of the stw string function. My txt_adj isn't coming up with the proper amount - see the attached screenshot. Per the code:

Define Style txt "Arial", txt_sz, 5, 0
txt_adj=.5*STW(mkr_ID)/1000*A_

Pen txt_pen
ADD2 0, 12"+txt_adj !!!!12" moves the origin to the outside of the receptacle
Style txt
rot2 90
Text2 0, 0, mkr_id

Shouldn't 1/2 the stw put the origin of the text in the proper spot so that when the text is entered, the edge of the text reaches back to the 12" mark? It appears to be starting the text left justified as is I was using 4 instead of 5 for my anchor point.

If this email isn't clear, I'll try to explain further, but I hope its obvious what I'd like to accomplish. Any help would be appreciated!

Wes

Picture 1.jpg
10 REPLIES 10
TomWaltz
Participant
I think you might be happier overall if you include a graphic hotspot instead of the STW offset thing. That would let you move the text on an individual basis (like it the text over-ran a wall or another outliet).
Tom Waltz
Anonymous
Not applicable
yeah, I agree - but I have yet to be able to get a graphical hotspot to work, even following the GDL manual. I'll try grabbing code from another part, perhaps.

Wouldn't I still want to get the text in the right spot (using gdl) to begin with? I'm trying to reduce the work people have to do - if they have to enter text and then drag it around everytime, they might as well just use an actual text element. I agree that having it movable is good so one could account for oddities in the plan - it just has to start in the "right" place by default.
Frank Beister
Moderator
Without testing it, but the DEFINE defines the style. The STYLE sets the style. If you want to measure the text, you have to set the style before!

DEFINE Style txt "Arial", txt_sz, 5, 0
SEt STYLE txt
txt_adj=.5*STW(mkr_ID)/1000*A_

Pen txt_pen
ADD2 0, 12"+txt_adj !!!!12" moves the origin to the outside of the receptacle
rot2 90
Text2 0, 0, mkr_id
bim author since 1994 | bim manager since 2018 | author of selfGDL.de | openGDL | skewed archicad user hall of fame | author of bim-all-doors.gsm
TomWaltz
Participant
Weston wrote:
yeah, I agree - but I have yet to be able to get a graphical hotspot to work, even following the GDL manual. I'll try grabbing code from another part, perhaps.

Wouldn't I still want to get the text in the right spot (using gdl) to begin with? I'm trying to reduce the work people have to do - if they have to enter text and then drag it around everytime, they might as well just use an actual text element. I agree that having it movable is good so one could account for oddities in the plan - it just has to start in the "right" place by default.
Try this:
	HOTSPOT2		txtA, 0, 		4, txtB, 1+128
	HOTSPOT2		txtA, -1, 		5, txtB, 3
	HOTSPOT2		txtA, txtB, 	6, txtB, 2
	
	HOTSPOT2		0, txtB, 		7, txtA, 1+128
	HOTSPOT2		-1, txtB, 		8, txtA, 3
	HOTSPOT2		txtA, txtB,		9, txtA, 2	

	TEXT2		txtA, txtB, subText
I am the Hotspot King... I have graphic hotspots in so many places my staff complains about anything that does not have them....
Tom Waltz
Anonymous
Not applicable
F. wrote:
Without testing it, but the DEFINE defines the style. The STYLE sets the style. If you want to measure the text, you have to set the style before!
DUH... Thanks, FB.

Now I can try to tackle the rotation and the graphical hotspot.
Anonymous
Not applicable
TomWaltz wrote:
Try this:
	HOTSPOT2		txtA, 0, 		4, txtB, 1+128
	HOTSPOT2		txtA, -1, 		5, txtB, 3
	HOTSPOT2		txtA, txtB, 	6, txtB, 2
	
	HOTSPOT2		0, txtB, 		7, txtA, 1+128
	HOTSPOT2		-1, txtB, 		8, txtA, 3
	HOTSPOT2		txtA, txtB,		9, txtA, 2	

	TEXT2		txtA, txtB, subText
so how does this work? check script gives me "txtA isn't a valid parameter name". Do I have to define those variables somewhere first?
Frank Beister
Moderator
They have to be part of the parameter list. They are the coordinates of the text.
DEFINE Style txt "Arial", txt_sz, 5, 0
SET STYLE txt
txt_adj=.5*STW(mkr_ID)/1000*A_

Pen txt_pen
ADD2 0, 12"+txt_adj !!!!12" moves the origin to the outside of the receptacle
rot2 90

! Y-direction
HOTSPOT2 txtA, 0,       4, txtB, 1+128
HOTSPOT2 txtA, -1,       5, txtB, 3
HOTSPOT2 txtA, txtB,    6, txtB, 2
 
! X-direction
HOTSPOT2 0, txtB,       7, txtA, 1+128
HOTSPOT2 -1, txtB,       8, txtA, 3
HOTSPOT2 txtA, txtB,      9, txtA, 2   

TEXT2 txtA, txtB, mkr_id
This should work and give you a hint.
bim author since 1994 | bim manager since 2018 | author of selfGDL.de | openGDL | skewed archicad user hall of fame | author of bim-all-doors.gsm
Anonymous
Not applicable
OK! made some progress!

I have the part working with fixed text from the proper origin, or with the movable hotspot starting at 0,0, but I can't get the code above to move the default origin and then let the user modify the hotspot. The spot is green as if the program would let me move it, but the pet pallette does not give me the option.

Any thoughts? Thanks for the help so far!

Wes
Frank Beister
Moderator
Can you post or mail your actual code?
bim author since 1994 | bim manager since 2018 | author of selfGDL.de | openGDL | skewed archicad user hall of fame | author of bim-all-doors.gsm