License Delivery maintenance is expected to occur on Saturday, November 30, between 8 AM and 11 AM CET. This may cause a short 3-hours outage in which license-related tasks: license key upload, download, update, SSA validation, access to the license pool and Graphisoft ID authentication may not function properly. We apologize for any inconvenience.
Archicad C++ API
About Archicad add-on development using the C++ API.

how to access functionalities(like extrude,revolve) of GUI morph object through program.

Anonymous
Not applicable
Hello Everyone,

Note - I'm using Archicad 22 and equivalent SDK for development.

I'm working on a program to create objects for which i have geometry information in JSON files.
the information is in the form of profile data, extrude begin, extrude end, revolve axis, angle of revolution etc.

I know we can create morph objects by providing the vertices,edges,polygon to the body data and then creating the object but in GUI we can create 2d morph and then extrude it or revolve it around a given axis which is easier and more convenient

I was wondering how can we do that through program(add on) I have gone through the Element_Basic.cpp of the examples provided with SDK but i could not find any solution for my problem i've also ready the documentation regarding morph provided with the SDK but even there i couldn't find a solution for my problem.
Please guide how to approach this problem. Article Links/Documenation/methods which i can use will be appreciated.

In case I'm unclear about the problem or you require further information please do ask and i will provide it ASAP.

Thank You in advance
5 REPLIES 5
Tibor Lorantfy
Graphisoft Alumni
Graphisoft Alumni
Hi,

Please check the Do_CreateMorph example function inside Element_Basic.cpp.
Steps you have to make:
  • Create a new body with ACAPI_Body_Create.
  • Add vertices to the body by using ACAPI_Body_AddVertex.
  • Use ACAPI_Body_AddEdge to create edges between the vertices.
  • Determine polygons from edges with ACAPI_Body_AddPolygon. (Defining the normal vector is optional, but you can do that by adding normals using ACAPI_Body_AddPolyNormal.)
  • Finish the body and copy it to the memo of the new morph (ACAPI_Body_Finish). Do not forget to dispose the body after you had it in the memo (ACAPI_Body_Dispose).
Regards,
Tibor
Anonymous
Not applicable
Hello Tibor,
As I mentioned above, I went through the example you mentioned and I can see that we can create morphs by adding vertices,edges and polygons but i was wondering if we can create morphs by providing a profile and extrusion or a profile and revolve axis. this functionality exists in the GUI but how do it through SDK?
Tibor Lorantfy
Graphisoft Alumni
Graphisoft Alumni
nikhil.negi wrote:
i was wondering if we can create morphs by providing a profile and extrusion or a profile and revolve axis. this functionality exists in the GUI but how do it through SDK?
Currently that is not possible via API.
You have to define the vertices/edges/polygons on your own.
Akos Somorjai
Graphisoft
Graphisoft
Hi,

The solution might depend on what you mean by "objects":
- normal library part based objects → use GDL to create them. The Profiler goodie add-on works in a similar way, though it asks the user to draw the input profile in ARCHICAD
- beams, columns → you can create a profile attribute, and refer to it
- freeform → use morphs, as Tibor suggested

Best, Akos
Anonymous
Not applicable
Hello again,

I created some functions that would give me the vertices for the extrude from the profile and extrude vector so that i can create morph with the method mentioned in the example.
but when i set
element.morph.bodyType = APIMorphBodyType_SurfaceBody;
	element.morph.edgeType = APIMorphEdgeType_SoftHiddenEdge;
It does nothing. No matter what i set these properties as, the final object is created with default properties always.
I had posted a similar query where isflipped parameter of shell object was not getting set, here https://archicad-talk.graphisoft.com/viewtopic.php?f=23&t=67388
this seems to be similar to that problem. can you please verify if its a bug and if its not how can i set these properties programatically.

Thanks in Advance