pyrevitlabs / pyRevit

Rapid Application Development (RAD) Environment for Autodesk Revit®
http://wiki.pyrevitlabs.io
GNU General Public License v3.0
1.32k stars 335 forks source link

Remove Undelay does not work on Revit 2017.2 #226

Closed blackkoffie closed 7 years ago

blackkoffie commented 7 years ago

Hi,

I work with the Revit 2017.2 (17.0.1128.0 20170419_0315(x64) 2017.2.1 ) Is there a way you can fix this for me?

image

fbe-work commented 7 years ago

Yes, the underlay works different in 2017. It could now be switched off via:

element.SetUnderlayRange(ElementId(-1), ElementId(-1))

Obviously it needs to check for the version first: There is a fix in PR 227 , in case you need it before @eirannejad merges after review..

eirannejad commented 7 years ago

Resolved. Thanks @hdm-dt-fb for the fix and PR

blackkoffie commented 7 years ago

Hi,

I changed the script .. But does not work, getting the error:

Can you see what goes wrong?

import clr clr.AddReference('RevitAPI') clr.AddReference('RevitAPIUI')

from Autodesk.Revit.UI import TaskDialog from Autodesk.Revit.DB import Transaction from Autodesk.Revit.DB import ElementId from Autodesk.Revit.DB import BuiltInParameter, BuiltInCategory

doc = revit.ActiveUIDocument.Document uidoc = revit.ActiveUIDocument

selection = uidoc.Selection selection_ids = selection.GetElementIds()

if selection_ids.Count > 0: t = Transaction(doc, 'Batch Set Underlay to None') t.Start()

for element_id in selection_ids: element = doc.GetElement(element_id) if element.Category.Id.IntegerValue == int(BuiltInCategory.OST_Views) \ and (element.CanBePrinted): p = element.get_Parameter(BuiltInParameter.VIEW_UNDERLAY_ID) if p is not None: element.SetUnderlayRange(ElementId(-1), ElementId(-1))

t.Commit() else: TaskDialog.Show('Remove Underlay', 'Select Views to Remove Underlay')

On 09 Aug, 2017, at 03:25 PM, hdm-dt-fb notifications@github.com wrote:

yes, the underlay works different in 2017. It could now be switched off via: element.SetUnderlayRange(ElementId(-1), ElementId(-1)) — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

fbe-work commented 7 years ago

This does not seem to be the latest version with the rvt-version check. If you update pyRevit you should have it. If that is currently not possible for you, find the current version here:

https://github.com/eirannejad/pyRevit/blob/23001c05d6d6946db4288de31c53623f9ff004ae/extensions/pyRevitTools.extension/pyRevit.tab/Drawing%20Set.panel/views.stack3/Views.pulldown/Remove%20Underlay%20From%20Selected%20Views.pushbutton/script.py

As a hint for future code snippets:
If you paste them, put them in between triple back ticks, then formatting gets not lost.

eirannejad commented 7 years ago

@hdm-dt-fb Apparently he's replied in email so markdown is not supported. I didn't know that. Thanks for the response btw

fbe-work commented 7 years ago

ouh I did not know that is possible.. yep you're welcome!

blackkoffie commented 7 years ago

Thanks Guys, sorry for replying on the email. I'll test it soon.

eirannejad commented 7 years ago

@rbaggen No need for the apology man. We do reply in emails all the time. We just didn't know the formatting doesn't work from emails Thanks for reporting the issue 👍