Call this function to add a document.

syntaxSyntax:
DlxFolder.NewDocument(name, type, template = "", units = "")

Parameters

Parameter Description
name The document name.
type The document type. Specify one of the following values.
Value Meaning
DlxApp.DOCTYPE_DRAWING Drawing document.
DlxApp.DOCTYPE_SCHEMATIC Schematic document.
DlxApp.DOCTYPE_PCB PCB document.
DlxApp.DOCTYPE_LIBRARY Components library.
DlxApp.DOCTYPE_SCRIPT Script source text.
DlxApp.DOCTYPE_SPICECIR SPICE circuit.
DlxApp.DOCTYPE_SPICELIB SPICE Library.
DlxApp.DOCTYPE_TEXTRTF RTF text document.
DlxApp.DOCTYPE_TEXT Text document.
DlxApp.DOCTYPE_HTML HTML text document.
template The name of the file with the document template. Specify an empty string or omit this parameter to not use a template.
units The unit of measurement (mm, in, mils). This parameter can be omitted.

Return Value

Returns the object corresponding to the document. Call the IsValid() method to determine if the document was created correctly.

Example

  Copy codeCopy code
var folder = DlxApp.GetJob().GetFolder("folder1");
if (folder.IsValid())
{
  if (!folder.NewDocument("doc1", DlxApp.DOCTYPE_TEXTRTF).IsValid())
  {
    throw new Error("An error occurred while creating the document.");
  }
}

See also