Jump to content
JasonTaylor

Callout Active Database by API

Recommended Posts

I don't believe this is directly accessible via Vectorscript or Pythonscript.

 

A potential work around would be a multi-file system and use the OS to make the switch.

 

Set VW to us MyActiveDatabase.XML

 

When you need to switch databases, use the standard Python file handling routines to save MyActiveDatabase as DatabaseOne and then rename (or copy) DatabaseTwo to MyActiveDatabase.

 

Or this might not work as MyActiveDatabase might be one of those things that is only read in at initial load time or when manually changed.

 

Probably worth the 15 minutes to try it.

Share this post


Link to post

Got an official response

import vs
import os
import webbrowser
from tkinter import Tk

def execute():	
	vs.AlrtDialog( 'This script will set a different Callout database per Vectorworks file. Specify xml file in the next dialog.' )
	
	title = 'Select xml database file...';
	defaultFolder = vs.GetFolderPath(14) + 'Notes';
	mask = 'xml';
	
	ok, fileName = vs.GetFileN(title, defaultFolder, mask)

	if ok:
		gObjName = 'Callout'
	
		h = vs.GetObject(gObjName)					

		vs.SetRField( h, gObjName, 'Link To Database', 'True' )
		vs.SetRField( h, gObjName, '__dbName', fileName )
		vs.SetRField( h, gObjName, '__dbUUID', '{F2920FA1-ADE2-4ECA-A796-71FA67CD89E7}')
		
		vs.AlrtDialog( 'Assigned an xml file as Callout database per Vectorworks file' )
		
execute()

 

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

 

7150 Riverwood Drive, Columbia, Maryland 21046, USA   |   Contact Us:   410-290-5114

 

© 2018 Vectorworks, Inc. All Rights Reserved. Vectorworks, Inc. is part of the Nemetschek Group.

×