BIM Coordinator Program (INT) April 22, 2024

Find the next step in your career as a Graphisoft Certified BIM Coordinator!

GDL
About building parametric objects with GDL.

Object not appearing when first placed in plan

KB-at-CWA
Booster

Hi all,

 

I am fairly early on with my scripting in GDL life and am not sure what to do to fix this issue.

I have been trying to solve a documentation issue I have in my office where I want to eliminate separate 3D objects, symbols and splines for an electrical plan.

 

I have scripted an object that is an "X" symbol for a light switch that has a moveable hotspot, which draws a spline that you drag to a light on plan. It has a 3D block that is created at the same time and some options for different switch types.

 

It works very well, but when it is first placed in plan nothing appears until I zoom, or pan in the view. Please see the video attached. 

 

It was created in Archicad 25 and I am happy to share the script if it helps.

Graphisoft Certified Archicad BIM Manager - AC6 to AC25/AC26 macOS Ventura
9 REPLIES 9
MetalFingerz
Advocate

@KB-at-CWA , could you share the library part to troubleshoot it ?

Lingwisyer
Guru

If you .zip your object, you will then be able to attach it directly to your post. You could also PM it to someone to have a look if you would rather not freely share it.

AC22-23 AUS 7000Help Those Help You - Add a Signature
Self-taught, bend it till it breaksCreating a Thread
Win11 | i9 10850K | 64GB | RX6600 Win10 | R5 2600 | 16GB | GTX1660
KB-at-CWA
Booster

Hi @MetalFingerz @Lingwisyer 

 

sorry for the late reply, does the attachment work?

 

I scripted it in AC25 and am working on macOS Monterey

Graphisoft Certified Archicad BIM Manager - AC6 to AC25/AC26 macOS Ventura

The GPO object you attached works perfectly fine.

But that does not seem to be the object you described in the first post.

You will need to attach the 'X' symbol with spline object if you want an answer about that.

 

Barry.

One of the forum moderators.
Versions 6.5 to 27
Dell XPS- i7-6700 @ 3.4Ghz, 16GB ram, GeForce GTX 960 (2GB), Windows 10
Lenovo Thinkpad - i7-1270P 2.20 GHz, 32GB RAM, Nvidia T550, Windows 11

Sorry about that.

 

Please see attached the Light Switch symbol

Graphisoft Certified Archicad BIM Manager - AC6 to AC25/AC26 macOS Ventura

Thanks for that.

It seems to be because your 'offset side' & 'offset up' parameters are set to zero by default.

So it is trying to draw a spline that doesn't actually exist.

It doesn't seem to like that.

 

You could set default values for each (such as 100) and it will be happy.

Or if there are occasions where you don't want to see the spline, you could alter the script like this...

 

if lampOffsetX <> 0 and lampOffsetY <> 0 then
	SPLINE2A 3, 2,
	0,	0,	90,	0,	SQR (lampOffsetX/curvature*lampOffsetX/curvature +lampOffsetY/curvature*lampOffsetY/curvature),
	lampOffsetX/2,	lampOffsetY/2, 0,	0,	0,
	lampOffsetX,	lampOffsetY, 90,	SQR (lampOffsetX/curvature*lampOffsetX/curvature +lampOffsetY/curvature*lampOffsetY/curvature),	0
endif

 

Barry.

One of the forum moderators.
Versions 6.5 to 27
Dell XPS- i7-6700 @ 3.4Ghz, 16GB ram, GeForce GTX 960 (2GB), Windows 10
Lenovo Thinkpad - i7-1270P 2.20 GHz, 32GB RAM, Nvidia T550, Windows 11
Lingwisyer
Guru

I would put a minimum length modifier in the Parameter Script for it, then maybe have an IF statement to change the colour of the line if it is in it's default location. Help prevent switches to nowhere.

AC22-23 AUS 7000Help Those Help You - Add a Signature
Self-taught, bend it till it breaksCreating a Thread
Win11 | i9 10850K | 64GB | RX6600 Win10 | R5 2600 | 16GB | GTX1660

Hi Barry,

 

Sorry it has taken me so long to reply, life got away from me a bit there.

 

I tried the IF statement but when checking the script it returns with a warning that "Use of real types can result in precision problems" and the object still does not appear when first placed.

 

I have placed default values into the the parameters and it has resolved the issue. Thanks for your help.

Graphisoft Certified Archicad BIM Manager - AC6 to AC25/AC26 macOS Ventura

@KB-at-CWA wrote:

I tried the IF statement but when checking the script it returns with a warning that "Use of real types can result in precision problems" and the object still does not appear when first placed.


That should have worked.

I just tried again and it worked for me - object just places an "X" with no spline.

 

The warning I just ignore as it is just that, a warning.

Something to do with equating (or not equating in this case) values.

This will avoid the warning ... if ABS(lampOffsetX) > 0 and ABS(lampOffsetY) > 0 then

Barry

One of the forum moderators.
Versions 6.5 to 27
Dell XPS- i7-6700 @ 3.4Ghz, 16GB ram, GeForce GTX 960 (2GB), Windows 10
Lenovo Thinkpad - i7-1270P 2.20 GHz, 32GB RAM, Nvidia T550, Windows 11
Learn and get certified!

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!