Articles and Press Releases

Creating Custom Objects in IntelliCAD

One of the most powerful features of the IntelliCAD development platform is the ability to create custom entities (also known as custom objects). Developers can define the behavior of custom entities which can greatly improve the user’s experience, enhancing productivity.

How can custom entities improve your user’s CAD experience? Let’s use the example of drawing a floor plan to explain. When drafting a floor plan using primitives (lines, arcs, circles) a user will combine these primitives to make a door shape or block that can be used throughout the drawing. If a new door size is required then the shapes have to be redrawn from scratch. Lines are used to draw walls and must be manually trimmed; if a wall’s angle is changed all the door shapes have to be manually realigned with the wall lines.

However, an application developer can define custom entities for walls, doors and windows. Since you define the behavior of these entity types you can define their name, how they are inserted, how they scale, are mirrored, their properties and how they interact with other entities — either primitives or additional custom entities. You can create the door object with properties such as width and height (common terminology for doors), and define the behavior of how doors will work when those properties change and how they relate to the environment.

For example, doors need to be not only inserted into a wall but also need to create break lines on the wall itself. Then when the door is moved, the wall needs to rebuild and create a new hole in the new position. The custom door entity can be defined to allow the swing to flip, not to mention changing the width or height of the door itself. When the door is copied and pasted does it stick within the wall or is a freestanding door allowed within the drawing? Is it possible to allow regular CAD editing commands (move, copy, trim, extend, stretch) to interact with the custom door entity? Also the developer can define what the custom entity will look like in different views: 2D plan, elevation and 3D view.

What is important to note here is that custom objects allow the programmer to not only define the appearance, properties and associated data of the object but also to define its behavior in relation to its environment and likewise the environment in relation to the object. This ability to create behavior and use terminology that is familiar to the target user greatly improves user productivity. The complexity of a custom object really is up to the programmer but they should consider:
• How the entity is saved in the .dwg file
• How the graphics and geometry are displayed in both the viewports and 2D/3D world environments
• The names of properties and the behavior when those properties change
• How the entity works with various snap modes
• How many grip points will be available and how they behave
• How the entity intersects with the other entities in the drawing
• What happens when the entity is exploded or viewed in other programs
• What relationships the entity may have with other entities in the drawing
• How the entity displays and behaves when your application is not present

Developers define the behavior of their custom entities in application extension DLLs, but you can also define some basic behavior for your entities when your application DLL is not present. Developers can define proxy graphics and determine if some basic editing (like copy or move) can be done without their application. However, in the case of a door entity it would be impossible for it to resize properly when the properties where changed or to automatically update walls if the underlying application was missing. The proxy functionality only allows your .dwg files that contain custom entities to have some basic behavior when loaded in other CAD applications. Then again, if you choose to force the user to purchase your application you can disable all proxy functionality so the custom entities are useless without your underlying application.

To get the full behavior of a custom entity, the underlying application DLL needs to be loaded within IntelliCAD prior to opening a drawing that contains custom entities. This can be done either manually [via the APPLOAD command] or automatically when the IntelliCAD program starts [by dropping the IRX file into the IntelliCAD program folder].

The IntelliCAD API provides a simple sample application that demonstrates the power of custom entities. The API installation files are usually shipped with the IntelliCAD program but can also be found on the IntelliCAD beta forum. The following movie shows how to load, install, and experiment with the sample custom entity application included within the IntelliCAD API:

The sample discussed here is included in the API samples and documentation. Although the source code is available to build the application from scratch, the IRX DLL release version is also prebuilt and waiting for you to load it.

If you are a developer interested in using the IntelliCAD platform please contact Robert Berry via Skype at Robert.Berry.ITC and apply for access to our beta forum so that you can test the software for yourself.

Topics: IntelliCAD DWG IntelliCAD® 7 CAD programming BIM ARX IRX custom objects custom entities

Programming with IntelliCAD

The IntelliCAD Technology Consortium (ITC) is a nonprofit organization that delivers a safe and affordable CAD programming platform for its members. Each of the consortium’s commercial members share the source code of the IntelliCAD program and invariably add their own specialty solutions for their own niche markets.

At its core, the IntelliCAD program is based on and expands the Open Design Alliance (ODA) programming interface (API) called Teigha. The ODA is also a nonprofit organization that supplies .dwg programming libraries to its members. The IntelliCAD IRX API can be considered an extension of the Teigha API.

Traditionally, a recipe for success when creating a compiler for programming purposes is to use the programming language of the compiler to write additional functionality within the compiler itself. This methodology ensures that the programming language is sound in that it has to be used in order to create itself, layer upon layer. In a similar way the IntelliCAD program is written using the ODA Teigha libraries. The entire IntelliCAD source code is in fact a set of examples showing how to use the Teigha/IRX interface to create CAD programming solutions.

Resultantly, the preferred method of programming within IntelliCAD is by using the IRX API. Although several other APIs are available, IRX, an object oriented C++ API is our most powerful API with the ability to create custom objects and provides the best performance for complex solutions.

There are however a multitude of different programming APIs that are available to developers who are interested in using the IntelliCAD platform.

At an end-user level, there is the ability to record and save macros in a text format. These text files can later be edited, loaded and run as a script, thereby saving the user a great deal of time on repetitive tasks. This text script format effectively gives access to all of the commands that can be typed into the IntelliCAD command line.

The IntelliCAD menu structure is also based on a TXT format which enables full customization of the menu either from within or outside the program. Developers can easily replace or add to the existing IntelliCAD menu structures. Other menu programming tools such as DCL and DIESEL are also supported.

At the next level, IntelliCAD offers a LISP programming interface that is extremely similar to AutoCAD’s AutoLISP. If you create LISP commands from within IntelliCAD, they can be run in AutoCAD. The LISP interpreter is an internal API and can even be combined with the macro recording language mentioned above.

IntelliCAD also includes the Solutions Development System (SDS), which is a C/C++ language interface comparable with the ADS® (AutoCAD® Development System). The SDS system is more like C versus C++ in that it does not have the ability to create custom objects but it can support complex solutions development. IntelliCAD is compatible with ADS programs and several ITC members have successfully imported millions of lines of ADS code to IntelliCAD.

IntelliCAD also supports many different flavors of COM programming. Direct COM development can be done in C/C++. We also support the Visual Basic for Applications interpreted compiler within the IntelliCAD program and the Visual Basic development environment for compiling outside of IntelliCAD. You can even do C# development from within IntelliCAD and support for this API is improving all the time.

If you are interested in finding out if IntelliCAD can solve your CAD development needs, please contact me, Robert Berry via Skype at Robert.Berry.ITC.

Join the IntelliCAD Technology Consortium

Topics: DWG CAD Platform CAD programming ITC ADS ARX IRX AutoLISP Lisp