Skip to content

Instantly share code, notes, and snippets.

@rdapaz
Created September 1, 2020 02:36
Show Gist options
  • Save rdapaz/7dd7d517edbf1cfec92198750ec99019 to your computer and use it in GitHub Desktop.
Save rdapaz/7dd7d517edbf1cfec92198750ec99019 to your computer and use it in GitHub Desktop.
Add Visio Guides
import win32com.client as c
vsApp = c.gencache.EnsureDispatch('Visio.Application')
vsApp.Visible = True
path = r'https://woodsideenergy-my.sharepoint.com/personal/ricardo_dapaz_woodside_com_au/Documents/Desktop/ABB Transmittal-AU-33220002-AUABB-WSE-00001/LNADs/VA6000DJ0076.XXX1~.vsd'
dwg = vsApp.Documents.Open(path)
pge = dwg.Pages('Drawing')
x_diff = 144.64
x_steps = 24.0
x_step_diff = float(x_diff/x_steps)
x_start_step = 9.84
for n in range(int(x_steps)+1):
pge.AddGuide(Type=3, xPos=x_start_step + n*x_step_diff, yPos=75.0)
y_diff = 62.69
y_steps = 8.0
y_step_diff = float(y_diff/y_steps)
y_start_step = 102.16
for n in range(int(y_steps)+1):
pge.AddGuide(Type=2, xPos=100.0, yPos=y_start_step - n*y_step_diff)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment