Sample Code Revit Batch Processor 1.1.11 documentation

Contents:

This Page

duHast.Revit.Revisions package

Submodules

duHast.Revit.Revisions.new_revision module

This module contains a number of helper functions relating to creating new revit revisions.

duHast.Revit.Revisions.new_revision.new_revision_action_2022(doc, revision_data)

Creates a new revision in a revit document up to version 2022.

Parameters:
  • doc (Autodesk.Revit.DB.Document) – Current Revit model document.

  • revision_data (revisionData) – Named tuple containing revision data

Returns:

Result class instance.

  • Revision created status returned in result.status. False if an exception occurred, otherwise True.

  • result.message will contain the message revision created successfully.

  • result.result: will contain list with single entry: the new revision created

On exception:

  • result.status (bool) will be False.

  • result.message will contain the exception message.

Return type:

Result

duHast.Revit.Revisions.new_revision.new_revision_action_2023(doc, revision_data)

Creates a new revision in a revit document version 2023 and onwards.

Parameters:
  • doc (Autodesk.Revit.DB.Document) – Current Revit model document.

  • revision_data (revisionData) – Named tuple containing revision data

Returns:

Result class instance.

  • Revision created status returned in result.status. False if an exception occurred, otherwise True.

  • result.message will contain the message revision created successfully.

  • result.result: will contain list with single entry: the new revision created

On exception:

  • result.status (bool) will be False.

  • result.message will contain the exception message.

Return type:

Result

duHast.Revit.Revisions.revisions module

This module contains a number of helper functions relating to Revit revisions.

duHast.Revit.Revisions.revisions.REVISION_DATA

alias of revisionData

duHast.Revit.Revisions.revisions.create_revision(doc, revision_data)

Creates a revision in the document.

Parameters:
  • doc (Autodesk.Revit.DB.Document) – Current Revit model document.

  • revision_data (revisionData) – Named tuple containing revision data

Returns:

Result class instance.

  • Revision created status returned in result.status. False if an exception occurred, otherwise True.

  • result.message will contain the message revision created successfully.

  • result.result: will contain list with single entry: the new revision created

On exception:

  • result.status (bool) will be False.

  • result.message will contain the exception message.

Return type:

Result

duHast.Revit.Revisions.revisions.mark_revision_as_issued(doc, revision)

Sets a revision status to ‘Issued’.

Parameters:
  • doc (Autodesk.Revit.DB.Document) – Current Revit model document.

  • revision (Autodesk.REvit.DB.Revision) – The revision

Returns:

Result class instance.

  • Revision status returned in result.status. False if an exception occurred, otherwise True.

  • result.message will contain the message revision marked as issued successfully.

  • result.result: empty list

On exception:

  • result.status (bool) will be False.

  • result.message will contain the exception message.

Return type:

Result

duHast.Revit.Revisions.revisions.mark_revision_as_issued_by_revision_id(doc, revision_id)

Sets a revision, identified by its id, status to ‘Issued’.

Parameters:
  • doc (Autodesk.Revit.DB.Document) – Current Revit model document.

  • revision_id (Autodesk.Revit.DB.ElementId) – The Id of the revision.

Returns:

Result class instance.

  • Revision marked as issued status returned in result.status. False if an exception occurred, otherwise True.

  • result.message will contain the message revision marked as issued successfully.

  • result.result: empty list

On exception:

  • result.status (bool) will be False.

  • result.message will contain the exception message.

Return type:

Result

duHast.Revit.Revisions.revisions.add_revisions_to_sheet(doc, sheet, revision_ids)

Adds revisions to single sheet

Parameters:
  • doc (Autodesk.Revit.DB.Document) – Current Revit model document.

  • sheet (Autodesk.Revit.DB.SheetView) – The sheet to add the revision to.

  • revision_ids ([Autodesk.Revit.ElementId]) – List of revision ids

Returns:

Result class instance.

  • Revision adding to sheet status returned in result.status. False if an exception occurred, otherwise True.

  • result.message will contain the message revision added to sheet successfully.

  • result.result: empty list

