daily pastebin goal
9%
SHARE
TWEET

Untitled

a guest Mar 20th, 2019 82 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import clr
  2. clr.AddReference("RevitAPI")
  3. import Autodesk
  4. from Autodesk.Revit.DB import *
  5.  
  6. clr.AddReference('ProtoGeometry')
  7. from Autodesk.DesignScript.Geometry import *
  8.  
  9. clr.AddReference("RevitNodes")
  10. import Revit
  11.  
  12. clr.ImportExtensions(Revit.Elements)
  13.  
  14. clr.AddReference("RevitServices")
  15. import RevitServices
  16. from RevitServices.Persistence import DocumentManager
  17. from RevitServices.Transactions import TransactionManager
  18.  
  19. from System.Collections.Generic import *
  20. import math
  21.  
  22. doc = DocumentManager.Instance.CurrentDBDocument
  23.  
  24. clr.ImportExtensions(Revit.GeometryConversion)
  25.  
  26. inn = IN[0]
  27. if not isinstance(inn, list):
  28.      inn = [inn]
  29.  
  30. angle = (IN[1]*math.pi)/180
  31. inc = 304.8
  32. TransactionManager.Instance.EnsureInTransaction(doc)
  33.  
  34. for i in inn:
  35.     elemId = UnwrapElement(i).Id
  36.     try:
  37.         xyz = UnwrapElement(i).Location.Point
  38.         pt1 = Point.ByCoordinates(xyz.X*inc, xyz.Y*inc,xyz.Z*inc)
  39.         pt2 = Point.ByCoordinates(xyz.X*inc, xyz.Y*inc,xyz.Z*inc + 10)
  40.         line = Line.ByStartPointEndPoint(pt1, pt2).ToRevitType()
  41.         Autodesk.Revit.DB.ElementTransformUtils.RotateElement(doc, elemId, line, angle)
  42.         UnwrapElement(i).ToDSType(True)
  43.        
  44.     except:
  45.         elemLine = UnwrapElement(i).Location.Curve.ToProtoType()
  46.         pt1 = elemLine.PointAtParameter(0.5)
  47.         pt2 = Point.ByCoordinates(pt1.X, pt1.Y,pt1.Z + 10)
  48.         line = Line.ByStartPointEndPoint(pt1, pt2).ToRevitType()
  49.         Autodesk.Revit.DB.ElementTransformUtils.RotateElement(doc, elemId, line, angle)
  50.         UnwrapElement(i).ToDSType(True)
  51.  
  52. TransactionManager.Instance.TransactionTaskDone()
  53.  
  54. OUT =  IN[0]
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top