Difference between revisions of "VS:CopySymbol"

From Vectorworks Developer
Jump to: navigation, search
m (1 revision)
(wikify, remove mcd suffix)
 
Line 9: Line 9:
  
 
If the filename includes a fully qualified path, the path has to use the appropriate notation for the local operating system:
 
If the filename includes a fully qualified path, the path has to use the appropriate notation for the local operating system:
+
* Macintosh HD:Applications:VectorWorks:Plug-Ins:Data:Notes.txt
<dir>Macintosh HD:Applications:VectorWorks:Plug-Ins:Data:Notes.txt</dir>
+
* C:Program Files/VectorWorksPlug-Ins/DataNotes.txt
<dir>C:Program FilesVectorWorksPlug-InsDataNotes.txt</dir>
+
 
 
If the filename includes a path relative to the location of the VectorWorks executable, the subfolder delimiters have to be backslashes:
 
If the filename includes a path relative to the location of the VectorWorks executable, the subfolder delimiters have to be backslashes:
 +
* Plug-Ins\DataNotes.txt
  
<dir>Plug-InsDataNotes.txt</dir>
 
 
If the filename does not include a path, the file is assumed to exist in the same folder as the VectorWorks executable.</desc>
 
If the filename does not include a path, the file is assumed to exist in the same folder as the VectorWorks executable.</desc>
  
Line 20: Line 20:
 
<def>
 
<def>
 
<funcDef lang="vs">
 
<funcDef lang="vs">
FUNCTION CopySymbol(filePath:STRING; symbol:STRING) : BOOLEAN;
+
FUNCTION CopySymbol(filePath: STRING; symbol: STRING) : BOOLEAN;
 
</funcDef>
 
</funcDef>
 
<funcDef lang="py">
 
<funcDef lang="py">
Line 54: Line 54:
 
PROCEDURE CopySym;
 
PROCEDURE CopySym;
 
VAR
 
VAR
theSymbolName :STRING;
+
theSymbolName :STRING;
 
BEGIN
 
BEGIN
theSymbolName := 'Fax';
+
theSymbolName := 'Fax';
IF CopySymbol('Object LibrariesOffice Equipment.mcd', theSymbolName)  
+
IF CopySymbol('Object Libraries\Office Equipment.vwx', theSymbolName) THEN
THEN Symbol(theSymbolName, 0, 0, 0);
+
Symbol(theSymbolName, 0, 0, 0);
 
END;
 
END;
 
RUN(CopySym);</code>
 
RUN(CopySym);</code>
 +
 
==== Python ====
 
==== Python ====
 
<code lang="py">
 
<code lang="py">
 
def CopySym():
 
def CopySym():
 
theSymbolName = 'Fax'
 
theSymbolName = 'Fax'
if vs.CopySymbol('Object LibrariesOffice Equipment.mcd', theSymbolName):  
+
if vs.CopySymbol('Object Libraries\Office Equipment.vwx', theSymbolName):  
 
vs.Symbol(theSymbolName, 0, 0, 0)
 
vs.Symbol(theSymbolName, 0, 0, 0)
 
CopySym()
 
CopySym()

Latest revision as of 22:53, 21 June 2019

.VectorScript|VectorScript ..VS:Function Reference|Function Reference ..VS:Function_Reference_Appendix|Appendix


Description

Procedure CopySymbol will copy a symbol into the active document from a user specified source document.

If the filename includes a fully qualified path, the path has to use the appropriate notation for the local operating system:

  • Macintosh HD:Applications:VectorWorks:Plug-Ins:Data:Notes.txt
  • C:Program Files/VectorWorksPlug-Ins/DataNotes.txt

If the filename includes a path relative to the location of the VectorWorks executable, the subfolder delimiters have to be backslashes:

  • Plug-Ins\DataNotes.txt

If the filename does not include a path, the file is assumed to exist in the same folder as the VectorWorks executable.

FUNCTION CopySymbol(
filePath  : STRING;
symbol  : STRING) : BOOLEAN;
def vs.CopySymbol(filePath, symbol):
    return BOOLEAN

Parameters

filePath STRING File path to document, relative to the application folder.
symbol STRING Name of symbol to import.

Return Value

Returns a BOOLEAN value indicating the success or failure of the import operation.

Example

VectorScript

PROCEDURE CopySym;
VAR
	theSymbolName :STRING;
BEGIN
	theSymbolName := 'Fax';
	IF CopySymbol('Object Libraries\Office Equipment.vwx', theSymbolName)  THEN
		Symbol(theSymbolName, 0, 0, 0);
END;
RUN(CopySym);

Python

def CopySym():
	theSymbolName = 'Fax'
	if vs.CopySymbol('Object Libraries\Office Equipment.vwx', theSymbolName): 
		vs.Symbol(theSymbolName, 0, 0, 0)
CopySym()

Version

Availability: from All Versions
Personal tools
NamespacesFFFF

Variants
Actions
Advanced Search
See Also
Navigation
Toolbox