On exception:

  • result.status (bool) will be False.

  • result.message will contain the exception message.

Return type:

Result

duHast.Revit.Revisions.revisions.get_issued_revisions(doc)

Get all issued revisions in a model.

Parameters:

doc (Autodesk.Revit.DB.Document) – Current Revit model document.

Returns:

list of revision objects

Return type:

[Autodesk.Revit.DB.Revision]

duHast.Revit.Revisions.revisions.get_last_issued_revision(doc)

Get the last issued revision from a model.

Parameters:

doc (Autodesk.Revit.DB.Document) – Current Revit model document.

Returns:

A revision object or None if no issued revision in the model

Return type:

Autodesk.Revit.DB.Revision or None

duHast.Revit.Revisions.revisions.change_revision_sequence_number(doc, revision, new_sequence_number)

Updates the revision sequence number of a revision.

Pop the revision from its current index in the revision sequence list. Insert it again at the new index

Parameters:
  • doc (Autodesk.Revit.DB.Document) – Current Revit model document.

  • revision (Autodesk.Revit.DB.Revision) – the revision

  • new_sequence_number (int) – The new index (sequence number ) of the revision. 1 based!!

Returns:

Result class instance.

  • Revision re-ordering status returned in result.status. False if an exception occurred, otherwise True.

  • result.message will contain the message revision re-ordered successfully.

  • result.result: new revision sequence list

On exception:

  • result.status (bool) will be False.

  • result.message will contain the exception message.

duHast.Revit.Revisions.revisions.re_order_revisions(doc, revision_sequence)

Attempts to replace the current revision sequence with the one past in.

Note: both sequences must contain the same revisions…just in a different order.

Parameters:
  • doc (Autodesk.Revit.DB.Document) – Current Revit model document.

  • revision_sequence (IList<ElementId>) – List of revision element ids describing the new sequence.

Returns:

Result class instance.

  • Revision re-ordering status returned in result.status. False if an exception occurred, otherwise True.

  • result.message will contain the message revision re-ordered successfully.

  • result.result: new revision sequence list

On exception:

  • result.status (bool) will be False.

  • result.message will contain the exception message.

Return type:

Result

duHast.Revit.Revisions.revisions.delete_all_revisions_in_model(doc, revision_description_filter=[])

Deletes all revision in file passing filter in one transaction.

Parameters:
  • doc (Autodesk.Revit.DB.Document) – Current model document

  • revision_description_filter (list, optional) – list of filters, defaults to []

Returns:

Result class instance.

  • result.status. True if all possible revisions where deleted successfully, otherwise False.

  • result.message will contain the name(s) of the revisions excluded by filter and number of revisions deleted.

  • result.result empty list

On exception:

  • result.status (bool) will be False.

  • result.message will contain generic exception message.

  • result.result will be empty

Return type:

Result

duHast.Revit.Revisions.sequence module

This module contains a number of helper functions relating to revit revision sequences.

duHast.Revit.Revisions.sequence.get_revision_seq_of_name(doc, revision_sequence_name)

Gets a revision sequence by its name. If no match is found None is returned!

Parameters:
  • doc (Autodesk.Revit.DB.Document) – Current Revit model document.

  • revision_sequence_name (str) – The sequence name

Returns:

The matching sequence or None

Return type:

Autodesk.Revit.DB.RevisionNumberingSequence

duHast.Revit.Revisions.sequence.create_revision_alpha_seq(doc, revision_sequence_name, alpha_settings=Autodesk.Revit.DB.AlphanumericRevisionSettings)

Creates a revision sequence with provided name and settings.

Will throw an exception if sequence creation failed.

Parameters:
  • doc (Autodesk.Revit.DB.Document) – Current Revit model document.

  • revision_sequence_name (str) – The name of the sequence

  • alpha_settings (Autodesk.Revit.DB.AlphanumericRevisionSettings, optional) – Custom settings, defaults to rdb.AlphanumericRevisionSettings()

Returns:

The new sequence.

Return type:

Autodesk.Revit.DB.RevisionNumberingSequence

Module contents