Ejemplo n.º 1
0
def cmd_journal(project_code, model_path, jrn_path, com_dir, log_dir):
    rvt_jrn = rjm.JournalMaker(permissive=False)
    rvt_jrn.open_workshared_model(model_path=model_path,
                                  detached=True,
                                  audit=True)
    rvt_jrn.close_model()
    rvt_jrn.write_journal(jrn_path)
Ejemplo n.º 2
0
def cmd_journal(project_code, model_path, jrn_path, com_dir, log_dir):
    command_path = Path(__file__).parent
    command_name = command_path.name
    time_stamp = datetime.datetime.now().strftime("%Y%m%d_%H%M%S")
    rvt_jrn = rjm.JournalMaker(permissive=False)
    rvt_jrn.open_workshared_model(model_path=model_path,
                                  detached=True,
                                  audit=True)
    com_data = {
        "SearchPaths": command_path,
        "ModelName": model_path.name,
        "OutputPath": log_dir,
        "OutputPrefix": project_code,
        "LogFile":
        log_dir / f"{time_stamp}_{command_name}_rms_exec_results.log",
        "ScriptSource": command_path / "rps_qc_model.py",
    }
    rvt_jrn.execute_command(
        tab_name='Add-Ins',
        panel_name='  Revit Model Services (RMS)  ',
        command_module='RMSCmdExecutor',
        command_class='RMSCmdExecutorCommand',
        command_data=com_data,
    )
    rvt_jrn.close_model()
    rvt_jrn.write_journal(jrn_path)
Ejemplo n.º 3
0
def cmd_journal(project_code, model_path, jrn_path, com_dir, log_dir):
    op.basename(op.dirname(__file__))
    coo_qc_dir = op.join(com_dir, op.basename(op.dirname(__file__)))
    rvt_jrn = rjm.JournalMaker()
    rvt_jrn.open_workshared_model(model_path=model_path,
                                  detached=True,
                                  audit=True)
    rvt_jrn.add_custom_entry(override_jrn_command.format(project_code))
    com_data = {
        "SearchPaths": coo_qc_dir,
        "ModelName": op.basename(model_path),
        "OutputPath": log_dir,
        "OutputPrefix": project_code,
        "LogFile": op.join(log_dir, "rms_exec_results.log"),
        "ScriptSource": op.join(coo_qc_dir, "rps_cookie.py"),
    }
    rvt_jrn.execute_command(
        tab_name='Add-Ins',
        panel_name='  Revit Model Services (RMS)  ',
        command_module='RMSCmdExecutor',
        command_class='RMSCmdExecutorCommand',
        command_data=com_data,
    )
    rvt_jrn.close_model()
    rvt_jrn.write_journal(jrn_path)
Ejemplo n.º 4
0
def create_rir_journal(journal_dir,
                       model_path="",
                       ghdoc_path="",
                       journal_name=DEFAULT_JRN_NAME):
    """Create a new Revit journal to lauch Revit and open Rhino.Inside.Revit

    Args:
        journal_dir (str): directory path to create the journal file inside
        model_path (str, optional): request to open this model in journal
        ghdoc_path (str, optional): request to open this gh document
        journal_name (str, optional): name of the journal file
    """
    # start a clean journal
    # note on `take_default_action=False`
    # activating PerformAutomaticActionInErrorDialog causes an issue when
    # closing a Revit in journal-mode with a modified open document,
    # will cause Revit to automatically hit Yes to the "Do you want to save?"
    # pop up and shows the Save file pop up. Thus, user can not close Revit
    # unless they save the file which could take time depending on the size
    jm = rjm.JournalMaker(permissive=True, take_default_action=False)

    # open model
    if model_path:
        if op.isfile(model_path):
            jm.open_model(model_path)
        else:
            raise Exception(
                "Revit model does not exist: {}".format(model_path))

    # ask to open Rhinoceros tab
    jm.execute_command(
        tab_name="Add-Ins",
        panel_name="Rhinoceros",
        command_module="RhinoInside.Revit.UI",
        command_class="CommandRhinoInside",
    )

    # make sure ghd ocument exists
    cmd_data = {}
    if ghdoc_path:
        if op.isfile(ghdoc_path):
            cmd_data["Open"] = ghdoc_path
        else:
            raise Exception(
                "GH document does not exist: {}".format(ghdoc_path))

    # ask to open Grasshopper
    jm.execute_command(
        tab_name="Rhinoceros",
        panel_name="Grasshopper",
        command_module="RhinoInside.Revit.UI",
        command_class="CommandGrasshopper",
        command_data=cmd_data,
    )

    # write journal to file
    journal_filepath = op.join(journal_dir, journal_name)
    jm.write_journal(journal_filepath)
    return journal_filepath
Ejemplo n.º 5
0
def cmd_journal(project_code, model_path, jrn_path, com_dir, log_dir):
    warnings_dir = op.join(op.dirname(com_dir), "warnings" + os.sep)
    rvt_jrn = rjm.JournalMaker()
    rvt_jrn.open_workshared_model(model_path=model_path,
                                  detached=True,
                                  audit=True)
    rvt_jrn.add_custom_entry(
        override_jrn_command.format(warnings_dir, project_code))
    rvt_jrn.close_model()
    rvt_jrn.write_journal(jrn_path)
Ejemplo n.º 6
0
def cmd_journal(project_code, model_path, jrn_path, com_dir, log_dir):
    command_path = Path(__file__).parent
    warnings_dir = str(command_path) + os.sep
    rvt_jrn = rjm.JournalMaker()
    rvt_jrn.open_workshared_model(model_path=model_path,
                                  detached=True,
                                  audit=True)
    rvt_jrn.add_custom_entry(
        override_jrn_command.format(warnings_dir, project_code))
    rvt_jrn.close_model()
    rvt_jrn.write_journal(jrn_path)
Ejemplo n.º 7
0
def create_rir_journal(journal_dir, model_path='', ghdoc_path='', journal_name=DEFAULT_JRN_NAME):
    """Create a new Revit journal to lauch Revit and open Rhino.Inside.Revit

    Args:
        journal_dir (str): directory path to create the journal file inside
        model_path (str, optional): request to open this model in journal
        journal_name (str, optional): name of the journal file
    """
    # start a clean journal
    jm = rjm.JournalMaker(permissive=True)

    # open model
    if model_path:
        if op.isfile(model_path):
            jm.open_model(model_path)
        else:
            raise Exception("Revit model does not exist: {}".format(model_path))

    # ask to open Rhinoceros tab
    jm.execute_command(
        tab_name='Add-Ins',
        panel_name='Rhinoceros',
        command_module='RhinoInside.Revit.UI',
        command_class='CommandRhinoInside'
        )

    # make sure ghd ocument exists
    cmd_data = {}
    if ghdoc_path:
        if op.isfile(ghdoc_path):
            cmd_data["Open"] = ghdoc_path
        else:
            raise Exception("GH document does not exist: {}".format(ghdoc_path))

    # ask to open Grasshopper
    jm.execute_command(
        tab_name='Rhinoceros',
        panel_name='Grasshopper',
        command_module='RhinoInside.Revit.UI',
        command_class='CommandGrasshopper',
        command_data=cmd_data
        )

    # write journal to file
    journal_filepath = op.join(journal_dir, journal_name)
    jm.write_journal(journal_filepath)
    return journal_filepath
Ejemplo n.º 8
0
def cmd_journal(project_code, model_path, jrn_path, com_dir, log_dir):
    op.basename(op.dirname(__file__))
    com_qc_dir = op.join(com_dir, op.basename(op.dirname(__file__)))
    rvt_jrn = rjm.JournalMaker(permissive=False)
    com_data = {"SearchPaths": com_qc_dir,
                "ModelName": op.basename(model_path),
                "OutputPath": log_dir,
                "OutputPrefix": project_code,
                "LogFile": op.join(log_dir, "rms_exec_results.log"),
                "ScriptSource": op.join(com_qc_dir, "rps_detach_audit_qc.py"),
                }
    rvt_jrn.execute_command(tab_name='Add-Ins',
                            panel_name='  Revit Model Services (RMS)  ',
                            command_module='RMSCmdExecutor',
                            command_class='RMSCmdExecutorCommand',
                            command_data=com_data,
                            )
    rvt_jrn.close_model()
    rvt_jrn.write_journal(jrn_path)
Ejemplo n.º 9
0
# pylama:skip=1
import sys
import os.path as op

testpath = op.dirname(__file__)
sys.path.append(op.dirname(testpath))


import rjm

print('Testing rjm version: {}'.format(rjm.__version__))

journal_maker = rjm.JournalMaker(permissive=True)

# creating a new model (template_name is optional)
journal_maker.new_model(template_name='My Template')

# creating a new template model (template_name is optional)
journal_maker.new_template(template_name='My Template for Templates')

# creating other types
journal_maker.new_family('base_rft_file')
journal_maker.new_conceptual_mass('base_rft_file')
journal_maker.new_titleblock('base_rft_file')
journal_maker.new_annotation('base_rft_file')

# opening workshared model
journal_maker.open_workshared_model('model_full_path',
                                    central=False,
                                    detached=True,
                                    keep_worksets=True,