cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 
Archicad C++ API
About Archicad add-on development using the C++ API.

2D drawing overlay in 3D view

BrunoValads
Booster

Hi! I need to figure out a way to make 2D drawings in the 3D view, in a way that the drawings are always facing the camera, preferably while rotating the camera too. My intention is to draw pins where the user clicked in the model. Here’s a mockup of what I mean:

 

BrunoValads_0-1757938911997.png


Is it possible to do this in the current state of the API?

2 REPLIES 2

Hi Bruno,

 

The only thing I know of which comes close is the Notification Bubble introduced with AC29.

Not sure if you can do it without a timeout though to always show it and also updating it to camera rotation might be tricky.

 

I don't know of any other functionality to achieve this directly with only the Archicad API. You can get the clicked point though in screen coordinates of the 3D window like it's done in the notification bubble example. Then you could send this to an external program (written by yourself or maybe there are solutions available) to draw a pin there. It's for sure an experiment, but I assume it's possible.

 

Hope that helps,

Bernd

Automating Archicad with Add-Ons, GDL-Objects & Python Archi-XT.com
Akos Somorjai
Graphisoft
Graphisoft

Hi Bruno,

 

You can also approach this billboard-like behaviour from the GDL side. You can find below a sample GDL script that turns a picture towards the perspective camera.

Best, Akos

 

dx= GLOB_EYEPOS_X - GLOB_TARGPOS_X
dy= GLOB_EYEPOS_Y - GLOB_TARGPOS_Y

rotx 90

if SYMB_MIRRORED then
  roty SYMB_ROTANGLE
else
  roty -SYMB_ROTANGLE
endif

if abs(GLOB_EYEPOS_X-GLOB_TARGPOS_X)<EPS then
  if GLOB_EYEPOS_Y>GLOB_TARGPOS_Y then roty 180
else
  alf=atn(abs(dy/dx))

  if SYMB_MIRRORED then
    if dx<0 and dy>0 then roty -(180-alf)
    if dx<0 and dy<0 then roty -(180+alf)
    if dx>0 and dy<0 then roty -(-alf)
    if dx>0 and dy>0 then roty -(alf)
  else
    if dx<0 and dy>0 then roty (180-alf)
    if dx<0 and dy<0 then roty (180+alf)
    if dx>0 and dy<0 then roty (-alf)
    if dx>0 and dy>0 then roty (alf)
  endif
  roty 90
endif

addx -ZZYZX/2*pictWidth/pictHeight
picture "picture", ZZYZX*pictWidth/pictHeight, ZZYZX, 1
del top