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

couple of problems with a 2d object

vistasp
Advisor
I hope someone can point out what I'm doing wrong. In this object (I want to use it for drainage layouts on site plans) I've been able to make the line itself stretchy. There's also a nice little part that uprights the text automatically

Two things aren't working despite my best efforts:

1. Despite a moving hotspot, the text stubbornly refuses to budge!

2. At 90° & 270° the object reduces itself to a little green point. I presume this has something to do with the fact that Cos 90 & 270 are both zero but all the IF-THEN statements that I tried didn't seem to make the slightest difference to this vanishing act.

TIA
= v i s t a s p =
bT Square Peg
https://archicadstuff.blogspot.com
https://www.btsquarepeg.com
| AC 9-27 INT | Win11 | Ryzen 5700 | 32 GB | RTX 3050 |
18 REPLIES 18
Anonymous
Not applicable
Hello Vistasp,
On the mater of the green dot, you have of course, a divide by zero error
at line angle 90° and 270° because you have defined lin_ang=ATN(ver/hor)
The fix for this, I think, is just before the lin_ang definition put

eps=0.00000001

if hor<eps and hor>-eps then hor=eps

Granted, this introduces a small error in the geometry which
you may not be able to tolerate.

I am still trying to figure out the stubborn text moving hotspot.
It's not that it doesn't move but it's spring loaded
If I get anywhere with this I will post back.
Peter Devlin
Anonymous
Not applicable
Hello Vistasp,
Well, I suspected that defining the variable "thor" was causing
the spring loaded effect. If you comment out the three IF statements
that define "thor" then you can slide the text as you want to.
This of course disables the placement of the text to the left, right, or center.
I am not sure you can have it both ways.
Peter Devlin
Anonymous
Not applicable
Hello,

Just adding and choosing fourth option makes it possible to have both ways.

VALUES "halign" "left", "centre", "right", "free"


--
Regards, Juha
vistasp
Advisor
Peter wrote:
On the mater of the green dot, you have of course, a divide by zero error
at line angle 90° and 270° because you have defined lin_ang=ATN(ver/hor)
The fix for this, I think, is just before the lin_ang definition put
Thanks Peter. I'll try those IF-THENs before the lin_ang definition and see if they work. If it still fails, I guess I'll have to live with a tiny inaccuracy.

Alternatively, as and when I need it at that angle, I can rotate the object instead of stretching it. Still, just wanted to idiot-proof it...
= v i s t a s p =
bT Square Peg
https://archicadstuff.blogspot.com
https://www.btsquarepeg.com
| AC 9-27 INT | Win11 | Ryzen 5700 | 32 GB | RTX 3050 |
vistasp
Advisor
Peter wrote:
Well, I suspected that defining the variable "thor" was causing the spring loaded effect. If you comment out the three IF statements
that define "thor" then you can slide the text as you want to. This of course disables the placement of the text to the left, right, or centre.
I am not sure you can have it both ways.
Peter, in an earlier version (!) of this object, there was no left/centre/right option. I intended the text to be placed halfway along the line and manually move it where suitable. However, since the value of "thor" was derived (as it is even now), the text sprang back as you pointed out.

When the value of "thor" is given directly in the parameters, it slides perfectly. A calculated value, for some reason, doesn't work.
= v i s t a s p =
bT Square Peg
https://archicadstuff.blogspot.com
https://www.btsquarepeg.com
| AC 9-27 INT | Win11 | Ryzen 5700 | 32 GB | RTX 3050 |
vistasp
Advisor
Juha wrote:
Just adding and choosing fourth option makes it possible to have both ways.

VALUES "halign" "left", "centre", "right", "free"
That's a good idea Juha. I'll add that option and show the parameter "thor" for manual value input.

Will post back if successful.
= v i s t a s p =
bT Square Peg
https://archicadstuff.blogspot.com
https://www.btsquarepeg.com
| AC 9-27 INT | Win11 | Ryzen 5700 | 32 GB | RTX 3050 |
Anonymous
Not applicable
Hi Vistap,

You have to define a couple of hotspots (x, y) for both extremities of your line,
and write some statements to avoid trigonometry errors.

Attached an object similar to yours.
It is metric, you will have to make somme changes for imperial units.
vistasp
Advisor
Nice one Olvier! If I had your object before I started, I wouldn't have started at all. 😉

On the other hand, I wouldn't have learned anything either. Except this:
	if req ("GDL_version") > 1.5 then    ! AC 10
		dim fontnames[]
		rrr = request ("FONTNAMES_LIST", "", fontnames)
		values "fontType" fontnames, custom
	else
		values "fontType" 'Arial', 'Verdana', 'Helvetica', 'Geneva', 'Times', 'Georgia', 'Courier', custom
	endif
I didn't know the option to list all system fonts existed although I'd always wished for it. Thank you for this as well as your stretchy line. I'm not going to change the units - here in India, we are "bi-lingual" when it comes to units.

We need some kind of "tip of the week" to make us less experienced chaps aware of great stuff like this. Something like "Hot Tip Harry" does for the AutoCad world.
= v i s t a s p =
bT Square Peg
https://archicadstuff.blogspot.com
https://www.btsquarepeg.com
| AC 9-27 INT | Win11 | Ryzen 5700 | 32 GB | RTX 3050 |
Anonymous
Not applicable
Glad if this can help.
May be you already know the GDL Technical Standards.
This is a valuable source of information. Added to the GDL Reference Guide, almost everything is there,
(except the new status code 128 for TUBE) 😉. Please, GS ...