Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
KellerAndrew committed Apr 20, 2019
1 parent 066e637 commit 7c5a20e
Show file tree
Hide file tree
Showing 4 changed files with 105 additions and 9 deletions.
35 changes: 35 additions & 0 deletions articles/collector.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
Collecting all the (relevant) things!
=====================================

.. toctree::
:maxdepth: 2
:caption: Collecting...things



``Find all elements of a type in active view``
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
OfClass docs:

http://www.revitapidocs.com/2018.1/b0a5f22c-6951-c3af-cd29-1f28f574035d.htm

Autodesk.Revit.DB Namespace, for categories to be filtered:

http://www.revitapidocs.com/2018.1/87546ba7-461b-c646-cbb1-2cb8f5bff8b2.htm


.. code-block:: python
##Where doc = __revit__.ActiveUIDocument.Document
elementList = DB.FilteredElementCollector(doc, selected_view.Id)\
.OfClass(DB.IndependentTag)\
.ToElements()

Another collecting walls:

.. code-block:: python
collector = FilteredElementCollector(doc)\
.OfCategory(BuiltInCategory.OST_Walls)\
.WhereElementIsNotElementType()\
.ToElements()
42 changes: 41 additions & 1 deletion articles/elements.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,44 @@ Dealing With Elements
^^^^^^^^^^^^^^^^^^^^^^^^
.. code-block:: python
elementId = element.Id
elementId = element.Id
``Get a property of an element``
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. code-block:: python
##The orientation property of a wall returns a normalvector
##Showing which way the wall's external side is facing.
normalvector = wall.Orientation
``Query an element for it's mark or other parameter``
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. code-block:: python
##Mark can be replaced by any parameter the element has.
##http://www.revitapidocs.com/2018.1/0cf342ef-c64f-b0b7-cbec-da8f3428a7dc.htm
##This one returns a list, even if only one element
markString = element.GetParameter("Mark")
##Or... Returns the first match (order may be random or change)
markString = element.LookupParameter("Mark").AsString()
##Or... This is mark for everything but doors. DOOR_NUMBER for doors.
##Other built in parameters:
##http://www.revitapidocs.com/2018.1/fb011c91-be7e-f737-28c7-3f1e1917a0e0.htm
markString = element.getParameter(BuiltInParameter.ALL_MODEL_MARK)
24 changes: 24 additions & 0 deletions articles/location.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Locations, Coordinates, Levels
==============================

.. toctree::
:maxdepth: 2
:caption: Locations, Coordinates, Levels



``Location of point elements``
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. code-block:: python
##Grabbing Min and Max points of a crop box
maxXYZ = revit.activeview.CropBox.Max
minXYZ = revit.activeview.CropBox.Min
##http://www.revitapidocs.com/2018.1/c2fd995c-95c0-58fb-f5de-f3246cbc5600.htm
##individual double for each coord
minX = minXYZ.X
minY = minXYZ.Y
minZ = minXYZ.Z
13 changes: 5 additions & 8 deletions index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,14 @@ PyRevit Snippets
Just some samples of code I use in PyRevit. Your miles may vary.

* :doc:`articles/elements`
* :doc:`articles/collector`
* :doc:`articles/location`

.. toctree::
:maxdepth: 2
:caption: Contents:

articles/elements.rst


Indices and tables
==================

* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
articles/collector.rst
articles/location.rst

0 comments on commit 7c5a20e

Please sign in to comment.