4. Debug → Start external program: Select the path to C:\Program Files\Graebert GmbH\ARES Commander 2024\BIN\ARESC.exe, and add "/b <path to .scr file>" to Start options → Command line arguments.
5. Add the following DLLs to References: Include the TD_Mgd_x.xx_xx.dll* and FxCoreMgd_x.xx_xx.dll from ARES Commander (C:\Program Files\Graebert GmbH\ARES Commander 2024\BIN).
6. Add the created C++ project to References → Projects.
Guide to Creating a Custom Entity Level
CustomEntity.h: Header file of the custom entity.
class CustomEntity : public OdDbEntity
{
ODDB_DECLARE_MEMBERS(CustomEntity);
CustomEntity();
virtual ~CustomEntity();
/**
Function used to draw the Custom Entity.
@param [in] Pointer to the OdGiWorldDraw object.
@return \\c true if the custom entity does not have a view-dependent association with any other entity.
Otherwise, return \\c false and the subViewportDraw function must be implemented.
*/
bool subWorldDraw(OdGiWorldDraw* pWd) const override;
/**
Optional function used to draw the Custom Entity containing associations with other entities. (May contain other entities within)
@param [in] Pointer to the OdGiViewportDraw object.
*/
void subViewportDraw(OdGiViewportDraw* pVd) const override;
/**
Reads the DXF data for our new entity.
@param [in] Pointer to the OdDbDxfFiler object.
@return \\c eOk if successful.
*/
OdResult dxfInFields(OdDbDxfFiler* filer) override;
/**
Writes the DXF data for our new entity.
@param [in] Pointer to the OdDbDxfFiler object.
*/
void dxfOutFields(OdDbDxfFiler* filer) const override;
/**
Reads the DWG data of this object.
@param [in] Pointer to the OdDbDwgFiler object.
@return \\c eOk if successful.
*/
OdResult dwgInFields(OdDbDwgFiler* pFiler) override;
/**
Writes the DWG data for our new entity.
@param [in] Pointer to the OdDbDwgFiler object.
*/
void dwgOutFields(OdDbDwgFiler* pFiler) const override;
/**
Function used to apply a specific 3D transformation to the entity.
@param [in] A transformation matrix.
@return \\c eOk if successful.
*/
OdResult subTransformBy(const OdGeMatrix3d& xform) override;
/**
Function called to retrieve grip points for the entity.
@param [in/out] Receives an array of WCS grip points.
@return \\c eOk if gripPoints contain grip points.
*/
OdResult subGetGripPoints(OdGePoint3dArray& gripPoints) const override;
/**
Function called when a selected grip point is moved.
@param [in] Array of indices.
@param [in] The direction and magnitude of the grip points offset (WCS).
@return \\c eOk if successful.
*/
OdResult subMoveGripPointsAt(const OdIntArray& indices, const OdGeVector3d& offset) override;
/**
Function called to retrieve snap points for the current mode.
@param [in] The object snap mode being queried.
@param [in] The GS marker of the subentity being queried.
@param [in] The WCS point being queried.
@param [in] The WCS point picked before pickPoint.
@param [in] The WCS->DCS transformation matrix.
@param [in/out] Receives an array of UCS object snap points.
@return \\c eOk if successful.
*/
OdResult subGetOsnapPoints(OdDb::OsnapMode osnapMode, OdGsMarker gsSelectionMark,
const OdGePoint3d& pickPoint, const OdGePoint3d& lastPoint,
const OdGeMatrix3d& xWorldToEye, OdGePoint3dArray& snapPoints) const override;
/**
Function called to explode this custom entity into a set of simpler entities.
@param [in/out] Receives an array of pointers to the new entities.
@return \\c eOk if successful, or an appropriate error code if not.
*/
OdResult subExplode(OdRxObjectPtrArray& entitySet) const override;
private:
OdGePoint3d m_center;
double m_radius;
};
/** \\typedef OdSmartPtr<CFxPIEntity> CFxPIEntityPtr
CFxPIEntity smart pointer, used later to create the object
*/
typedef OdSmartPtr<CustomEntity> OdBbCustomLevelPtr;
Entity.h: Public wrapper class used to expose CustomEntity for C# consumption.
using namespace Teigha::Geometry;
using namespace Teigha::DatabaseServices;
public ref class CustomLevel : Entity
{
public:
CustomLevel(CustomEntity*, bool bol);
CustomLevel();
~CustomLevel();
/**
This function is used to create a wrapper function to interact with CustomEntity
**/
void functionEdit();
private:
CustomEntity* GetImpObj()
{
return static_cast<CustomEntity*>(UnmanagedObject.ToPointer());
InitCLI.h: Header file declaration used to initialize CustomEntity instances.
#pragma once
public ref class InitCLI
{
public:
static void Init();
static void UnInit();
};
#include "InitCLI.h"
#include "OdBbCustomLevel.h"
void InitCLI::InitializeCustomEntity()
{
CustomEntity::rxInit();
// If there are multiple entities, we will initialize all of them here
#if defined _AutoCad
acrxBuildClassHierarchy();
#endif
}
void InitCLI::UnInitializeCustomEntity()
{
// If there are multiple entities, we will destroy all of them here
CustomEntity::rxUninit();
}
Wrapper.cs: This file adds commands and executes them along with Ares.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Teigha.ApplicationServices;
using Teigha.DatabaseServices;
using Teigha.EditorInput;
using Teigha.Geometry;
using Teigha.Runtime;
using Aplication = Teigha.ApplicationServices.Application;
namespace Wrapper
{
public class Class1 : IExtensionApplication
{
[CommandMethod("TestCustomEntity")]
public void Test11()
{
// Get Active Document and Database
Document doc = Application.DocumentManager.MdiActiveDocument;
Database db = doc.Database;
Editor ed = doc.Editor;
// Starts a Transaction
using (Transaction trans = doc.TransactionManager.StartTransaction())
{
// Open Block Table in Read Mode
BlockTable blkTbl = (BlockTable)trans.GetObject(db.BlockTableId, OpenMode.ForRead);
BlockTableRecord blkTblRec = (BlockTableRecord)trans.GetObject(blkTbl[BlockTableRecord.ModelSpace], OpenMode.ForWrite);
CustomLevel customObj = new CustomLevel();
customObj.functionEdit();
// Add Solid Entity to Block table Record
blkTblRec.AppendEntity(customObj);
trans.AddNewlyCreatedDBObject(customObj, true);
trans.Commit();
}
}
public void Initialize()
{
InitCLI.Init();
}
public void Terminate()
{
InitCLI.UnInit();
}
}
}
The next step after creating rebars for several beams and columns – connect rebars of different hosts in Revit. In order to find hosts, which rebars can be connected, we use intersection filters, such as BoundingBoxIntersectsFilter. However, depending on host type (Beam or Column) approach is slightly different.
Using Revit Smart Rebar System Hooks can be applied either to Column Rebars or Beam Rebars. Although applying logic for Beams and Columns very similar, there are also some differences between approaches for each case. Let’s begin introduction into Hook Manager with Beams first.
Constraints system is a powerful Revit instrument, that allows user adding important dependencies between elements and create special behavior on changing one of them.
Developing complex plugins for Revit is impossible without saving important for correct working information. There are multiple approaches depending on plugin type, requirements, information and so on to save and load this information.
Revit built-in commands to place rebars are very limited, especially when we talking about placing straight rebars by specific pattern. Also, there is no built-in features to apply rebars to multiple hosts at the same time.
Unreal Engine apart from being a powerful engine for game development, can be used as a powerful tool for creating realistic scenes thanks to its own built-in Render Engine.
6 days ago
Quality & Information Security
are at the core of our priorities.
Contact
Email:sales@tgl-sol.com
Hotline:(+84) 377 359 728
Ho Chi Minh Office:42/1 Ung Van Khiem Street, Ward 25, Binh Thanh District, Ho Chi Minh
Da Nang Office:01 Tran Van Ky Street, Hoa Khanh Nam Ward, Lien Chieu District, Da Nang
Headquarter:3F Tojikyo Building, 16-2 Kodenmacho, Nihonbashi, Chuo-ku, Tokyo, Japan