BIM Coordinator Program (INT) April 22, 2024
Find the next step in your career as a Graphisoft Certified BIM Coordinator!
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 Olivier,
I looked at the code for "Stretchy Line.gsm". Impressive !!.
I see that you had to go through quite a bit
to avoid using the trigonometry functions
arcsin, arccos, and arctangent all of which
involve ratios and thus the possibility of divide by zero errors.
Recently, I had been wondering about ways to avoid these
trig functions in GDL code and you have shown me one
approach, possibly the only one, for doing this.
Thank you !
Peter Devlin
Anonymous
Not applicable
Hi Peter,

I don't know any method. I would say observation, some logic, + trial and error.
Just divide the circle in four quadrants, and see what happens. Then take the conclusions.

Once it is done, you can re-use these statements again and again in other scripts, macros, etc... It is basic trigonometry.
Nothing special, I only use sin, cos, tan & atn functions, that's all.

The point is to avoid the divide by zero error, trigo or not, as you pointed.
Anonymous
Not applicable
Hello Olivier,
Looking at your code in the master script I see you do use
the atn() function but you have very cleverly written conditional
statements that prevent the denominator from ever being zero.
I see how you have used dividing the circle into four quadrants
to define the angle where x becomes zero without using the
atn() function for these special cases. I say again, very clever.
If you don't mind Olivier, I would like to steal your code and
use it in my scripts.
Thanks again,
Peter
Anonymous
Not applicable
Peter,

No need to ask, once it is posted, it's free.
Thanks anyway.
vistasp
Advisor
Olivier wrote:
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 ...
I'd visited the developer docs when I was a total newbie and, at the time, hastily clicked the back button. Usually, there's no time for developing anything, but a relative slow-down in work has suddenly made this section very interesting indeed.

Thank you for reminding me of it. I've been looking at selfGDL a lot these days as well - have to use babelfish a lot of course. 😉
= 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
Olivier, I've taken the stretchy line you created and added some functionality to it.

Mainly the object can now:

1. write levels at the start and end points of line. This text also slides along the line.

2. dynamically calculate the end point's level based on a given slope. Optionally, the end point level can be manually written.

Comments and suggestions are welcome.

Here's a screenshot:
= 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
And here's the object.
= 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 |
Djordje
Ace
vistasp wrote:
And here's the object.
To the Depository, please!
Djordje



ArchiCAD since 4.55 ... 1995
HP Omen
vistasp
Advisor
Djordje wrote:
To the Depository, please!
Was waiting for bug reports but, since I haven't heard from anyone, the object now resides in the depository.

EDIT: 28.11.2008

A couple of errors were found by Olivier. These have been fixed. If anyone has downloaded the original object, please do so again. Sorry!
= 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 |
Learn and get certified!