Advertisement
IvaSerge

Untitled

Aug 27th, 2016
503
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.24 KB | None | 0 0
  1. import clr
  2.  
  3. #Import RevitAPI
  4. clr.AddReference("RevitAPI")
  5. import Autodesk
  6. from Autodesk.Revit.DB import *
  7.  
  8. clr.AddReference('ProtoGeometry')
  9. from Autodesk.DesignScript.Geometry import *
  10.  
  11. # Import DocumentManager and TransactionManager
  12. clr.AddReference("RevitServices")
  13. import RevitServices
  14. from RevitServices.Persistence import DocumentManager
  15. from RevitServices.Transactions import TransactionManager
  16.  
  17. doc = DocumentManager.Instance.CurrentDBDocument
  18. uiapp = DocumentManager.Instance.CurrentUIApplication
  19. app = uiapp.Application
  20.  
  21. #координаты точки задаются в футах!
  22. pointXYZ1 = XYZ(0, 0, 0)    
  23. pointXYZ2 = XYZ(0, 0, 0.01)
  24. #создаем нужную точку
  25. p1 = app.Create.NewPoint(pointXYZ1)
  26. p2 = app.Create.NewPoint(pointXYZ2)
  27.  
  28. #Создаем линию.
  29. #ВОПРОС: почему не работает импорт в строке 6?
  30. #Комманда в строке ниже выдает ошибку
  31. #ln = Line.CreateBound(pointXYZ1, pointXYZ2)
  32. ln = Autodesk.Revit.DB.Line.CreateBound(pointXYZ1, pointXYZ2)
  33.  
  34. OUT = p1.ToProtoType(), p2.ToProtoType(), ln.ToProtoType()
  35. #Вывод можно переписать через лямбду :-)
  36. #OUT = map(lambda x: x.ToProtoType(), (p1, p2, ln))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement