Archicad C++ API
About Archicad add-on development using the C++ API.

Get Camera FOV from a Rendering addin

Anonymous
Not applicable
Hi

How can I get the camera Field Of View from a rendering addin pls? I use the following code to get the camera position and target - but cannot find a way to get the FOV.
	GSModeler::Vertex targetPoint = camera->GetTargetPoint ();
	GSModeler::Vertex viewPoint = camera->GetViewPoint ();
Thanks

Paul
9 REPLIES 9
Anonymous
Not applicable
Does anyone have a solution for this pls?

Thanks

Paul
Anonymous
Not applicable
Bumping to hopefully get a reply pls.

Thanks

Paul
Tibor Lorantfy
Graphisoft Alumni
Graphisoft Alumni
Hi Paul,

from Rendering API you won't be able to get the FOV value.
But using AC API it's possible:
API_3DProjectionInfo	p; 
err = ACAPI_Environment (APIEnv_Get3DProjectionSetsID, &p, NULL); 
if (err == NoError && p.isPersp) { 
	fov = p.u.persp.viewCone; 
}


Or if you have the GUID of the camera, you can get the camera element with ACAPI_Element_Get using the GUID and element.camera.perspCam.persp.viewCone will contain the value.

I hope this is useful for you.

Regards,
Tibor
Anonymous
Not applicable
Thanks Tibor

How do I access the AC API from a rendering API pls? I cannot get ACAPI_Environment() to compile without error, even when I include ACAPinc.h.

Thanks

Paul
Tibor Lorantfy
Graphisoft Alumni
Graphisoft Alumni
paulk wrote:
How do I access the AC API from a rendering API pls? I cannot get ACAPI_Environment() to compile without error, even when I include ACAPinc.h.


Please use API DevKit and don't forget to link with ACAP_STAT library.
Could you tell me please what kind of errors did you get during the compiling or linking?
Anonymous
Not applicable
Thanks Tibor

If I try to link my rendering API plugin with ACAP_STAT.lib, I get the following link errors.
ACAP_STAT.lib(ACAPlib.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in ConfigurationDlg.obj
ACAP_STAT.lib(ACAPlib.obj) : error LNK2005: "int (__cdecl* _pRawDllMain)(void *,unsigned long,void *)" (?_pRawDllMain@@3P6AHPEAXK0@ZEA) already defined in OctaneRenderForArchiCAD_Renderer.obj
ACAP_STAT.lib(ACAPlib.obj) : error LNK2005: "struct HINSTANCE__ * __cdecl DllMainImp_GetWindowsHInstance(struct DllMainImp_InitContext const *)" (?DllMainImp_GetWindowsHInstance@@YAPEAUHINSTANCE__@@PEBUDllMainImp_InitContext@@@Z) already defined in OctaneRenderForArchiCAD_Renderer.obj
ACAP_STAT.lib(ACAPlib.obj) : error LNK2005: "struct DllMainImp_ResModuleSpec __cdecl DllMainImp_GetResModuleSpec(struct DllMainImp_InitContext const *)" (?DllMainImp_GetResModuleSpec@@YA?AUDllMainImp_ResModuleSpec@@PEBUDllMainImp_InitContext@@@Z) already defined in OctaneRenderForArchiCAD_Renderer.obj
ACAP_STAT.lib(ACAPlib.obj) : error LNK2005: "__int64 __cdecl DllMainImp_OpenResModule(struct DllMainImp_InitContext const *)" (?DllMainImp_OpenResModule@@YA_JPEBUDllMainImp_InitContext@@@Z) already defined in OctaneRenderForArchiCAD_Renderer.obj
ACAP_STAT.lib(ACAPlib.obj) : error LNK2005: "__int64 __cdecl DllMainImp_OpenResModuleFromSpec(struct DllMainImp_ResModuleSpec const *)" (?DllMainImp_OpenResModuleFromSpec@@YA_JPEBUDllMainImp_ResModuleSpec@@@Z) already defined in OctaneRenderForArchiCAD_Renderer.obj
ACAP_STAT.lib(ACAPlib.obj) : error LNK2005: "void __cdecl DllMainImp_CloseResModule(__int64)" (?DllMainImp_CloseResModule@@YAX_J@Z) already defined in OctaneRenderForArchiCAD_Renderer.obj
ACAP_STAT.lib(ACAPlib.obj) : error LNK2005: "struct DllMainImp_LocationSpec __cdecl DllMainImp_GetLocation(struct DllMainImp_InitContext const *)" (?DllMainImp_GetLocation@@YA?AUDllMainImp_LocationSpec@@PEBUDllMainImp_InitContext@@@Z) already defined in OctaneRenderForArchiCAD_Renderer.obj
ACAP_STAT.lib(ACAPlib.obj) : error LNK2005: "int __cdecl _CRT_INIT_MY(void *,unsigned long,void *)" (?_CRT_INIT_MY@@YAHPEAXK0@Z) already defined in OctaneRenderForArchiCAD_Renderer.obj
ACAP_STAT.lib(ACAPlib.obj) : error LNK2005: DllMain already defined in OctaneRenderForArchiCAD_Renderer.obj
ACAP_STAT.lib(ACAPlib.obj) : error LNK2005: DllMainEntry already defined in OctaneRenderForArchiCAD_Renderer.obj
LINK : fatal error LNK1104: cannot open file 'stlport_vc7.lib'
Paul
Anonymous
Not applicable
Any feedback from GS on this? It seems the rendering and general lib can't be compiled into the same plugin as they have DLL basic export functions (load etc) built in, so there's a name clash. Fetching info such as camera FOV and reading library item data can't be done via the rendering API, so there's a need to call the general API via the ACAP_STAT library. But it won't compile with the rendering libs.

UPDATE: need to do it the other way around. Build standard API then link with GSModelerImp.lib.
Akos Somorjai
Graphisoft
Graphisoft
MarkHenryC wrote:
Any feedback from GS on this? It seems the rendering and general lib can't be compiled into the same plugin as they have DLL basic export functions (load etc) built in, so there's a name clash. Fetching info such as camera FOV and reading library item data can't be done via the rendering API, so there's a need to call the general API via the ACAP_STAT library. But it won't compile with the rendering libs.

UPDATE: need to do it the other way around. Build standard API then link with GSModelerImp.lib.
Hi Paul,

The FOV is stored as 'eyeAngle' in the ModelerAPI::Environment::ViewSetting class. I found only a way to pass this onto MakePicture, but I couldn't find how to read that from ARCHICAD. BTW, the default value is 60º.

Best, Akos
Anonymous
Not applicable
The FOV is stored as 'eyeAngle' in the ModelerAPI::Environment::ViewSetting class. I found only a way to pass this onto MakePicture, but I couldn't find how to read that from ARCHICAD. BTW, the default value is 60º.
Thanks Akos. I still do not understand how to get the FOV. I could not find any way to access the ModelerAPI::Environment::ViewSetting class in MakePicture. Would you be able to post the code to do this pls?

Thanks

Paul

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!