Sample Code Revit Batch Processor 1.1.15 documentation

Contents:

This Page

duHast.Revit.Family.Geometry package

Submodules

duHast.Revit.Family.Geometry.extrusion_create module

Revit extrusion create helper functions

These functions work within a Revit family document to create and manipulate extrusions.

duHast.Revit.Family.Geometry.extrusion_create.create_extrusion(doc, sketch_plane, curve_loops, func, height=100, transaction_manager=<function in_transaction>)

Create a new extrusion in the family document using the provided curve loops.

Parameters:
  • doc (Autodesk.Revit.DB.Document) – The family document.

  • sketch_plane (Autodesk.Revit.DB.SketchPlane) – The sketch plane to use for the new extrusion.

  • curve_loops (list of Autodesk.Revit.DB.CurveLoop) – The curve loops to use for the new extrusion.

  • func (function) – A function to execute on the new extrusion. ( need to take the doc and the new extrusion as arguments and need to return a Result class instance)

  • transaction_manager (function) – A function to manage transactions. (default is in_transaction)

Returns:

Result class instance.

  • result.status (bool): True if the extrusion was created successfully, otherwise False.

  • result.message (str): Confirmation of successful creation of the extrusion.

  • result.result (list): The new extrusion element.

On exception:
  • result.status (bool): False.

  • result.message (str): Generic exception message.

  • result.result (list): Empty.

Return type:

Result

duHast.Revit.Family.Geometry.extrusion_create.create_extrusion_on_level(doc, level, curve_loops, func, height=100, transaction_manager=<function in_transaction>)

Create a new extrusion in the family document on the level provided using the provided curve loops.

Parameters:
  • doc (Autodesk.Revit.DB.Document) – The family document.

  • level (Autodesk.Revit.DB.Level) – The level to use for the new extrusion.

  • curve_loops (list of Autodesk.Revit.DB.CurveLoop) – The curve loops to use for the new extrusion.

  • func (function) – A function to execute on the new extrusion. ( need to take the doc and the new extrusion as arguments and need to return a Result class instance)

  • transaction_manager – A function to manage transactions. (default is in_transaction)

Returns:

Result class instance.

On exception:
  • result.status (bool): False.

  • result.message (str): Generic exception message.

  • result.result (list): Empty.

Return type:

Result

duHast.Revit.Family.Geometry.extrusion_create.associate_extrusion_height_with_parameter(doc, extrusion, height_parameter_name, transaction_manager=<function in_transaction>)

Set the height parameter of an extrusion to a parameter in the family.

Parameters:
  • doc (Autodesk.Revit.DB.Document) – The family document.

  • extrusion (Autodesk.Revit.DB.Extrusion) – The extrusion element.

  • height_parameter_name (str) – The name of the height parameter in the family.

Returns:

Result class instance.

  • result.status (bool): True if the extrusion height parameter was set successfully, otherwise False.

  • result.message (str): Confirmation of successful setting of the extrusion height parameter.

  • result.result (list): The new extrusion element.

On exception:
  • result.status (bool): False.

  • result.message (str): Generic exception message.

  • result.result (list): Empty.

Return type:

Result

duHast.Revit.Family.Geometry.extrusion_create.set_extrusion_sub_category(doc, extrusion, source_graphic_style, transaction_manager=<function in_transaction>)

Set the subcategory of an extrusion in a family document. The subcategory is set to the subcategory of the source 3D graphic style.

Parameters:
  • doc (Autodesk.Revit.DB.Document) – The family document.

  • extrusion (Autodesk.Revit.DB.Extrusion) – The extrusion element.

  • source_graphic_style (Autodesk.Revit.DB.GraphicStyle) – The graphic style of the source extrusion.

Returns:

Result class instance.

  • result.status (bool): True if the extrusion subcategory was set successfully, otherwise False.

  • result.message (str): Confirmation of successful setting of the extrusion subcategory.

  • result.result (list): Empty.

On exception:
  • result.status (bool): False.

  • result.message (str): Generic exception message.

  • result.result (list): Empty.

Return type:

Result

duHast.Revit.Family.Geometry.symbolic_curve_create module

Revit symbolic curve create helper functions

These functions work within a Revit family document to create and manipulate symbolic curves.

duHast.Revit.Family.Geometry.symbolic_curve_create.create_symbolic_curves_by_curve_loop(doc, sketch_plane, curve_loop, func, transaction_manager=<function in_transaction>)

Create new symbolic curves in the family document using the provided curve loop.

Parameters:
  • doc (Autodesk.Revit.DB.Document) – The family document.

  • sketch_plane (Autodesk.Revit.DB.SketchPlane) – The sketch plane to use for the new curve(s).

  • curve_loop (Autodesk.Revit.DB.CurveLoop) – The curve loop to use for the new curve(s).

  • func (function) – A function to execute on the new curves. ( need to take the doc and a single new curves as arguments and need to return a Result class instance)

  • transaction_manager (function) – A function to manage transactions. (default is in_transaction)

Returns:

Result class instance.

  • result.status (bool): True if the symbolic curves where created successfully, otherwise False.

  • result.message (str): Confirmation of successful creation of the symbolic curves.

  • result.result (list): The new symbolic curve elements.

On exception:

  • result.status (bool): False.

  • result.message (str): Generic exception message.

  • result.result (list): Empty.

Return type:

Result

duHast.Revit.Family.Geometry.symbolic_curve_create.create_symbolic_curves_on_level(doc, level, curve_loop, func, transaction_manager=<function in_transaction>)

Create a new symbolic curves in the family document on the level provided using the provided curve loop.

Parameters:
  • doc (Autodesk.Revit.DB.Document) – The family document.

  • level (Autodesk.Revit.DB.Level) – The level to use for the new symbolic curves.

  • curve_loops (Autodesk.Revit.DB.CurveLoop) – The curve loop to use for the new symbolic curves.

  • func (function) – A function to execute on the new symbolic curves. ( need to take the doc and a new symbolic curve as arguments and need to return a Result class instance)

  • transaction_manager – A function to manage transactions. (default is in_transaction)

On exception:

  • result.status (bool): False.

  • result.message (str): Generic exception message.

  • result.result (list): Empty.

Return type:

Result

duHast.Revit.Family.Geometry.symbolic_curve_create.set_symbolic_curve_sub_category(doc, curve, source_graphic_style, transaction_manager=<function in_transaction>)

Set the subcategory of an symbolic curve in a family document. The subcategory is set to the subcategory of the source projection graphic style.

Parameters:
  • doc (Autodesk.Revit.DB.Document) – The family document.

  • curve (Autodesk.Revit.DB.Curve) – The curve element.

  • source_graphic_style (Autodesk.Revit.DB.GraphicStyle) – The graphic style of the source curve.

Returns:

Result class instance.

  • result.status (bool): True if the curve subcategory was set successfully, otherwise False.

  • result.message (str): Confirmation of successful setting of the curve subcategory.

  • result.result (list): Empty.

On exception:
  • result.status (bool): False.

  • result.message (str): Generic exception message.

  • result.result (list): Empty.

Return type:

Result

duHast.Revit.Family.Geometry.utils module

Revit common family element helper functions

These functions work within a Revit family document to create and manipulate elements.

duHast.Revit.Family.Geometry.utils.set_element_sub_category(doc, element, source_graphic_style, source_graphic_style_key, transaction_manager=<function in_transaction>)

Set the subcategory of an element in a family document. The subcategory is set to the subcategory of the source projection graphic style.

Parameters:
  • doc (Autodesk.Revit.DB.Document) – The family document.

  • element (Autodesk.Revit.DB.Element) – The element.

  • source_graphic_style (Autodesk.Revit.DB.GraphicStyle) – The graphic style of the source curve.

  • source_graphic_style_key (str) – The key of the graphic style to set. (e.g. “Projection”, “Cut”, “3D”)

Returns:

Result class instance.

  • result.status (bool): True if the elements subcategory was set successfully, otherwise False.

  • result.message (str): Confirmation of successful setting of the elements subcategory.

  • result.result (list): Empty.

On exception:
  • result.status (bool): False.

  • result.message (str): Generic exception message.

  • result.result (list): Empty.

Return type:

Result

duHast.Revit.Family.Geometry.utils.set_curve_sub_category(doc, element, source_graphic_style, transaction_manager=<function in_transaction>)

Set the subcategory of a curve in a family document. ( its really the graphic style…) The subcategory is set to the subcategory of the source projection graphic style.

Parameters:
  • doc (Autodesk.Revit.DB.Document) – The family document.

  • element (Autodesk.Revit.DB.Element) – The element.

  • source_graphic_style (Autodesk.Revit.DB.GraphicStyle) – The graphic style of the source curve.

  • transaction_manager (function) – The transaction manager.

Returns:

Result class instance. - result.status (bool): True if the elements subcategory was set successfully, otherwise False. - result.message (str): Confirmation of successful setting of the elements subcategory. - result.result (list): Empty.

On exception:

  • result.status (bool): False.

  • result.message (str): Generic exception message.

  • result.result (list): Empty.

Return type:

Result

Module contents