VCOM:VectorWorks:Scripting:IPythonScriptEngine

From Vectorworks Developer
Jump to navigation Jump to search

Description

namespace VectorWorks::Scripting

This class provides the ability for a plug-in to compile and execute Python scripts.

Interface

// ---------------------------------------------------------------------------------------------------
// {473B0000-869A-4E12-86C9-056EFC87871B}
static const VWIID IID_PythonScriptEngine = { 0x473b0000, 0x869a, 0x4e12, { 0x86, 0xc9, 0x5, 0x6e, 0xfc, 0x87, 0x87, 0x1b } };

class IPythonScriptEngine : public IVWSingletonUnknown
{
public:
	virtual VCOMError VCOM_CALLTYPE CompileScript(const TXString& script,
													bool inShouldDisplayDialogs,
													bool& outWasCompiledSuccessfully,
													Sint32* outLineNumberOfSelectedError, /* optional. Pass NULL if not desired */
													TXString* outErrorText /* optional. Pass NULL if not desired */) = 0;

	virtual VCOMError VCOM_CALLTYPE RequestPredefinedCode(EPredefinedCodeRequest predefinedCodeType, TXString& outCode) = 0;

	virtual VCOMError VCOM_CALLTYPE ExecuteScript(const TXString& script) = 0;

	virtual VCOMError VCOM_CALLTYPE Repository_RemoveValues() = 0;
	virtual VCOMError VCOM_CALLTYPE Repository_RemoveValue(const TXString& name) = 0;
	virtual VCOMError VCOM_CALLTYPE Repository_GetValue(const TXString& name, VWVariant& outValue) = 0;
	virtual VCOMError VCOM_CALLTYPE Repository_SetValue(const TXString& name, const VWVariant& value) = 0;
	virtual VCOMError VCOM_CALLTYPE Repository_GetValueNames(TXStringArray& outArray) = 0;
			
	virtual VCOMError VCOM_CALLTYPE CallUserFunction(void* functionRef, PluginLibraryArgTable* arguments, size_t argumentsCount) = 0;
	virtual VCOMError VCOM_CALLTYPE CallUserProcedure(void* procedureRef, PluginLibraryArgTable* arguments, size_t argumentsCount) = 0;

	virtual VCOMError VCOM_CALLTYPE ReportRuntimeWarning(const TXString& text) = 0;
	virtual VCOMError VCOM_CALLTYPE ReportRuntimeError(const TXString& text) = 0;
	virtual VCOMError VCOM_CALLTYPE DisplayScriptOptionsDlg() = 0;
};

Members

CompileScript Compile the specified scripts. This is just used for purposes of reporting syntax errors.
RequestPredefinedCode Uses UI to return predefined code (i.e. function names, criteria, etc) text.
ExecuteScript Execute a python script provided as text.
Repository_RemoveValues Allow access to repository to communicate data with the plug-in.
Repository_RemoveValue Allow access to repository to communicate data with the plug-in.
Repository_GetValue Allow access to repository to communicate data with the plug-in.
Repository_SetValue Allow access to repository to communicate data with the plug-in.
Repository_GetValueNames Allow access to repository to communicate data with the plug-in.
CallUserFunction Call are user function from a library callback.
CallUserProcedure Call are user function from a library callback.
ReportRuntimeWarning Report warnings in the script engine.
ReportRuntimeError Report errors in the script engine.
DisplayScriptOptionsDlg Display the UI to specify scripting options.

Remarks

There is predefined type for smart VCOM pointer VCOMPtr to IPythonScriptEngine interface:

typedef VCOMPtr<IPythonScriptEngine>  IPythonScriptEnginePtr;

Version

Available from: Vectorworks 2014

See Also

VCOM:VCOMPtr

[[VCOM:VCOMPtr]]