The Global ARCHICAD Community

Stay informed. Get help. Share your knowledge.

Discussions about using GRAPHISOFT's tools (API DevKit) for independent software developers

Moderators: Barry Kelly, Karl Ottenstein, LaszloNagy, ejrolon, gkmethy, Tibor Lorántfy, MOREH Tamas, Akos Somorjai, Ed Brown, Mihály Palenik

#282921
Hi !

I've been recently tasked with the construction of a written report created programatically from data in the ArchiCAD API.

As I've went through the doors and windows export, I've also been asked to export graphical data, such as what is available in here :
ArchicadWindowPreview.PNG

Ideally, if I could export them to a standard image format (jpg, png), that would solve my problem.

I've been digging around in the API_WindowType to see if I could find relevant data, but all I could find was some "pen data" in API_OpeningBase, that I don't know how to make use of.
I also digged around a bit in GDL documentation, but it looks like it is used to create new objects from scripting, not to export graphical data of already existing elements.

Can someone help me out on this ?
Thanks !
#282933
The 2D/3D rendering of GDL objects is dynamically generated on demand and varies according to parameter values and model view options etc. Therefore, there is no static image embedded in the object (apart from the object icon).

You can ask ARCHICAD to break down the illustration of an element into 2D primitives with ACAPI_Element_ShapePrims – that could be the basis for rendering an image to export.
#282936
Nice, I couldn't find this when I was searching, but after reading a bit about it, it looks like I can do something with it.
I'll come back to this thread once a huge problem arises / I've finished this, I'll probably make something to draw the primitives in a .png, so I probably will dump it here once it is done

Thanks for your help !
#283053
Hi again !

I experimented a bit around with ACAPI_Element_ShapePrims, but as noted in ACAPI_Librpart_shapeprims, the 2D data you receive using this is the floor, "view from above" representation of the element.

So I tinkered around, found ACAPI_Element_Get3D, and had other, more pressing work to do, so I couldn't really experiment too much and try to draw the 3D representation myself.

But, I got reaaally lucky while rummaging around in the DG_Test example : as I was experimenting around, I found ACAPI_​Element_​GetVisualOverriddenImage in the DG_Test example !

The representation given by this function is exactly what I needed, so i'll be attaching a picture of what an extracted image looks like for future reference.

Consider this solved !
Attachments
test.jpg
test.jpg (7.58 KiB) Viewed 55 times