Skip to content

Commit 9c808a2

Browse files
committed
2 parents 110ba3d + 2a8ebbb commit 9c808a2

File tree

3 files changed

+61
-2
lines changed

3 files changed

+61
-2
lines changed

LICENSE.md

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
MIT License
2+
3+
Copyright (c) 2021 Tibor Lorántfy
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6+
7+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8+
9+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

README.md

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Ready-to-go Python scripts for Archicad
2+
3+
[Download version 25.2](https://github.com/tlorantfy/archicad-python-scripts/archive/refs/tags/25.2.zip)
4+
5+
## recurring_publish.py
6+
7+
### Description
8+
The script can schedule recurring publishing.
9+
The related Archicad project must be opened before executing the script, because the script retrieves the projectdata during the start-up of the script.
10+
11+
### Requirements
12+
* **Requires Archicad 25 or later.**
13+
* [Additional JSON/Python Commands Add-On](https://github.com/tlorantfy/archicad-additional-json-commands) (version 25.2 or later) is required to be loaded into Archicad.
14+
* [Download the Add-On for Windows](https://github.com/tlorantfy/archicad-additional-json-commands/releases/download/25.2/archicad-additional-json-commands.apx)
15+
* [Download the Add-On for macOS](https://github.com/tlorantfy/archicad-additional-json-commands/releases/download/25.2/archicad-additional-json-commands.bundle.zip)
16+
17+
### Features
18+
19+
* Archicad will be shut down after each publishing and it will be restarted before each publishing, the project will be reloaded automatically.
20+
* User can choose from the Publisher Sets. Only the selected sets will be published. Multiple choice is available.
21+
* Recur time can be set in minutes.
22+
* Continuous progress report, the remaining time till the next publishing countdown appears.
23+
* Works for Teamwork (BIMcloud) projects also. A receive command is executed before each publishing.
24+
25+
### Usage
26+
27+
1. Running Archicad instance is required with an opened project and loaded [Additional JSON/Python Commands Add-On](https://github.com/tlorantfy/archicad-additional-json-commands/releases).
28+
2. Run recurring_publish.py script from command line and with using python launcher.
29+
3. Select Publisher Sets to publish.
30+
4. Set time (in minutes) for recurring.
31+
5. Click Start button.
32+
33+
### Demo video
34+
Click to watch the demo video:
35+
[![recurring_publish.py](https://j.gifs.com/lRY80V.gif)](https://ttprivatenew.s3.amazonaws.com/pulse/lorantfyt/attachments/16911630/archicad_recurring_publish_demo.mp4)

recurring_publish.py

+17-2
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@
22
import re
33
import tkinter as tk
44
import subprocess
5+
import platform
56
from archicad import ACConnection
67
from tkinter import filedialog, messagebox
78
from datetime import datetime, timedelta
89
from threading import Timer
910

1011
################################ CONFIGURATION #################################
11-
dialogSize = '800x450'
12+
dialogSize = '800x480'
1213
dialogTitle = 'Recurring Publish'
1314
textProject = 'Project:'
1415
textTeamworkUsername = 'Username:'
@@ -74,10 +75,24 @@ def CheckAdditionalJSONCommands ():
7475
messagebox.showerror (errorMessageTitleAdditionalCommandsNotFound, errorMessageDetailsAdditionalCommandsNotFound)
7576
exit ()
7677

78+
def IsUsingMacOS ():
79+
return platform.system () == 'Darwin'
80+
81+
def IsUsingWindows ():
82+
return platform.system () == 'Windows'
83+
84+
def EscapeSpacesInPath (path):
85+
if IsUsingWindows ():
86+
return f'"{path}"'
87+
else:
88+
return path.replace (' ', '\\ ')
89+
7790
def GetArchicadLocation ():
7891
response = acc.ExecuteAddOnCommand (act.AddOnCommandId ('AdditionalJSONCommands', 'GetArchicadLocation'))
7992
if not response or 'archicadLocation' not in response:
8093
messagebox.showerror (errorMessageTitleCommandExecutionFailed, response)
94+
if IsUsingMacOS ():
95+
return f"{response['archicadLocation']}/Contents/MacOS/ARCHICAD"
8196
return response['archicadLocation']
8297

8398
def GetProjectInfo ():
@@ -136,7 +151,7 @@ def RestartArchicad (self):
136151
ReconnectToArchicad ()
137152
global conn
138153
if not conn:
139-
subprocess.Popen ([archicadLocation, projectInfo['projectLocation']], start_new_session=True)
154+
subprocess.Popen (f"{EscapeSpacesInPath (archicadLocation)} {EscapeSpacesInPath (projectInfo['projectLocation'])}", start_new_session=True, shell=True)
140155
while not conn:
141156
ReconnectToArchicad ()
142157

0 commit comments

Comments
 (0)