Giter VIP home page Giter VIP logo

rvt_model_services's Introduction

rvt_model_services

python micro framework to process actions on revit models from cli/command line

how it works:

  • you initialize it with a command to process_model.py specifying the task, revit model and an optional timeout.
  • process_model.py will spin off a subprocess to write a journal file and addin according to your specified task and project.
  • it will then run Revit according to this journal file, opening a detached version of your model and run the specified action like a revitpythonshell script.
  • if the journal file cannot be run to completion the subprocess is killed and an error is logged. the logging journal file will be parsed and a notify email will inform you in case the model is corrupt.

it requires/is currently run on:

  • cpython >= 3.6 (with additional modules: beautifulsoup4, bokeh, colorama, colorful, docopt, numpy, pandas, psutil, olefile)
  • revitpythonshell >= 2017.03.07
  • Autodesk Revit® (currently tested on versions 2015.7, 2016.2, 2017.2)
  • see install_guide for help/further information.

how to get started:

  • when the above mentioned requirements are met and this repo is cloned to your preferred path lets get started with a common task (read qc stats (qc meaning "quality check" in this context)) in three steps:

  • step 1: create a revitpythonshell button
    setup in RPS:
    in your targeted Revit version add a RPS button "model_qc": "Add-Ins > RevitPythonShell > Configure", Add: Name: qc_model, Group: rvt_model_services Path: X:\your_path_to_the_cloned_repo\rvt_model_services\commands\qc\rps_qc_model.py restart Revit to check if the Button appears. click on it to see if the message window appears and gives you a few stats on the current model.

  • step 2: run a qc read out from cli
    run process_model.py from command line: now we can run the qc_model without even touching Revit and get interactive html graphs produced. Compose a command consisting of the following:

    your CPython interpreter
    your path to process_model.py
    command type
    project name
    full path to the project Revit model
    a timeout for the process (optional - default is 60 seconds)

    so it could look like this:

    "C:\Program Files\Python36\python.exe"
    D:/testrun/934_rvt_model_services/process_model.py
    qc
    123_N
    D:/testmodel/123_N.rvt
    --timeout 600

    Just concatenate it (put it into one line).
    Open a command line ("Win > type 'cmd'") paste it in("right-click > paste") and run it.
    If you want to write the html to another directory you can use the optional switch "--html_path" followed by a path. Here is how this looks on my screen:

    cmder_screenshot

  • step 3: let task scheduler repeat your task
    for recurring tasks hook it up to Windows® task scheduler: Open Task scheduler and create a new basic task
    - give it a name
    - set your interval rate e.g. daily
    - set your start time
    - action: start program:
    Program/Script:
    "C:\Program Files\Python36\python.exe"
    Add Arguments:
    D:/testrun/934_rvt_model_services/process_model.py qc 123_N D:/testmodel/123_N.rvt --timeout 600
    - Finish and test if it works: "Right-Click > Run"

typical use cases(recurring tasks run via schedule Task Scheduler):

  • extraction of qc data to be gathered in csv table and visualized on interactive html graphs using bokeh
  • check on model corruption with audit canary
  • export of DWF, DWG, PDF or IFC (so far only DWF export implemented)
  • export model warnings (API-less journal file warnings export)

currently implemented tasks:

  • qc: rvt model qc statistics on workshared models

    qc_elements_graph

  • dwf: dwf sheet exports of sheet set "Auto_PDF_DWF" on workshared models

  • warnings: model warnings export on workshared models

    warnings_graph

  • pulse: bokeh graph showing the job log graphically(which project was process in what time, did it timeout -> red bar).
    run separately from process_model with: "python bokeh_pulse.py" from commands/pulse/ directory.

    pulse_graph

  • audit: bokeh graph showing the rusult of models being opened with "audit".
    if configured an email will be sent if the model is corrupt. see readme for email config guide in notify/email/
    success: green, unclassified error:orange, corrupt model: red.
    run separately from process_model with: "python bokeh_pulse.py" from commands/pulse/ directory.

    pulse_graph

how to extend:

  • rvt_model_services was created with extendibility in mind. if you wish to extend the functionality, just create a folder with the name of your custom command. place a init.py in it as you can find it in the other built-in commands. in this init file you would define your command name request rps script buttons and be able to overwrite addin and journal template.
  • in the spirit of cookiecutter I will soon provide a custom command directory which can be used as a template for your custom action.
  • if you want to share something, that might be useful to many others feel free to PR.

limitations:

  • of journal files:
    • no white spaces in model path
    • no non-ascii characters in model path
    • task will not run to completion if confronted with any unexpected messages
  • of this framework:
    • do not schedule overlapping readouts, the simple pandas code is not (yet) prepared to handle this in the graphs

credits

note: If you are not on this list, but believe you should be, please contact me!

license

MIT

rvt_model_services's People

Contributors

pix3lot avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.