We value your input!
Please participate in Archicad 28 Home Screen and Tooltips/Quick Tutorials survey

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

Draw 3D point through Code in ArchiCAD?

cad developer
Contributor

Hi Graphisoft Community!
I am looking for a straight forward way to draw/place (create and display) a 3D point in ArchiCAD. I am trying to use Point3D from C:\Program Files\Graphisoft\API Development Kit 27.3001\Support\Modules\Geometry\Vector3D.hpp to create a point, but I see no option to display this point on ArchiCAD.
Any assistance on this topic will be of great help!!!


Thank You,
CAD Developer.

1 ACCEPTED SOLUTION

Accepted Solutions
Solution
Ralph Wessel
Mentor

You can create the object just using the built-in library part creation tools (File > Libraries and Objects > New Object…)

You could create parameters to store the x/y/z coordinates and a 3D script render them. You can create library parts in the add-on too, but I don't think it will help in this case (but if you're interested, refer to the LibPart_Test example project, specifically Do_CreateLibraryPart).

 

Either way – once you have an object – the add-on could place instances of this object and fill the relevant parameters with the coordinates. There is similar code for placing a window object in the Element_Test example, specifically Do_CreateWindow.

Ralph Wessel BArch
Software Engineer Speckle Systems

View solution in original post

5 REPLIES 5
Ralph Wessel
Mentor

Think of Point3D (and for any class/struct in the Geometry folder) as a maths tool for creating geometric bodies, but not directly for visualisation.

 

The only classes that directly contribute to 2D and 3D visualisation can all be found in the API_Element union, e.g. API_WallType (for walls), API_SlabType (for slabs), API_ObjectType (for objects) etc. and are generally called 'elements'. Archicad is generally not about raw geometry. Elements are at the core of a project - when Archicad renders that content, the raw geometry is generated on demand from the elements.

 

So if you want a point in the 3D model, you need to create an element that will generate that point for you. The most obvious choice would be a GDL object - the object could have parameters for one or more points that are populated by the add-on, and when placed in the project it renders the point(s) for you.

 

You cannot directly inject raw geometry into a scene as a Point3D.

Ralph Wessel BArch
Software Engineer Speckle Systems
cad developer
Contributor

Hi @Ralph Wessel ,

Thank you for your detailed response. I appreciate the clarification on how raw geometry is handled within Archicad.

Could you please provide a clear step-by-step guide on how to create a GDL object using C++ code ( I need to create this object inside my add on)? This will help me understand how to use GDL objects to render points within the project.

Thank you!

Solution
Ralph Wessel
Mentor

You can create the object just using the built-in library part creation tools (File > Libraries and Objects > New Object…)

You could create parameters to store the x/y/z coordinates and a 3D script render them. You can create library parts in the add-on too, but I don't think it will help in this case (but if you're interested, refer to the LibPart_Test example project, specifically Do_CreateLibraryPart).

 

Either way – once you have an object – the add-on could place instances of this object and fill the relevant parameters with the coordinates. There is similar code for placing a window object in the Element_Test example, specifically Do_CreateWindow.

Ralph Wessel BArch
Software Engineer Speckle Systems

Hello @Ralph Wessel
Thank you for the response. I am able to create GDL object sphere and I am working on setting position for the object through code. However, I need to change the material of the object so that I can assign colors to the sphere. Can you suggest any documentation or solution so that I can change the material and color of the GDL object?
Eagerly waiting for you response.
Regards.
CAD Developer.

GDL supports a wide variety of parameter types, including materials. I suggest adding another parameter to your object for material and populating that in your code in addition to the sphere position.

Ralph Wessel BArch
Software Engineer Speckle Systems