what is interactor pythonparts user models in Allplan software?
Source: allplan.com; Internet
What is a Allplan Python API?
A Python API (Application Programming Interface) is a set of tools, definitions, and protocols that allow you to build and interact with software applications using the Python programming language.
The Allplan Python API is a set of tools and libraries that allow developers to automate tasks, create custom components, and extend the functionality of Allplan software using the Python programming language.
Allplan is a Building Information Modeling (BIM) software used by architects, engineers, and construction professionals. The Python API in Allplan enables users to script and customize various aspects of the software to better suit their workflow and project requirements.
In the context of PythonParts for Allplan software, an “Interactor” is typically a component or module that handles user interactions within the Allplan PythonParts environment. Here’s a more detailed explanation about Interactor pythonparts user models.
Key Features of Allplan Python API
1. Automation: Automate repetitive tasks within Allplan, such as creating and modifying building elements, generating reports, and exporting data.
2. Customization: Develop custom tools and components (PythonParts) to enhance the functionality of Allplan. This includes creating parametric objects, custom dialogs, and specific workflows tailored to user needs.
3. Integration: Integrate Allplan with other software and systems by using the API to import and export data in various formats (e.g., IFC, DWG, Excel).
4. Event Handling: Handle events such as user inputs, mouse clicks, and other interactions to create dynamic and responsive tools within Allplan.
5. Access to Allplan’s Data and Functions: Access and manipulate Allplan’s project data, including building elements, reinforcement details, drawings, and layout information.
Interactor in PythonParts:
An Interactor in PythonParts is a piece of code that manages how users interact with the various parts and elements within the Allplan software. This includes handling events, processing user inputs, and updating the model accordingly.
• User Interaction: It facilitates the interaction between the user and the PythonPart elements, making it possible for users to manipulate and modify the elements in the model.
• Event Handling: It captures and responds to different events such as mouse clicks, keyboard inputs, and other actions performed by the user.
• Dynamic Updates: It updates the PythonParts in real-time based on the interactions, ensuring that the model reflects the user’s changes immediately.
This example will create a simple parametric rectangular column. It will allow the user to define the height, width, and depth of the column through a custom user interface.
import NemAll_Python_Geometry as geo
import NemAll_Python_BaseElements as base
import NemAll_Python_BasisElements as basis
import NemAll_Python_Utility as util
import NemAll_Python_IFW_ElementAdapter as elem_adpt
import NemAll_Python_Usr_Parts as usr_parts
# Define the parameters for the column
def define_parameters():
param_list = [
usr_parts.CreateUserVariable('Height', 'Column Height', 3000.0, min_value=1000.0, max_value=10000.0),
usr_parts.CreateUserVariable('Width', 'Column Width', 300.0, min_value=100.0, max_value=2000.0),
usr_parts.CreateUserVariable('Depth', 'Column Depth', 300.0, min_value=100.0, max_value=2000.0)
]
return param_list
# Create the column geometry
def create_column_geometry(params):
height = params['Height']
width = params['Width']
depth = params['Depth']
# Define the points of the column
points = [
geo.Point3D(0, 0, 0),
geo.Point3D(width, 0, 0),
geo.Point3D(width, depth, 0),
geo.Point3D(0, depth, 0)
]
# Create the base polygon
base_polygon = geo.Polygon3D(points)
# Create the column as a prism (extrude the base polygon)
column = basis.BasisElement.CreatePrism(base_polygon, height)
return column
# Main function to create the PythonPart
def main():
# Define the parameters
param_list = define_parameters()
# Create the geometry
column = create_column_geometry(param_list)
# Insert the column into the Allplan model
util.AllplanUtility.CreateElement(column)
# Run the main function to execute the script
if __name__ == '__main__':
main()
This code provides a basic example of creating a custom PythonPart in Allplan. You can expand it further by adding more parameters, error handling, and additional features as needed.
Interactor Pythonparts Components:
• Event Listeners: These are functions or methods that wait for specific events (like a click or a drag) to occur and then execute the corresponding code.
• Input Handlers: These handle the input data provided by the user, such as coordinates, dimensions, or other parameters.
• Update Mechanisms: These ensure that changes made by the user are reflected in the model instantly.
How to use pythonparts component
• When creating custom PythonParts, developers write Interactors to define how these parts will behave in response to user actions.
• Interactors are often written in Python and integrated into the PythonPart scripts, making them a crucial part of developing interactive and dynamic components in Allplan.
Suppose you have a PythonPart that represents a custom reinforcement bar. The Interactor would handle tasks such as allowing the user to click and drag to place the bar, inputting dimensions or angles, and updating the display as the user modifies the bar’s properties.
In summary, an Interactor in PythonParts for Allplan is a vital component that enables and manages the dynamic interaction between the user and the PythonParts, making it possible to create responsive and interactive models within the Allplan software.
import NemAll_Python_Geometry as geo
import NemAll_Python_BaseElements as base
import NemAll_Python_BasisElements as basis
import NemAll_Python_Utility as util
def create_wall():
# Define the wall's geometry
start_point = geo.Point3D(0, 0, 0)
end_point = geo.Point3D(5000, 0, 0)
height = 3000
thickness = 300
# Create the wall element
wall = base.BasisElement.CreateWall(
start_point, end_point, height, thickness, 'Concrete')
# Insert the wall into the Allplan model
util.AllplanUtility.CreateElement(wall)
# Call the function to create the wall
create_wall()
Here’s a simple example of using the Allplan Python API to create a wall in a project:
Benefits of Using Allplan Python API
- Efficiency: Automate complex and repetitive tasks to save time and reduce errors.
- Flexibility: Create custom solutions tailored to specific project needs and workflows.
- Integration: Seamlessly integrate Allplan with other tools and software, enhancing collaboration and data exchange.
- Enhanced Functionality: Extend the capabilities of Allplan by developing new tools and features that are not available out-of-the-box.
In summary, the Allplan Python API empowers users to customize and extend Allplan software, allowing for greater flexibility, efficiency, and integration in their BIM workflows.
Interactor provides a common interface for performing complex user interactions.
Watch our Interactor pythonparts tutorial (basic) for Allplan users here >
More Posts
Efficient Wall Rebar Detailing Workflow for Structural Engineers & Draftsmen
Wall Rebar Detailing Workflow
Rebar Detailing Efficiency: 60% Time Savings with ALLTO PythonParts in Allplan
Rebar Detailing Efficiency
Micro Living Building Project| Leverage the design & detailing using Allplan with ALLTO PythonParts
Micro Living Building Project