Hey guys,
I hope you're all doing well!
So, we have a wizard that contains all drawing elements like walls, doors, windows, chimneys, etc. that are already defined.
A company can provide us with the starting and ending positions of each element in the floorplan, as well as other parameters like width, height, etc ( floorplans are simple, but they have over 3000 of them )
We would like to draw all of the plans programmatically.
I managed to draw only walls with the script attached below and have no idea how to add other elements to it.
So my questions are:
How can I insert windows and doors into the walls, add chimneys, and add dimension lines to the whole drawing?
How can I reuse wizards when drawing elements with python? Perhaps save the wizard element settings to a file and then load them before drawing?
Best Regards!
Code:
import NemAll_Python_Geometry as AllplanGeo import NemAll_Python_ArchElements as AllplanArchElements def check_allplan_version(build_ele, version): """ Check the current Allplan version Args: build_ele: the building element. version: the current Allplan version Returns: True/False if version is supported by this script """ # Delete unused arguments del build_ele del version # Support all versions return True def create_element(build_ele, doc): """ Creation of element (only necessary for the library preview) Args: build_ele: the building element. doc: input document """ del build_ele del doc wall_one_positions = [ [[0,0],[0,5000]], [[0,5000],[5000,5000]], [[5000,5000],[5000,0]], [[5000,0],[0,0]] ] wall_one = draw_walls(wall_one_positions, thickness = 350) wall_two_positions = [ [[6000,0],[6000,10000]], [[6000,10000],[20000, 10000]], [[20000, 10000],[20000, 0]], [[20000, 0],[6000,0]] ] wall_two = draw_walls(wall_two_positions, thickness = 150) model_ele_list = wall_one + wall_two return (model_ele_list, None ) def draw_walls( xy_position, thickness = 350 ): wall_prop = set_wall_properties(thickness) model_ele_list = [] for point in xy_position: start_position = point[0] end_position = point[1] axis = AllplanGeo.Line2D(AllplanGeo.Point2D(start_position[0], start_position[1]),AllplanGeo.Point2D(end_position[0], end_position[1])) model_ele_list.append(AllplanArchElements.WallElement(wall_prop, axis)) return model_ele_list def set_wall_properties(thickness = 350): wall_prop = AllplanArchElements.WallProperties() wall_axis_prop = AllplanArchElements.AxisProperties() wall_axis_prop.Extension = -1 wall_axis_prop.Position = AllplanArchElements.AxisProperties.WallAxisPosition.eFree wall_prop.SetAxis(wall_axis_prop) tier_count = wall_prop.GetTierCount() for tier_index in range(tier_count): wall_tier_prop = wall_prop.GetWallTierProperties(tier_index + 1) wall_tier_prop.SetThickness(thickness) return wall_prop