Junction Diagram Automation Suite 1.5.1
An AutoCAD 2024 plugin for the manipulation and generation of junction box wiring diagrams
Loading...
Searching...
No Matches
JBoxApp Class Reference

The main application class for the Junction Box Automation tool. More...

#include <JBoxApp.h>

Inheritance diagram for JBoxApp:

Public Member Functions

virtual bool OnInit ()
 Initializes the JBoxApp application.
void BuildJunctionBox ()
 Opens a dialog to configure and draw a junction box diagram.
void FlipCable ()
 Flips the orientation of selected cable or termination blocks in the drawing.
void ReIndex ()
 Recalculates and updates terminal numbers for selected junction-related blocks.

Static Public Member Functions

static void DrawJunctionBoxes (void *data)
 Draws one or more junction boxes in the active AutoCAD drawing.

Detailed Description

The main application class for the Junction Box Automation tool.

This class is responsible for initializing the application context and handling high-level operations such as building junction boxes and performing cable-related manipulations. It is built on top of the wxWidgets framework and integrates with AutoCAD.

Member Function Documentation

◆ BuildJunctionBox()

void JBoxApp::BuildJunctionBox ( )

Opens a dialog to configure and draw a junction box diagram.

This method launches a UI dialog where the user can select the Excel file, choose the junction tag, and define the box size. It then draws the selected junction box (or all boxes if "Select All" is chosen) into the current drawing.

◆ DrawJunctionBoxes()

void JBoxApp::DrawJunctionBoxes ( void * data)
static

Draws one or more junction boxes in the active AutoCAD drawing.

This function takes a pointer to a JBoxBuilderDialog instance, retrieves the selected junction tag and box size, and calls the appropriate JBox::Draw() method.

Behavior:

  • If the user selected "Select All", all junction boxes in the IO list are drawn, spaced horizontally.
  • Otherwise, only the selected junction box is drawn at the origin.
Parameters
dataA JBoxBuilderDialog* pointer containing the user's configuration and IO list.

◆ FlipCable()

void JBoxApp::FlipCable ( )

Flips the orientation of selected cable or termination blocks in the drawing.

This function toggles the horizontal orientation of supported block references, either by updating a dynamic block property (e.g., "Flip state") or by scaling the block geometry. In some cases, the block is repositioned horizontally to maintain layout consistency.

Supported flip behaviors:

  • "Junction Termination" and "Junction Termination (7 Wire)": flip via "Flip state1".
  • "Field Device Termination" and "Field Device Termination (7 Wire)": flip and shift horizontally by 18 units.
  • "TBWIREMINI": flip by scaling X axis and shift position by 18.6876 units.
  • "INST SYMBOL": flip and shift by 19.8751 units.

Behavior:

  • If no implied selection exists, the user is prompted to select entities.
  • Each block is examined for its flip state, adjusted if needed, and repositioned accordingly.
  • Invalid or unsupported entities are silently ignored.

◆ OnInit()

bool JBoxApp::OnInit ( )
virtual

Initializes the JBoxApp application.

This method is called on application startup. It creates a wxWindow that wraps the AutoCAD main window to serve as a parent for UI elements.

Returns
true if initialization succeeds, false otherwise.

◆ ReIndex()

void JBoxApp::ReIndex ( )

Recalculates and updates terminal numbers for selected junction-related blocks.

This function prompts the user to select AutoCAD block references representing junction terminations and reassigns their terminal numbers based on vertical position in the drawing. The cable block with the highest Y-coordinate is used as the reference point (first terminal), and subsequent blocks are indexed downward in 0.25 unit increments.

Supported blocks:

  • "Junction Termination"
  • "Junction Termination (7 Wire)"
  • "Field Device Termination"
  • "Field Device Termination (7 Wire)"
  • "TBWIREMINI"

For each block, it modifies terminal-related attributes (e.g., FLDTAG1–FLDTAG9) based on standard spacing rules. The user is prompted to input the starting terminal number.

Behavior:

  • If no implied selection exists, the user is prompted to select entities.
  • Skips entities that cannot be resolved or don't match supported block names.
  • Updates terminal numbers in-place by modifying block attributes.

The documentation for this class was generated from the following files: