else: active_nic = "" test_ip = "9.9.9.9" udp_conn = System.Net.Sockets.UdpClient(test_ip, 1) local_addr = udp_conn.Client.LocalEndPoint.Address for nic in System.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces( ): ip_props = nic.GetIPProperties() for addr_info in ip_props.UnicastAddresses: if local_addr.ToString() == addr_info.Address.ToString(): active_nic = nic.Description project = os.environ["RVT_QC_PRJ"] model_path = os.environ["RVT_QC_PATH"] pc_stats = os.environ["pc_stats"] rvt_path = FilePath(model_path) ws_conf = WorksetConfiguration(WorksetConfigurationOption.CloseAllWorksets) open_opt = OpenOptions() open_opt.SetOpenWorksetsConfiguration(ws_conf) sync_opt = SynchronizeWithCentralOptions() relinquish_opt = RelinquishOptions(True) sync_opt.SetRelinquishOptions(relinquish_opt) sync_opt.SaveLocalAfter = True # sync_opt.Compact = True sync_opt.Comment = "syncing" trans_opt = TransactWithCentralOptions() print(time_now) print("machine stats:\n{}".format(pc_stats))
with open(move_json_path) as json_map: move_models = json.load(json_map) for model in sorted(move_models): if not os.path.exists(model): print("skipped not existing: {}".format(model)) continue print(35 * "-") model_path = model new_target_path = move_models.get(model) print("this model : {}".format(model_path)) print("will be saved here : {}".format(new_target_path)) rvt_path = FilePath(model_path) rvt_model_path = ModelPathUtils.ConvertUserVisiblePathToModelPath( model_path) print("currently processing: {}".format(model_path)) ws_conf = WorksetConfiguration(WorksetConfigurationOption.CloseAllWorksets) open_opt = OpenOptions() open_opt.Audit = True open_opt.DetachFromCentralOption = DetachFromCentralOption.DetachAndPreserveWorksets open_opt.SetOpenWorksetsConfiguration(ws_conf) save_opt = SaveAsOptions() if os.path.exists(new_target_path): print("warning! overwriting: {}".format(new_target_path)) save_opt.OverwriteExistingFile = True