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.

Request distance from camera / Object visibility in view

Davor P
Booster

Can I do this in GDL? I am interested in using the first to control LOD depending on how close an object is to the camera.

Ideally I would like to control via macro in MVO at what distances objects should drop to simplified, schematic and box or even not show at all.

With the other one it might be possible to switch off 3D for objects that are not in an immediate view - for example my view is of kitchen and bathroom items are not in view so their 3D script can be skipped.
.
I am guessing if either of these did work it wouldn't be live but only update on regenerate?

Edit: Sorry for posting in C++ API. I could have sworn I was in the GDL section... no way to move the post.

 

EDIT - it has been moved - Moderator.

BIM4BIM - by BIM managers for BIM managers
2 REPLIES 2
Joachim Suehlo
Advisor

GLOB_EYEPOS_X,

GLOB_EYEPOS_Y,

GLOB_EYEPOS_Z

only usable in 2D and 3D Script

Joachim Suehlo . AC12-27 . MAC OSX 13.5 . WIN11
GDL object creation: b-prisma.de

Hi.

 

I copied this explanation fr DNC's GDL cookbook4 , as a reference :

 

The GDL Cookbook 4
!Location Awareness Routine
!with camera global variables
!using the old letter system.
dkx=K~ - X~:IF dkx=0 THEN dkx=0.001
dly=L~ - Y~
dmz=M~ - Z~
dr =SQR(dkx^2 + dly^2) !Plan distance
dd =SQR(dkx^2 +dly^2 +dmz^2)!Distance
azi=ATN(dly/dkx) !Azimuth
IF facecam THEN ROTz 90+azi-W~
When does it not work?
If there is no camera, e.g. in an axonometric or an
elevation, you need a ‘get-out-clause’ to set a false distance
from the camera. This is to avoid a ‘divide by
zero’ error when calculating the azimuth. Thus the
variable dkx is given a tiny value of 1 mm.
The routine works with Sun Studies and Flythoughs.
Doors and Windows can open during an animation,
but must do so based on frame number. They do not
work correctly with ‘location awareness’ because they
subordinate themselves to the wall they are attached
to and you cannot write the routine for the wall.

This location awareness routine can be used again –
keep it in your Scrapbook. I have done a model where
EVERY GDL component was location aware to keep
the rendering workload under control. If the model is
a mile or more in size, you can completely hide objects
too distant to be worth drawing.
Rebuild each Frame
This routine will work for still views with different camera
distances (after a ‘Rebuild’). To ensure that this
works during a movie flythrough, you need a REBUILD
EACH FRAME to happen during animation. This can
be enabled in the dialog box just prior to starting a
Flythrough.

 
The Eye positions K~, L~, & M~ can also be called
GLOB_EYEPOS_X, Y & Z, and the Object positions X~,
Y~ & Z~ can be called SYMB_POS_X, Y & Z. The
adjustment to dkx avoids a divide by zero error. If azimuth
is critical there is more to it than this, but this routine is good
enough for trees and people.

Apple M1 Pro CPU
RAM 32 GB
1 TB OS: Ventura 13.1
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!