### Implement Renga Plugin Interface (Minimal C++ Example) Source: https://help.rengabim.com/api/how-to-implement-a-plugin.html Provides a minimal C++ example of a plugin class that inherits from Renga::IPlugin. It demonstrates the implementation of the initialize and stop methods, essential for plugin lifecycle management. ```cpp #pragma once #import #include class MyPlugin : public Renga::IPlugin { public: bool initialize(const wchar_t* pluginPath) override { auto pApplication = Renga::CreateApplication(); if (!pApplication) return false; // TODO: use Renga API - create Actions, Buttons etc. return true; } void stop() override { // Cleanup } private: }; EXPORT_PLUGIN(MyPlugin); ``` -------------------------------- ### Access Renga API with Python Source: https://help.rengabim.com/api/how-to-dt-language.html Demonstrates how to interact with the Renga API using Python. This example covers application visibility, project creation, operation management, property registration, assignment to object types, and setting property values. It highlights the use of S-methods for GUIDs and GetInterfaceByName for interface casting. ```python import sys import win32com.client if __name__ == '__main__': app = win32com.client.Dispatch("Renga.Application.1") app.Visible = True if app.CreateProject() != 0: print("Error opening project") sys.exit(1) project = app.Project if project.HasActiveOperation(): print("Unable to edit project. Another operation has already begun.") app.CloseProject(True) app.Quit() # Creating and starting an operation operation = project.CreateOperation() operation.Start() model = project.Model propertyMng = project.PropertyManager propertyId = '{A288D248-C715-4796-A911-83B2DCD4BDD9}'# random propertyName = 'Test string property' levelType = '{C3CE17FF-6F28-411F-B18D-74FE957B2BA8}' # GUID for the 'level' object type, as listed in documentation. See "Entity types". # Property registration # NOTE: using the S-method accepting the GUIDs as strings propertyMng.RegisterPropertyS(propertyId, propertyName, 2) # 2 means string type, see the docs. # Assigning property to the level type # NOTE: using the S-method to work with the GUID propertyMng.AssignPropertyToTypeS(propertyId, levelType) print("Property registered in Renga and assigned to all levels") # Setting a property value to all levels objectCollection = model.GetObjects() for index in range(objectCollection.Count): object = objectCollection.GetByIndex(index) # NOTE: using the S-property if object.ObjectTypeS == levelType: propertyContainer = object.GetProperties() property = propertyContainer.GetS(propertyId) # NOTE: quering an additional interface with the GetInterfaceByName() method levelModel = object.GetInterfaceByName("ILevel") # setting the property value equal to the level name property.SetStringValue(levelModel.LevelName) # Applying the changes operation.Apply() # Closing the project without saving, dumping all the hard work app.CloseProject(True) app.Quit() ``` -------------------------------- ### GetBeginPoint() Source: https://help.rengabim.com/api/functions_g.html Retrieves the starting point of a 2D or 3D curve. ```APIDOC ## GET /websites/help_rengabim_api/GetBeginPoint ### Description Retrieves the starting point of a 2D or 3D curve object. ### Method GET ### Endpoint /websites/help_rengabim_api/GetBeginPoint ### Parameters None ### Request Example None ### Response #### Success Response (200) - **BeginPoint** (ICurve2D | ICurve3D) - The starting point of the curve. #### Response Example ```json { "beginPoint": {"x": 0, "y": 0, "z": 0} } ``` ``` -------------------------------- ### Create UI Actions in Renga API Source: https://help.rengabim.com/api/how-to-extend-ui.html Demonstrates how to instantiate an IAction, configure its display properties, and assign an icon using the IUI interface. ```C++ Renga::IImagePtr pImage = pUI->CreateImage(); pImage->LoadFromFile(L"Icon path"); Renga::IActionPtr pAction = pUI->CreateAction(); pAction->PutDisplayName(L"Name"); pAction->PutToolTip(L"Tooltip text"); pAction->PutIcon(pImage); ``` ```C# Renga.IImage image = ui.CreateImage(); image.LoadFromFile("Icon path"); Renga.IAction action = ui.CreateAction(); action.DisplayName = "Name"; action.ToolTip = "Tooltip text"; action.Icon = image; ``` -------------------------------- ### Minimal C# Renga Plugin Implementation Source: https://help.rengabim.com/api/how-to-implement-a-plugin.html A basic C# class implementing the `Renga.IPlugin` interface. This example demonstrates the structure required for a Renga plugin, including the `Initialize` and `Stop` methods. The `Initialize` method is called when the plugin loads, and `Stop` is called when it unloads. Dependencies include the Renga COM component and the `Renga.NET.PluginUtility.dll` or `Renga.NET8.PluginUtility.dll`. ```csharp namespace SamplePlugin { public class SamplePlugin : Renga.IPlugin { private Renga.Application m_app; public bool Initialize(string pluginFolder) { m_app = new Renga.Application(); // TODO: use Renga API - create Actions, Buttons etc. return true; } public void Stop() { // Cleanup } } } ``` -------------------------------- ### Renga Plugin Description File Example (XML) Source: https://help.rengabim.com/api/how-to-implement-a-plugin.html An example of a `.rndesc` file used to describe a Renga plugin. It includes essential metadata such as plugin name, version, copyright, required API version, plugin type, and the filename of the plugin's binary. This file is crucial for Renga to load and manage plugins. ```xml Sample \ 1.0 \ Copyright text \ 2.30 \ Net8 \ \ \ \ Sample.dll \ Renga \ ``` -------------------------------- ### Add Custom Controls to Panels Source: https://help.rengabim.com/api/how-to-extend-ui.html Illustrates how to create and add tool buttons, drop-down buttons, and split buttons to Renga UI panels using IUIPanelExtension. ```C++ Renga::IUIPanelExtensionPtr pUIPanelExtension = pUI->CreateUIPanelExtension(); pUIPanelExtension->AddToolButton(CreateAction1()); Renga::IDropDownButtonPtr pDropDownButton = pUI->CreateDropDownButton(); pDropDownButton->PutToolTip(L"DropDownButton tooltip"); pDropDownButton->AddAction(CreateAction2()); pUIPanelExtension->AddDropDownButton(pDropDownButton); Renga::ISplitButtonPtr pSplitButton = pUI->CreateSplitButton(CreateDefaultAction()); pSplitButton->AddAction(CreateAction4()); pUIPanelExtension->AddSplitButton(pSplitButton); pUI->AddExtensionToPrimaryPanel(pUIPanelExtension); ``` ```C# Renga.IUIPanelExtension uiIPanelExtension = ui.CreateUIPanelExtension(); uiIPanelExtension.AddToolButton(CreateAction1()); Renga.IDropDownButton dropDownButton = ui.CreateDropDownButton(); dropDownButton.ToolTip = "DropDownButton tooltip"; dropDownButton.AddAction(CreateAction1()); uiIPanelExtension.AddDropDownButton(dropDownButton); Renga.ISplitButton splitButton = ui.CreateSplitButton(CreateDefaultAction()); splitButton.AddAction(CreateAction3()); uiIPanelExtension.AddSplitButton(splitButton); ui.AddExtensionToPrimaryPanel(uiIPanelExtension); ``` -------------------------------- ### Select Walls in Scene (C#) Source: https://help.rengabim.com/api/how-to-select.html Provides a C# example for selecting all wall objects in the Renga scene. It iterates through all model objects, identifies walls by their type, and updates the selection accordingly. ```csharp Renga.IApplication application = new Renga.Application(); Renga.IProject project = application.Project; if (project == null) return; Renga.IModel model = project.Model; Renga.IModelObjectCollection modelObjectCollection = model.GetObjects(); int[] modelObjectIds = (int[])modelObjectCollection.GetIds(); var wallObjectIds = new List(); foreach (int objectId in modelObjectIds) { Renga.IModelObject modelObject = modelObjectCollection.GetById(objectId); if (modelObject == null) continue; if (modelObject.ObjectType != Renga.EntityTypes.Wall) continue; wallObjectIds.Add(objectId); } Renga.ISelection selection = application.Selection; selection.SetSelectedObjects(wallObjectIds.ToArray()); ``` -------------------------------- ### GET /api/screenshot-service Source: https://help.rengabim.com/api/annotated.html Endpoints for managing and capturing screenshots within the Renga model environment. ```APIDOC ## GET /api/screenshot-service ### Description Allows the user to create screenshots based on specific configuration settings. ### Method GET ### Endpoint /api/screenshot-service ### Parameters #### Query Parameters - **settings** (CIScreenshotSettings) - Required - The configuration object defining screenshot dimensions, quality, and output format. ### Request Example { "settings": { "width": 1920, "height": 1080, "format": "png" } } ### Response #### Success Response (200) - **image_data** (binary) - The captured screenshot image data. #### Response Example { "status": "success", "data": "base64_encoded_image_string" } ``` -------------------------------- ### Obtain NetVolume Quantity from Model Object (C++) Source: https://help.rengabim.com/api/how-to-obtain-quantities.html Demonstrates how to get the IQuantityContainer from an IModelObject, retrieve the NetVolume quantity, and check if it has a value. This function requires the Renga API and its associated headers. ```cpp void obtainQuantityContainer(Renga::IModelObjectPtr pModelObject) { Renga::IQuantityContainerPtr pQuantityContainer = pModelObject->GetQuantities(); Renga::IQuantityPtr pQuantity = pQuantityContainer->Get(Renga::Quantities::NetVolume); if (pQuantity) { if (pQuantity->HasValue == VARIANT_TRUE) { const double volume = pQuantity->AsVolume(Renga::VolumeUnit_Meters3); // Your code here } else { // The object does support the NetVolume quantity, but the quantity value could not be calculated } } else { // The object does not support the NetVolume quantity } } ``` -------------------------------- ### GetBeginAngle() Source: https://help.rengabim.com/api/functions_g.html Retrieves the starting angle of an arc (2D or 3D). ```APIDOC ## GET /websites/help_rengabim_api/GetBeginAngle ### Description Retrieves the starting angle of an arc, applicable to both 2D and 3D arc objects. ### Method GET ### Endpoint /websites/help_rengabim_api/GetBeginAngle ### Parameters None ### Request Example None ### Response #### Success Response (200) - **BeginAngle** (IArc2D | IArc3D) - The starting angle of the arc in degrees or radians. #### Response Example ```json { "beginAngle": 90.0 } ``` ``` -------------------------------- ### Create and Add Context Menu Items (C++, C#) Source: https://help.rengabim.com/api/how-to-extend-ui.html This snippet shows how to create a context menu, add action items, separators, and nested nodes. It also demonstrates how to define a context menu ID and add the menu to a specific view. The context menu can be updated by calling AddContextMenu with the same ID. ```cpp Renga::IContextMenuPtr pContextMenu = pUI->CreateContextMenu(); pContextMenu->AddActionItem(CreateAction1()); pContextMenu->AddActionItem(CreateAction2()); pContextMenu->AddSeparator(); // Create a nested context menu node: Renga::IContextMenuNodeItemPtr pContextMenuNode = pContextMenu->AddNodeItem(); pContextMenuNode->AddActionItem(CreateAction3()); pContextMenuNode->AddSeparator(); pContextMenuNode->AddActionItem(CreateAction4()); // Define the context menu ID. It can be used to update the contents of the menu. // To update the menu create a new context menu and call AddContextMenu with the previously used ID. GUID contextMenuId; IIDFromString(L"{AE6F83B2-648D-4D01-B393-841D65DA922E}", &contextMenuId); // The context menu will be shown on the 3D view scene. Use ContextMenuShowCase_Selection to show the menu only on selected objects. pUI->AddContextMenu(&contextMenuId, pContextMenu, Renga::ViewType::ViewType_View3D, Renga::ContextMenuShowCase::ContextMenuShowCase_Scene); ``` ```csharp Renga.IContextMenu contextMenu = ui.CreateContextMenu(); contextMenu.AddActionItem(CreateAction1()); contextMenu.AddActionItem(CreateAction2()); contextMenu.AddSeparator(); // Create a nested context menu node: Renga.IContextMenuNodeItem contextMenuNode = contextMenu.AddNodeItem(); contextMenuNode.AddActionItem(CreateAction3()); contextMenuNode.AddSeparator(); contextMenuNode.AddActionItem(CreateAction4()); // Define the context menu ID. It can be used to update the contents of the menu. // To update the menu create a new context menu and call AddContextMenu with the previously used ID. Guid contextMenuId = new Guid("{AE6F83B2-648D-4D01-B393-841D65DA922E}"); // The context menu will be shown on the 3D view scene. Use ContextMenuShowCase_Selection to show the menu only on selected objects. ui.AddContextMenu(contextMenuId, contextMenu, Renga.ViewType.ViewType_View3D, Renga.ContextMenuShowCase.ContextMenuShowCase_Scene); ``` -------------------------------- ### Handle Action Events in Renga API Source: https://help.rengabim.com/api/how-to-extend-ui.html Shows how to implement event handlers for actions. C++ uses the ActionEventHandler helper class, while C# utilizes the ActionEventSource class for standard .NET event syntax. ```C++ class MyActionHandler : public Renga::ActionEventHandler { public: void OnTriggered() override { /* Handle the OnTriggered event */ } void OnToggled(bool checked) override { /* Handle the OnToggled event */ } }; ... Renga::IActionPtr pMyAction = createMyAction(); m_pMyHandler = new MyActionHandler(pMyAction); ``` ```C# Renga.IAction myAction = createMyAction(); m_myActionEvents = new Renga.ActionEventSource(myAction); m_myActionEvents.Triggered += (sender, args) => { /* handle the Triggered event */ }; m_myActionEvents.Toggled += (sender, args) => { /* handle the Toggled event */}; ``` -------------------------------- ### Register and Assign Property (C#) Source: https://help.rengabim.com/api/how-to-properties.html Illustrates registering a custom property and assigning it to the Level object type using C#. This involves using Renga's PropertyDescription, Guid, IOperation, and IPropertyManager. Assumes a Renga project context. ```csharp Renga.PropertyDescription propertyDescription = new Renga.PropertyDescription(); propertyDescription.Name = "Sample property"; propertyDescription.Type = Renga.PropertyType.PropertyType_String; Guid attributeUuid = Guid.NewGuid(); Renga.IOperation operation = project.CreateOperation(); operation.Start(); // Register property in Renga: propertyManager.RegisterProperty(attributeUuid, propertyDescription); // Assign property to the Level object type: propertyManager.AssignPropertyToType(attributeUuid, Renga.EntityTypes.Level); operation.Apply(); // All levels in the project now have the property named "Sample property". ``` -------------------------------- ### Launch and Control Renga Application (C++) Source: https://help.rengabim.com/api/how-to-local-server.html Demonstrates how to initialize COM, create a local Renga application instance, make it visible, open a project, and explicitly quit the application. It also shows an RAII-based approach for managing the Renga process lifecycle. ```cpp CoInitialize(nullptr); auto renga = Renga::CreateApplication(CLSCTX_LOCAL_SERVER); renga->PutVisible(VARIANT_TRUE); renga->OpenProject(bstr_t(argv[1])); ... // use Renga someway renga->CloseProject(VARIANT_TRUE); // Quit explicitly: renga->Quit(); CoUninitialize(); // RAII example: CoInitialize(nullptr); { auto renga = Renga::CreateApplication(CLSCTX_LOCAL_SERVER); renga->CloseProject(VARIANT_TRUE); renga->OpenProject(bstr_t(argv[1])); ... // use Renga someway renga->CloseProject(VARIANT_TRUE); } CoUninitialize(); ``` -------------------------------- ### GetBeginGlobalAngle() Source: https://help.rengabim.com/api/functions_g.html Retrieves the global starting angle of a 2D arc. ```APIDOC ## GET /websites/help_rengabim_api/GetBeginGlobalAngle ### Description Retrieves the global starting angle of a 2D arc, considering its orientation within the overall model. ### Method GET ### Endpoint /websites/help_rengabim_api/GetBeginGlobalAngle ### Parameters None ### Request Example None ### Response #### Success Response (200) - **BeginGlobalAngle** (IArc2D) - The global starting angle of the 2D arc. #### Response Example ```json { "beginGlobalAngle": 45.0 } ``` ``` -------------------------------- ### Initialize Plugin - IPlugin Source: https://help.rengabim.com/api/functions_func_i.html The `initialize()` function is used to initialize a plugin. It returns an object of type `IPlugin`. This function is part of the core API and is essential for setting up plugin functionality. ```text initialize() : IPlugin ``` -------------------------------- ### GetBeginCurve() Source: https://help.rengabim.com/api/functions_g.html Retrieves the starting curve segment of a wall contour. ```APIDOC ## GET /websites/help_rengabim_api/GetBeginCurve ### Description Retrieves the curve segment that defines the beginning of a wall contour. ### Method GET ### Endpoint /websites/help_rengabim_api/GetBeginCurve ### Parameters None ### Request Example None ### Response #### Success Response (200) - **BeginCurve** (IWallContour) - The curve segment representing the start of the wall contour. #### Response Example ```json { "beginCurve": { "type": "Line", "startPoint": {"x": 0, "y": 0}, "endPoint": {"x": 5, "y": 0} } } ``` ``` -------------------------------- ### POST /application/initialize Source: https://help.rengabim.com/api/how-to-local-server.html Initializes a new instance of the Renga application as a local COM server. ```APIDOC ## POST /application/initialize ### Description Initializes the Renga application instance using COM technology. When accessed as a local server, the application starts in invisible mode by default. ### Method POST ### Endpoint /application/initialize ### Parameters #### Query Parameters - **clsContext** (string) - Required - Must be set to CLSCTX_LOCAL_SERVER for standalone applications. ### Request Example { "clsContext": "CLSCTX_LOCAL_SERVER" } ### Response #### Success Response (200) - **status** (string) - Success message - **instanceId** (string) - Unique identifier for the Renga process #### Response Example { "status": "success", "instanceId": "renga-proc-001" } ``` -------------------------------- ### Create and Save a Renga Project Source: https://help.rengabim.com/api/how-to-project-operations.html Demonstrates how to initialize a new Renga application instance, create a new project, and save it to a specified file path. This process utilizes the IApplication interface to manage the project lifecycle. ```C++ auto pApplication = Renga::CreateApplication(CLSCTX_LOCAL_SERVER); int result = pApplication->CreateProject(); if (result == 0) { auto pProject = pApplication->Project(); // Use Renga someway pProject->SaveAs(bstr_t(filePath), Renga::ProjectType::ProjectType_Project, VARIANT_TRUE); pApplication->CloseProject(VARIANT_TRUE); } ``` ```C# var application = new Renga.Application(); int result = application.CreateProject(); if (result == 0) { var project = application.Project(); // Use Renga someway project.SaveAs(filePath, Renga.ProjectType.ProjectType_Project, true); application.CloseProject(true); } ``` -------------------------------- ### GET /api/collections/{type} Source: https://help.rengabim.com/api/functions_func_g.html Retrieves collections of objects such as layers, materials, or 3D objects. ```APIDOC ## GET /api/collections/{type} ### Description Retrieves a collection of specific types of objects (e.g., ILayerCollection, IMaterialLayerCollection) from the project model. ### Method GET ### Endpoint /api/collections/{type} ### Parameters #### Path Parameters - **type** (string) - Required - The type of collection to retrieve (e.g., 'layers', 'materials'). ### Request Example GET /api/collections/layers ### Response #### Success Response (200) - **items** (array) - A list of objects belonging to the requested collection. #### Response Example { "items": [ {"id": "L1", "name": "Structural"}, {"id": "L2", "name": "Architectural"} ] } ``` -------------------------------- ### POST /project/create Source: https://help.rengabim.com/api/how-to-project-operations.html Creates a new Renga project instance and saves it to the specified file path. ```APIDOC ## POST /project/create ### Description Initializes a new Renga project application and saves the project to a designated path. ### Method POST ### Endpoint /project/create ### Parameters #### Request Body - **filePath** (string) - Required - The local file path where the project should be saved. ### Request Example { "filePath": "C:\\Projects\\NewProject.rnp" } ### Response #### Success Response (200) - **result** (int) - Returns 0 on success. #### Response Example { "result": 0 } ``` -------------------------------- ### GET /api/entities/{id} Source: https://help.rengabim.com/api/functions_func_g.html Retrieves specific model objects or entities by their unique identifier. ```APIDOC ## GET /api/entities/{id} ### Description Retrieves a specific entity or model object based on its unique ID. This is used to fetch detailed data for components like beams, walls, or property containers. ### Method GET ### Endpoint /api/entities/{id} ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the entity to retrieve. ### Request Example GET /api/entities/12345 ### Response #### Success Response (200) - **data** (object) - The requested entity object containing its properties and parameters. #### Response Example { "id": "12345", "type": "IModelObject", "properties": { "name": "Wall_01", "length": 5.0 } } ``` -------------------------------- ### GET /api/rooms/{id}/region Source: https://help.rengabim.com/api/annotated.html Retrieves the calculated region description for a specific room object. ```APIDOC ## GET /api/rooms/{id}/region ### Description Calculates and returns the spatial region description for a given room instance. ### Method GET ### Endpoint /api/rooms/{id}/region ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the room object. ### Response #### Success Response (200) - **region_description** (CIRoomRegionDescription) - The calculated volume and boundary data. #### Response Example { "room_id": "room_123", "volume": 45.5, "is_bounded": true } ``` -------------------------------- ### Implement IPlugin Lifecycle Methods Source: https://help.rengabim.com/api/class_renga_1_1_i_plugin.html The IPlugin interface requires the implementation of initialize and stop methods to handle plugin startup and shutdown. These methods ensure proper resource allocation and cleanup when the plugin is loaded or unloaded by the Renga application. ```C++ class MyPlugin : public IPlugin { public: virtual bool initialize(const wchar_t* pluginPath) override { // Plugin initialization logic here return true; } virtual void stop() override { // Plugin cleanup logic here } virtual ~MyPlugin() = default; }; ``` -------------------------------- ### Renga Plugin Configuration Source: https://help.rengabim.com/api/how-to-implement-a-plugin.html Instructions for setting up the project environment and importing the necessary Renga COM type libraries. ```APIDOC ## Project Configuration ### Description To interact with the Renga API, the project must be configured to reference the Renga COM component via the Type Library (TLB). ### Setup Steps 1. **Include Directories**: Add the path containing `RengaCOMAPI.tlb` to your project's Additional Include Directories. 2. **Import TLB**: Include the following directive before any Renga SDK headers: ```cpp #import #include ``` ### DLL Entry Point Ensure your `main.cpp` defines `DllMain` to handle the module handle: ```cpp #include HMODULE DllHandle; BOOL APIENTRY DllMain(HMODULE hModule, DWORD dwReason, LPVOID lpReserved) { if (dwReason == DLL_PROCESS_ATTACH) DllHandle = hModule; return TRUE; } ``` ``` -------------------------------- ### Get Reinforcement Geometry Source: https://help.rengabim.com/api/how-to-reinforcement.html Retrieves the geometry and placement data for rebars within a model object. ```C++ void browseObjectRebars(Renga::IModelObjectPtr pModelObject, Renga::IReinforcementUnitStyleManagerPtr pReinforcementManager) { Renga::IObjectReinforcementModelPtr pReinforcementModel(nullptr); pModelObject->QueryInterface(&pReinforcementModel); auto pRebarUsages = pReinforcementModel->GetRebarUsages(); int rebarUsageCount = pRebarUsages->GetCount(); for (int i = 0; i < rebarUsageCount; ++i) { auto pRebarUsage = pRebarUsages->Get(i); auto pGeometry = pRebarUsage->GetRebarGeometry(); // Your code here auto pPlacements = pRebarUsage->GetPlacements(); // Your code here } } ``` -------------------------------- ### Define a Simple Renga Plugin (C++) Source: https://help.rengabim.com/api/class_renga_1_1_i_plugin.html Demonstrates the basic structure for creating a Renga plugin by implementing the IPlugin interface. It includes the necessary include directive, class definition, and the required EXPORT_PLUGIN macro for registration. ```cpp #include class ExamplePlugin: public Renga::IPlugin { public: bool initialize(const wchar_t* pluginDir){ return true; }; void stop(){}; }; EXPORT_PLUGIN(ExamplePlugin); ``` -------------------------------- ### Launch and Control Renga Application (C#) Source: https://help.rengabim.com/api/how-to-local-server.html Illustrates how to instantiate the Renga application in C#, set its visibility, open a project, and manage its lifecycle either by explicit quitting or by releasing the COM reference. The .NET COM interop layer handles the distinction between plugin and local server usage. ```csharp var renga = new Renga.Application(); // Same as plugin. .NET COM interop layer manages the difference itself. renga.Visible = true; renga.OpenProject(args[0]); ... // Use Renga someway renga.CloseProject(true); // Quit explicitly: renga.Quit(); // ...or release the COM reference manually: System.Runtime.InteropServices.Marshal.ReleaseComObject(renga); ``` -------------------------------- ### Renga API - Get Reinforcement Geometry Source: https://help.rengabim.com/api/how-to-reinforcement.html Demonstrates how to retrieve the reinforcement geometry and placements for rebars within an object. ```APIDOC ## C++ ### Description Retrieves the reinforcement geometry and placements for rebars within an object. ### Method ```cpp void browseObjectRebars(Renga::IModelObjectPtr pModelObject, Renga::IReinforcementUnitStyleManagerPtr pReinforcementManager) ``` ### Parameters - `pModelObject` (Renga::IModelObjectPtr) - A pointer to the model object. - `pReinforcementManager` (Renga::IReinforcementUnitStyleManagerPtr) - A pointer to the reinforcement unit style manager. ### Code Example ```cpp Renga::IObjectReinforcementModelPtr pReinforcementModel(nullptr); pModelObject->QueryInterface(&pReinforcementModel); auto pRebarUsages = pReinforcementModel->GetRebarUsages(); int rebarUsageCount = pRebarUsages->GetCount(); for (int i = 0; i < rebarUsageCount; ++i) { auto pRebarUsage = pRebarUsages->Get(i); auto pGeometry = pRebarUsage->GetRebarGeometry(); // Your code here auto pPlacements = pRebarUsage->GetPlacements(); // Your code here } ``` ``` -------------------------------- ### Get() - Data Retrieval Source: https://help.rengabim.com/api/functions_g.html Provides methods to retrieve various collections of data, including curves, drawings, 3D objects, grids, layers, materials, parameters, placements, properties, and more. ```APIDOC ## GET /websites/help_rengabim_api/Get ### Description This endpoint provides various methods to retrieve different types of data collections. The specific collection returned depends on the context or potential query parameters (though none are explicitly defined here). ### Method GET ### Endpoint /websites/help_rengabim_api/Get ### Parameters None explicitly defined, but specific return types suggest potential filtering or selection mechanisms. ### Request Example None ### Response #### Success Response (200) - **Return Type** (ICurve2DCollection | IDrawingCollection | IExportedObject3DCollection | IGridWithMaterialCollection | IGuidCollection | ILayerCollection | IMaterialLayerCollection | IParameterContainer | IPlacement3DCollection | IPropertyContainer | IQuantityContainer | IRebarUsageCollection | IRegion2DCollection | IReinforcementUnitUsageCollection) - A collection of the requested data type. #### Response Example ```json { "curves": [ { "id": "curve1", "type": "Line" }, { "id": "curve2", "type": "Arc" } ] } ``` **Note:** The actual response structure will vary significantly based on the specific collection being retrieved. ``` -------------------------------- ### POST /project/open Source: https://help.rengabim.com/api/how-to-project-operations.html Opens an existing Renga project from a file path and handles unsaved changes. ```APIDOC ## POST /project/open ### Description Opens an existing Renga project file and checks for unsaved changes before closing. ### Method POST ### Endpoint /project/open ### Parameters #### Request Body - **filePath** (string) - Required - The path to the existing .rnp file. ### Request Example { "filePath": "C:\\Projects\\ExistingProject.rnp" } ### Response #### Success Response (200) - **result** (int) - Returns 0 on success. #### Response Example { "result": 0 } ``` -------------------------------- ### Define DLL Entry Point (main.cpp) Source: https://help.rengabim.com/api/how-to-implement-a-plugin.html Defines the DllMain function, the entry point for a DLL. It handles process attach and detach events. This is a standard Windows DLL entry point. ```cpp #include HMODULE DllHandle; BOOL APIENTRY DllMain(HMODULE hModule, DWORD dwReason, LPVOID lpReserved) { if (dwReason == DLL_PROCESS_ATTACH) DllHandle = hModule; return TRUE; } ``` -------------------------------- ### Open and Save a Renga Project Source: https://help.rengabim.com/api/how-to-project-operations.html Demonstrates how to open an existing Renga project file, check for unsaved changes, and save the project if necessary. It highlights the use of IProject methods to manage state before closing the application. ```C++ auto pApplication = Renga::CreateApplication(CLSCTX_LOCAL_SERVER); int result = pApplication->OpenProject(bstr_t(filePath)); if (result == 0) { auto pProject = pApplication->Project(); // Use Renga someway if (pProject->HasUnsavedChanges()) pProject->Save(); pApplication->CloseProject(VARIANT_TRUE); } ``` ```C# var application = new Renga.Application(); int result = application.OpenProject(filePath); if (result == 0) { var project = application.Project(); // Use Renga someway if (project.HasUnsavedChanges()) project.Save(); application.CloseProject(true); } ``` -------------------------------- ### Renga API - Browse Rebars and Get Quantities Source: https://help.rengabim.com/api/how-to-reinforcement.html Demonstrates how to iterate through rebar styles used in an object, retrieve their total length and mass, and access rebar style information. ```APIDOC ## C++ ### Description Browses rebar styles within an object and retrieves total rebar length and mass for each style. ### Method ```cpp void browseObjectRebars(Renga::IModelObjectPtr pModelObject, Renga::IReinforcementUnitStyleManagerPtr pReinforcementManager) ``` ### Parameters - `pModelObject` (Renga::IModelObjectPtr) - A pointer to the model object. - `pReinforcementManager` (Renga::IReinforcementUnitStyleManagerPtr) - A pointer to the reinforcement unit style manager. ### Code Example ```cpp Renga::IObjectReinforcementModelPtr pReinforcementModel(nullptr); pModelObject->QueryInterface(&pReinforcementModel); auto pRebarUsages = pReinforcementModel->GetRebarUsages(); int rebarUsageCount = pRebarUsages->GetCount(); for (int i = 0; i < rebarUsageCount; ++i) { auto pRebarUsage = pRebarUsages->Get(i); auto pTotalLengthQuantity = pRebarUsage->GetQuantities()->Get(Renga::Quantities::TotalRebarLength); auto pTotalMassQuantity = pRebarUsage->GetQuantities()->Get(Renga::Quantities::TotalRebarMass); // Your code here auto pRebarStyle = pReinforcementManager->GetRebarStyle(pRebarUsage->StyleId); // Work with rebar style } ``` ### Constants - `Renga::Quantities::TotalRebarLength`: The total rebar length. - `Renga::Quantities::TotalRebarMass`: The total rebar mass. ## C# ### Description Browses rebar styles within an object and retrieves total rebar length and mass for each style. ### Method ```csharp public void browseObjectRebars(Renga.IModelObject modelObject, Renga.IReinforcementUnitStyleManager reinforcementManager) ``` ### Parameters - `modelObject` (Renga.IModelObject) - The model object. - `reinforcementManager` (Renga.IReinforcementUnitStyleManager) - The reinforcement unit style manager. ### Code Example ```csharp var reinforcementModel = modelObject as Renga.IObjectReinforcementModel; var rebarUsages = reinforcementModel.GetRebarUsages(); int rebarUsageCount = rebarUsages.Count; for (int i = 0; i < rebarUsageCount; ++i) { var rebarUsage = rebarUsages.Get(i); var totalLengthQuantity = rebarUsage.GetQuantities().Get(Renga.Quantities.TotalRebarLength); var totalMassQuantity = rebarUsage.GetQuantities().Get(Renga.Quantities.TotalRebarMass); // Your code here var rebarStyle = reinforcementManager.GetRebarStyle(rebarUsage.StyleId); // Work with rebar style } ``` ### Constants - `Renga.Quantities.TotalRebarLength`: The total rebar length. - `Renga.Quantities.TotalRebarMass`: The total rebar mass. ``` -------------------------------- ### Renga API - Browse Reinforcement Units and Get Quantities Source: https://help.rengabim.com/api/how-to-reinforcement.html Demonstrates how to iterate through reinforcement unit styles used in an object, retrieve the count of units, total rebar length, and total rebar mass for each style. ```APIDOC ## C++ ### Description Browses reinforcement unit styles within an object and retrieves the count of units, total rebar length, and total rebar mass for each style. ### Method ```cpp void browseObjectRebars(Renga::IModelObjectPtr pModelObject, Renga::IReinforcementUnitStyleManagerPtr pReinforcementManager) ``` ### Parameters - `pModelObject` (Renga::IModelObjectPtr) - A pointer to the model object. - `pReinforcementManager` (Renga::IReinforcementUnitStyleManagerPtr) - A pointer to the reinforcement unit style manager. ### Code Example ```cpp Renga::IObjectReinforcementModelPtr pReinforcementModel(nullptr); pModelObject->QueryInterface(&pReinforcementModel); auto pUnitUsages = pReinforcementModel->GetReinforcementUnitUsages(); int unitUsageCount = pUnitUsages->GetCount(); for (int i = 0; i < unitUsageCount; ++i) { auto pUnitUsage = pUnitUsages->Get(i); auto pUnitStyle = pReinforcementManager->GetUnitStyle(pUnitUsage->StyleId); // Work with reinforcement unit style auto unitsCountQuantity = pUnitUsage->GetQuantities()->Get(Renga::Quantities::ReinforcementUnitCount); // Your code here } ``` ### Constants - `Renga::Quantities::ReinforcementUnitCount`: The number of reinforcement units. ## C# ### Description Browses reinforcement unit styles within an object and retrieves the count of units, total rebar length, and total rebar mass for each style. ### Method ```csharp public void browseObjectReinforcementUnits(Renga.IModelObject modelObject, Renga.IReinforcementUnitStyleManager reinforcementManager) ``` ### Parameters - `modelObject` (Renga.IModelObject) - The model object. - `reinforcementManager` (Renga.IReinforcementUnitStyleManager) - The reinforcement unit style manager. ### Code Example ```csharp var reinforcementModel = modelObject as Renga.IObjectReinforcementModel; var unitUsages = reinforcementModel.GetReinforcementUnitUsages(); int unitUsageCount = unitUsages.Count; for (int i = 0; i < unitUsageCount; ++i) { var unitUsage = unitUsages.Get(i); var reinforcementUnitStyle = reinforcementManager.GetUnitStyle(unitUsage.StyleId); // Work with reinforcement unit style var unitsCountQuantity = unitUsage.GetQuantities().Get(Renga.Quantities.ReinforcementUnitCount); // Your code here } ``` ### Constants - `Renga.Quantities.ReinforcementUnitCount`: The number of reinforcement units. ``` -------------------------------- ### Selection and Project Methods Source: https://help.rengabim.com/api/functions_func_g.html Methods for retrieving selected objects and project-level information like the undo stack. ```APIDOC ## GET /websites/help_rengabim_api/selection_project ### Description Retrieves information about selected objects and the project's undo stack. ### Method GET ### Endpoint /websites/help_rengabim_api/selection_project ### Parameters #### Query Parameters - **method** (string) - Required - The specific selection or project method to call (e.g., GetSelectedObjects, GetUndoStack). ### Request Example ```json { "method": "GetSelectedObjects" } ``` ### Response #### Success Response (200) - **result** (object) - The result of the called selection or project method. #### Response Example ```json { "result": "[Selection or project data]" } ``` ``` -------------------------------- ### IPlugin Interface Methods Source: https://help.rengabim.com/api/class_renga_1_1_i_plugin.html Lifecycle methods for Renga plugins, including initialization and cleanup. ```APIDOC ## initialize() ### Description This function is called on plugin initialization. It is used to set up the plugin environment and locate resources. ### Method N/A (Interface Implementation) ### Parameters #### Path Parameters - **pluginPath** (const wchar_t*) - Required - Pointer to the null-terminated plugin path string. ### Response #### Success Response - **bool** - Returns true if initialization is successful. --- ## stop() ### Description This function is called on plugin unloading. The plugin should release all owned resources here. ### Method N/A (Interface Implementation) ### Response #### Success Response - **void** - No return value. ``` -------------------------------- ### Project and Application Interfaces Source: https://help.rengabim.com/api/annotated.html Interfaces for managing the Renga project, application, and related events. ```APIDOC ## Project and Application Interfaces ### Description Provides interfaces for managing the Renga project, application, and handling project-related events. ### Interfaces - **CIProject**: Provides methods to work with a Renga project. Obtainable from `IApplication`. Use `IOperation` to edit the project. - **CIProjectCloseEvent**: Represents the project close event. - **CIProjectInfo**: Contains information about the project. - **CIApplication**: Represents the Renga application. ``` -------------------------------- ### Change Object Visibility in C++ and C# Source: https://help.rengabim.com/api/how-to-visibility.html Provides code examples for changing the visibility of specific objects within a Renga model view. It shows how to identify objects by their IDs and set their visibility status. This functionality is crucial for controlling what is displayed in the model. ```C++ void ChangeVisibility(Renga::IViewPtr pView) { Renga::IModelViewPtr pModelView; pView->QueryInterface(&pModelView); if (pModelView) { ATL::CComSafeArray ids(1); ids[0] = 8; pModelView->SetObjectsVisibility(ids, VARIANT_TRUE); } } ``` ```C# public void ChangeVisibility(Renga.IView view) { Renga.IModelView modelView = view as Renga.IModelView; if (modelView != null) { int[] ids = new int[] { 8 }; modelView.SetObjectsVisibility(ids, true); } } ``` -------------------------------- ### Geometry and Placement Interfaces Source: https://help.rengabim.com/api/annotated.html Interfaces for handling 2D and 3D geometry, curves, and placements. ```APIDOC ## Geometry and Placement Interfaces ### Description Provides interfaces for working with 2D and 3D geometry, including curves, placements, and related parameters. ### Interfaces - **CILine3DParams**: Represents Model Line parameters. - **CIMesh**: Represents a mesh. - **CIPolyCurve2D**: Represents a curve in 2D space composed of joined curves. - **CIPolyCurve3D**: Represents a curve in 3D space composed of joined curves. - **CIOpeningParams**: Represents opening parameters. - **CIObjectOnRoutePlacement**: Represents the placement of an object on a route. ``` -------------------------------- ### Set Property Value for Levels (C#) Source: https://help.rengabim.com/api/how-to-properties.html Provides a C# example for setting a string property value on all Level objects within a Renga project. It involves iterating through the project's model objects and using the IPropertyContainer interface to modify the property value, all within an IOperation. Assumes Renga project context. ```csharp Renga.IModel model = project.Model; Renga.IModelObjectCollection modelObjectCollection = model.GetObjects(); Renga.IOperation operation = project.CreateOperation(); operation.Start(); for (int i = 0; i < modelObjectCollection.Count; ++i) { Renga.IModelObject modelObject = modelObjectCollection.GetByIndex(i); if (modelObject.ObjectType == Renga.EntityTypes.Level) { Renga.IPropertyContainer propertyContainer = modelObject.GetProperties(); propertyContainer.Get(attributeUuid).SetStringValue("Test value"); } } operation.Apply(); ``` -------------------------------- ### GetAction() Source: https://help.rengabim.com/api/functions_g.html Retrieves the user interface action. ```APIDOC ## GET /websites/help_rengabim_api/GetAction ### Description Retrieves the user interface action associated with the current context. ### Method GET ### Endpoint /websites/help_rengabim_api/GetAction ### Parameters None ### Request Example None ### Response #### Success Response (200) - **Action** (IUI) - The user interface action object. #### Response Example ```json { "action": { "name": "Save", "command": "File.Save" } } ``` ``` -------------------------------- ### Utility and Style Interfaces Source: https://help.rengabim.com/api/annotated.html Interfaces for mathematical operations, entity creation, and style management. ```APIDOC ## Utility and Style Interfaces ### Description Provides interfaces for utility functions, entity creation arguments, and managing various style types. ### Interfaces - **CIMath**: Creates math objects. - **CINewEntityArgs**: Represents arguments for new entity construction. - **CIPlumbingFixtureStyle**: Represents a plumbing fixture style. Obtainable from `IPlumbingFixtureStyleManager`. - **CIPlumbingFixtureStyleManager**: Allows obtaining plumbing fixture styles. Obtainable from `IProject`. - **CIProfileDescriptionManager**: Allows obtaining profile descriptions. Obtainable from `IProject`. ``` -------------------------------- ### Parameter and Property Value Methods Source: https://help.rengabim.com/api/functions_func_g.html Methods for retrieving string values from parameters and properties, and volume values. ```APIDOC ## GET /websites/help_rengabim_api/value_retrieval ### Description Retrieves string values from parameters/properties and volume values. ### Method GET ### Endpoint /websites/help_rengabim_api/value_retrieval ### Parameters #### Query Parameters - **method** (string) - Required - The specific value retrieval method to call (e.g., GetStringValue, GetVolumeValue). ### Request Example ```json { "method": "GetStringValue" } ``` ### Response #### Success Response (200) - **result** (object) - The result of the called value retrieval method. #### Response Example ```json { "result": "[Retrieved value]" } ``` ``` -------------------------------- ### Style and Transformation Methods Source: https://help.rengabim.com/api/functions_func_g.html Methods for retrieving system styles, unit styles, and transformation information. ```APIDOC ## GET /websites/help_rengabim_api/style_transformation ### Description Retrieves system styles, unit styles, and transformation data. ### Method GET ### Endpoint /websites/help_rengabim_api/style_transformation ### Parameters #### Query Parameters - **method** (string) - Required - The specific style or transformation method to call (e.g., GetSystemStyle, GetUnitStyle, GetTransformFrom). ### Request Example ```json { "method": "GetSystemStyle" } ``` ### Response #### Success Response (200) - **result** (object) - The result of the called style or transformation method. #### Response Example ```json { "result": "[Style or transformation data]" } ``` ```