def __init__(self): try: self.uiapp = __revit__ self._host = Revit.HOSTS.RPS except NameError: try: # Try Getting handler from Dynamo RevitServices self.uiapp = self.find_dynamo_uiapp() self._host = Revit.HOSTS.DYNAMO except Exception as errmsg: logger.warning('Revit Application handle could not be found') try: # Add DB UI Import to globals so it can be imported by rpw clr.AddReference('RevitAPI') clr.AddReference('RevitAPIUI') from Autodesk.Revit import DB, UI globals().update({'DB': DB, 'UI': UI}) except Exception: # Replace Globals with Mock Objects for Sphinx and ipy direct exec. logger.warning('RevitAPI References could not be added') from rpw.utils.sphinx_compat import MockObject globals().update({'DB': MockObject(fullname='Autodesk.Revit.DB'), 'UI': MockObject(fullname='Autodesk.Revit.DB')}) self.uiapp = MockObject(fullname='Autodesk.Revit.UI.UIApplication') self._host = None
def find_dynamo_uiapp(self): clr.AddReference("RevitServices") import RevitServices from RevitServices.Persistence import DocumentManager import sys sys.path.append(r'C:\Program Files (x86)\IronPython 2.7\Lib') return DocumentManager.Instance.CurrentUIApplication
>>> file3dm.Objects.AddLine(line1) >>> filepath = 'c:/folder/test.3dm' >>> file3dm.Write(filepath, file3md_options) .. note:: Although the openNURBS toolkit appears to be a full-featured geometry library, it is not. The toolkit does not include a number of important features, including: * Closest point calculations * Intersection calculations * Surface tessellation (meshing) * Interpolation * Booleans * Area and mass property calculations * Other miscellaneous geometry calculations [ Note from McNeel's website on openNURBS ] More Information about openNURBES in the links below: * `Github Repo <https://github.com/mcneel/rhinocommon/tree/rhino3dmio>`_ * `RhinoCommon API <http://developer.rhino3d.com/api/>`_ * `openNURBS <http://developer.rhino3d.com/guides/opennurbs/what-is-opennurbs/>`_ """ from rpw.utils.dotnet import clr clr.AddReference('Rhino3dmIO') import Rhino
""" Consolidate all imports and resources for other forms based classes to use. """ # import sys from abc import ABCMeta from rpw import revit from rpw.utils.dotnet import clr from rpw.utils.logger import logger # WPF/Form Imports clr.AddReference("PresentationFramework") # System.Windows: Controls, ? clr.AddReference("WindowsBase") # System.Windows.Input clr.AddReference("System.Drawing") # FontFamily clr.AddReference('System.Windows.Forms') # Forms import System.Windows from System.Windows import Window from System.IO import StringReader # Console from System.Environment import Exit, NewLine from System.Drawing import FontFamily from System.Windows.Input import Key # FlexForm Imports from System.Windows import Controls, Window from System.Windows import HorizontalAlignment, VerticalAlignment, Thickness