cancel
Showing results for 
Search instead for 
Did you mean: 
EN
cancel
Showing results for 
Search instead for 
Did you mean: 
BrunoValads
Booster

2D drawing overlay in 3D view

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?

1 Solution

Accepted Solutions
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

Go to post

5 Replies 5

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
BrunoValads
Booster

Interesting solution! Perhaps I could force a practical permanence by setting a large timeout (with Uint32 miliseconds I could set it to last 42 years hahahha), and maybe call the Show(Point3D) method whenever I detect the camera change. It's sad that it's only a AC29 feature, I would need from AC23 up to current, as demanded by my client. This problem is tied to an add-on demand from this client, but the project is paused. Once it returns, I'll definitely test this workaround. Thanks!

BrunoValads
Booster

That's an interesting solution! And I see it working from AC23 up to current. As I said in my previous reply, once this project returns I'll definitely test this workaround. Thank you so much!

Patrick M
Ace

I think you could use the billboard people object(s), and just attach a custom image... 
there are also out of the box third party solutions that may be better for what you are trying to accomplish. I can't remember which application a past firm used, but it was similar to the navigable realtor models; "click here to move camera position"

BIM solutions and trouble shooting (self proclaimed) expert. Using Archicad 26 5002 US on Mac OS 11.5.2

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!