-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add bash scripts for a no admin rights install * panel minor redesign * update manual install instructions
- Loading branch information
1 parent
4b2e420
commit ccf7176
Showing
203 changed files
with
269 additions
and
183 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,80 @@ | ||
# pyRevitMEP | ||
PyRevitMEP - MEP Extensions for PyRevit | ||
|
||
[![GitHub license](https://img.shields.io/badge/License-GPL3-brightgreen.svg)](https://github.com/Nahouhak/pyRevitMEP/blob/master/LICENSE) | ||
|
||
## Installation | ||
### Automatic | ||
* [Install pyRevit](https://github.com/eirannejad/pyRevit/) | ||
* Use pyRevit Package Manager (pyRevit > Extensions > Enable pyRevitMEP) | ||
### Manual | ||
Prerequisite : [pyRevit](https://github.com/eirannejad/pyRevit/) | ||
* Clone repository in any folder using git (eg. [git-scm](https://git-scm.com/)) | ||
```git | ||
git clone https://github.com/CyrilWaechter/pyRevitMEP.git pyRevitMEP.extension | ||
``` | ||
* Add path containing pyRevitMEP.extension to custom pyRevit folder in pyRevit settings. | ||
|
||
## Update | ||
### Automatic | ||
* Use pyRevit update function | ||
### Manual | ||
* Execute a git pull in your pyRevitMEP.extension folder | ||
```git | ||
git pull | ||
``` | ||
|
||
## [Contribute](https://github.com/CyrilWaechter/pyRevitMEP/blob/master/CONTRIBUTING.md) | ||
|
||
## [Report bugs](https://github.com/CyrilWaechter/pyRevitMEP/issues) | ||
|
||
## Documentation | ||
* [pyRevitMEP on pythoncvc.net](http://pythoncvc.net/?page_id=123) | ||
* [playlist on youtube channel](https://www.youtube.com/channel/UCIsRFoaVQNSl_RlGAZE2mVg/playlists) | ||
|
||
## Credits | ||
* [Ehsan Iran-Nejad](https://github.com/eirannejad) for developing pyRevit | ||
* people which contribute in pyRevit and tools used in pyRevit | ||
* [Icons8](https://icons8.com/) and its contributors for the sweet free icons | ||
* [Inkscape](https://inkscape.org) the great vector drawing software under GPL license which allows me to create missing icons with ease | ||
* Everyone else [listed on the PyRevit Repo](https://github.com/eirannejad/pyRevit/blob/master/README.md#credits) | ||
# pyRevitMEP | ||
PyRevitMEP - MEP Extensions for PyRevit | ||
|
||
[![GitHub license](https://img.shields.io/badge/License-GPL3-brightgreen.svg)](https://github.com/Nahouhak/pyRevitMEP/blob/master/LICENSE) | ||
|
||
## Installation | ||
### Automatic | ||
* [Install pyRevit](https://github.com/eirannejad/pyRevit/) | ||
* Use pyRevit Package Manager (pyRevit > Extensions > Enable pyRevitMEP) | ||
### Manual (no admin rights required) | ||
#### Command lines (Cmder) | ||
* Download [cmder](https://cmder.net/) unzip it anywhere you like | ||
* Clone [pyRevit](https://github.com/eirannejad/pyRevit/) repository using git (skip this step if pyRevit is already installed) | ||
* Destination folder : replace %APPDATA%\pyRevit_git with another destination folder if you like | ||
* --depth=1 allow to only clone last version without full git history | ||
```cmd | ||
git clone https://github.com/eirannejad/pyRevit.git %APPDATA%\pyRevit_git --depth=1 | ||
``` | ||
* Clone [pyRevit MEP](https://github.com/CyrilWaechter/pyRevitMEP) repository pyrevit extensions folder using git | ||
* Destination folder : replace %APPDATA%\pyRevit_git\extensions with pyRevit path from step 1 if custom | ||
* extensions folder is in pyRevit gitignore so it will not affect pyRevit | ||
```cmd | ||
git clone https://github.com/CyrilWaechter/pyRevitMEP.git %APPDATA%\pyRevit_git\extensions\pyRevitMEP.extension --depth=1 | ||
``` | ||
* Create a text file containing following text and save it as pyRevit.addin : | ||
* Replace `#APPDATA\pyrevit_git` with your pyrevit path if custom | ||
```xml | ||
<?xml version="1.0" encoding="utf-8" standalone="no"?> | ||
<RevitAddIns> | ||
<AddIn Type = "Application"> | ||
<Name>PyRevitLoader</Name> | ||
<Assembly>$APPDATA\pyrevit_git\bin\engines\279\pyRevitLoader.dll</Assembly> | ||
<AddInId>B39107C3-A1D7-47F4-A5A1-532DDF6EDB5D</AddInId> | ||
<FullClassName>PyRevitLoader.PyRevitLoaderApplication</FullClassName> | ||
<VendorId>eirannejad</VendorId> | ||
</AddIn> | ||
</RevitAddIns> | ||
``` | ||
* Copy the addin file to your `%APPDATA%\Revit\Addins\2019` (Replace 2019 with your Revit version) | ||
#### Bash script (Cmder) | ||
* Download [latest bash scripts](https://github.com/CyrilWaechter/pyRevitMEP/releases/latest/download/bash.zip) and unzip it anywhere | ||
* Launch Cmder in bash scripts folder and and execute the scripts | ||
* Replace 2019 with your Revit version | ||
```bash | ||
bash pyrevit_install.sh | ||
bash pyrevit_activate.sh 2019 | ||
``` | ||
|
||
## Update | ||
### Automatic | ||
* Use pyRevit update function | ||
### Manual | ||
#### Command line (Cmder) | ||
* Execute a git pull in your pyRevit and pyRevitMEP.extension folders | ||
* -f will force update any modification will be overwritten | ||
```git | ||
git checkout -f | ||
``` | ||
#### Bash script (Cmder) | ||
|
||
* Launch Cmder in bash scripts folder and and execute the script | ||
* Replace 2019 with your Revit version | ||
```bash | ||
bash pyrevit_update.sh | ||
``` | ||
|
||
## [Contribute](https://github.com/CyrilWaechter/pyRevitMEP/blob/master/CONTRIBUTING.md) | ||
|
||
## [Report bugs](https://github.com/CyrilWaechter/pyRevitMEP/issues) | ||
|
||
## Documentation | ||
* [pyRevitMEP on pythoncvc.net](http://pythoncvc.net/?page_id=123) | ||
* [playlist on youtube channel](https://www.youtube.com/channel/UCIsRFoaVQNSl_RlGAZE2mVg/playlists) | ||
|
||
## Credits | ||
* [Ehsan Iran-Nejad](https://github.com/eirannejad) for developing pyRevit | ||
* people which contribute in pyRevit and tools used in pyRevit | ||
* [Icons8](https://icons8.com/) and its contributors for the sweet free icons | ||
* [Inkscape](https://inkscape.org) the great vector drawing software under GPL license which allows me to create missing icons with ease | ||
* Everyone else [listed on the PyRevit Repo](https://github.com/eirannejad/pyRevit/blob/master/README.md#credits) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/bin/bash | ||
# This script will activate pyrevit on a machine with no admin rights | ||
|
||
cd $APPDATA | ||
|
||
echo "Create pyRevit.addin file" | ||
cat << EOF > pyRevit.addin | ||
<?xml version="1.0" encoding="utf-8" standalone="no"?> | ||
<RevitAddIns> | ||
<AddIn Type = "Application"> | ||
<Name>PyRevitLoader</Name> | ||
<Assembly>$APPDATA\pyrevit_git\bin\engines\279\pyRevitLoader.dll</Assembly> | ||
<AddInId>B39107C3-A1D7-47F4-A5A1-532DDF6EDB5D</AddInId> | ||
<FullClassName>PyRevitLoader.PyRevitLoaderApplication</FullClassName> | ||
<VendorId>eirannejad</VendorId> | ||
</AddIn> | ||
</RevitAddIns> | ||
EOF | ||
|
||
echo "Copying pyRevit.addin into "$APPDATA"/Autodesk/Revit/Addins/"$1 | ||
mv pyRevit.addin ./Autodesk/Revit/Addins/$1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/bash | ||
# This script will install pyrevit on a machine with no admin rights | ||
|
||
echo "Start installing pyRevit + pyRevitMEP" | ||
cd $APPDATA | ||
echo "Start cloning pyRevit into "$APPDATA | ||
git clone https://github.com/eirannejad/pyRevit.git pyRevit_git --depth=1 | ||
|
||
echo "Start cloning pyRevitMEP into "$AppData"/pyRevit/extensions/pyRevitMEP.extension" | ||
git clone https://github.com/CyrilWaechter/pyRevitMEP.git pyRevit_git/extensions/pyRevitMEP.extension --depth=1 | ||
|
||
echo "Process completed. Do not forget to activate pyRevit for your Revit version." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/bash | ||
# This script will install pyrevit on a machine with no admin rights | ||
|
||
echo "Start updating pyRevit" | ||
cd $APPDATA/pyRevit_git | ||
git checkout -f | ||
|
||
echo "Start updating pyRevitMEP" | ||
cd extensions/pyRevitMEP.extension | ||
git checkout -f |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Transition | ||
Copy | ||
BatchCreation | ||
CreateSection | ||
QuickDimension |
File renamed without changes.
File renamed without changes
206 changes: 103 additions & 103 deletions
206
...l/ElementChangeLevel.pushbutton/script.py → ...l/ElementChangeLevel.pushbutton/script.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,103 +1,103 @@ | ||
""" | ||
Copyright (c) 2017 Cyril Waechter | ||
Python scripts for Autodesk Revit | ||
This file is part of pypevitmep repository at https://github.com/CyrilWaechter/pypevitmep | ||
pypevitmep is an extension for pyRevit. It contain free set of scripts for Autodesk Revit: | ||
you can redistribute it and/or modify it under the terms of the GNU General Public License | ||
version 3, as published by the Free Software Foundation. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
See this link for a copy of the GNU General Public License protecting this package. | ||
https://github.com/CyrilWaechter/pypevitmep/blob/master/LICENSE | ||
""" | ||
|
||
# noinspection PyUnresolvedReferences | ||
from Autodesk.Revit.DB import Transaction, BuiltInParameter, Element, Level, MEPCurve, ElementId, FamilyInstance\ | ||
, FilteredElementCollector | ||
from pyrevit.forms import WPFWindow | ||
import rpw | ||
from rpw import revit | ||
from pypevitmep.event import CustomizableEvent | ||
|
||
__doc__ = "Change selected elements level without moving it" | ||
__title__ = "Change Level" | ||
__author__ = "Cyril Waechter" | ||
|
||
doc = revit.doc | ||
uidoc = revit.uidoc | ||
|
||
|
||
def get_level_from_object(): | ||
"""Ask user to select an object and retrieve its associated level""" | ||
try: | ||
ref_id = rpw.ui.Pick.pick_element("Select reference object").ElementId | ||
ref_object = doc.GetElement(ref_id) | ||
if isinstance(ref_object, MEPCurve): | ||
level = ref_object.ReferenceLevel | ||
else: | ||
level = doc.GetElement(ref_object.LevelId) | ||
return level | ||
except: | ||
print("Unable to retrieve reference level from this object") | ||
|
||
|
||
def change_level(ref_level): | ||
with rpw.db.Transaction("Change reference level"): | ||
# Change reference level and relative offset for each selected object in order to change reference plane without | ||
# moving the object | ||
selection_ids = uidoc.Selection.GetElementIds() | ||
|
||
for id in selection_ids: | ||
el = doc.GetElement(id) | ||
# Change reference level of objects like ducts, pipes and cable trays | ||
if isinstance(el, MEPCurve): | ||
el.ReferenceLevel = ref_level | ||
|
||
# Change reference level of objects like ducts, pipes and cable trays | ||
elif isinstance(el, FamilyInstance) and el.Host is None: | ||
el_level = doc.GetElement(el.LevelId) | ||
el_level_param = el.get_Parameter(BuiltInParameter.FAMILY_LEVEL_PARAM) | ||
el_param_offset = el.get_Parameter(BuiltInParameter.INSTANCE_FREE_HOST_OFFSET_PARAM) | ||
el_newoffset = el_param_offset.AsDouble() + el_level.Elevation - ref_level.Elevation | ||
el_param_offset.Set(el_newoffset) | ||
el_level_param.Set(ref_level.Id) | ||
# Ignore other objects | ||
else: | ||
print "Warning. Following element was ignored. It is probably an hosted element." | ||
print el | ||
|
||
|
||
customizable_event = CustomizableEvent() | ||
|
||
|
||
class ReferenceLevelSelection(WPFWindow): | ||
""" | ||
GUI used to select a reference level from a list or an object | ||
""" | ||
|
||
def __init__(self, xaml_file_name): | ||
WPFWindow.__init__(self, xaml_file_name) | ||
|
||
self.levels = FilteredElementCollector(doc).OfClass(Level) | ||
self.combobox_levels.DataContext = self.levels | ||
|
||
# noinspection PyUnusedLocal | ||
def from_list_click(self, sender, e): | ||
level = self.combobox_levels.SelectedItem | ||
customizable_event.raise_event(change_level, level) | ||
|
||
# noinspection PyUnusedLocal | ||
def from_object_click(self, sender, e): | ||
selection = uidoc.Selection.GetElementIds() | ||
level = get_level_from_object() | ||
uidoc.Selection.SetElementIds(selection) | ||
customizable_event.raise_event(change_level, level) | ||
|
||
|
||
ReferenceLevelSelection('ReferenceLevelSelection.xaml').Show() | ||
""" | ||
Copyright (c) 2017 Cyril Waechter | ||
Python scripts for Autodesk Revit | ||
This file is part of pypevitmep repository at https://github.com/CyrilWaechter/pypevitmep | ||
pypevitmep is an extension for pyRevit. It contain free set of scripts for Autodesk Revit: | ||
you can redistribute it and/or modify it under the terms of the GNU General Public License | ||
version 3, as published by the Free Software Foundation. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
See this link for a copy of the GNU General Public License protecting this package. | ||
https://github.com/CyrilWaechter/pypevitmep/blob/master/LICENSE | ||
""" | ||
|
||
# noinspection PyUnresolvedReferences | ||
from Autodesk.Revit.DB import Transaction, BuiltInParameter, Element, Level, MEPCurve, ElementId, FamilyInstance\ | ||
, FilteredElementCollector | ||
from pyrevit.forms import WPFWindow | ||
import rpw | ||
from rpw import revit | ||
from pypevitmep.event import CustomizableEvent | ||
|
||
__doc__ = "Change selected elements level without moving it" | ||
__title__ = "Change Level" | ||
__author__ = "Cyril Waechter" | ||
|
||
doc = revit.doc | ||
uidoc = revit.uidoc | ||
|
||
|
||
def get_level_from_object(): | ||
"""Ask user to select an object and retrieve its associated level""" | ||
try: | ||
ref_id = rpw.ui.Pick.pick_element("Select reference object").ElementId | ||
ref_object = doc.GetElement(ref_id) | ||
if isinstance(ref_object, MEPCurve): | ||
level = ref_object.ReferenceLevel | ||
else: | ||
level = doc.GetElement(ref_object.LevelId) | ||
return level | ||
except: | ||
print("Unable to retrieve reference level from this object") | ||
|
||
|
||
def change_level(ref_level): | ||
with rpw.db.Transaction("Change reference level"): | ||
# Change reference level and relative offset for each selected object in order to change reference plane without | ||
# moving the object | ||
selection_ids = uidoc.Selection.GetElementIds() | ||
|
||
for id in selection_ids: | ||
el = doc.GetElement(id) | ||
# Change reference level of objects like ducts, pipes and cable trays | ||
if isinstance(el, MEPCurve): | ||
el.ReferenceLevel = ref_level | ||
|
||
# Change reference level of objects like ducts, pipes and cable trays | ||
elif isinstance(el, FamilyInstance) and el.Host is None: | ||
el_level = doc.GetElement(el.LevelId) | ||
el_level_param = el.get_Parameter(BuiltInParameter.FAMILY_LEVEL_PARAM) | ||
el_param_offset = el.get_Parameter(BuiltInParameter.INSTANCE_FREE_HOST_OFFSET_PARAM) | ||
el_newoffset = el_param_offset.AsDouble() + el_level.Elevation - ref_level.Elevation | ||
el_param_offset.Set(el_newoffset) | ||
el_level_param.Set(ref_level.Id) | ||
# Ignore other objects | ||
else: | ||
print "Warning. Following element was ignored. It is probably an hosted element." | ||
print el | ||
|
||
|
||
customizable_event = CustomizableEvent() | ||
|
||
|
||
class ReferenceLevelSelection(WPFWindow): | ||
""" | ||
GUI used to select a reference level from a list or an object | ||
""" | ||
|
||
def __init__(self, xaml_file_name): | ||
WPFWindow.__init__(self, xaml_file_name) | ||
|
||
self.levels = FilteredElementCollector(doc).OfClass(Level) | ||
self.combobox_levels.DataContext = self.levels | ||
|
||
# noinspection PyUnusedLocal | ||
def from_list_click(self, sender, e): | ||
level = self.combobox_levels.SelectedItem | ||
customizable_event.raise_event(change_level, level) | ||
|
||
# noinspection PyUnusedLocal | ||
def from_object_click(self, sender, e): | ||
selection = uidoc.Selection.GetElementIds() | ||
level = get_level_from_object() | ||
uidoc.Selection.SetElementIds(selection) | ||
customizable_event.raise_event(change_level, level) | ||
|
||
|
||
ReferenceLevelSelection('ReferenceLevelSelection.xaml').Show() |
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes
Oops, something went wrong.