Version 0.60.0
open

file

A file.

Signatures

  •   file( string filename )

Details

Representation of a local file of either of the types:

  • 3d model (stl, 3mf, ply)
  • image (png, jpg)
  • text file (txt, csv)

Example

 file f( "myfile.stl" )
 echo( f.exists() )
 

Output

 false
 

A file variable can be an open parameter. In this case, the user interface or frontend allows to upload a file that is used as parameter value:

Example

 open file f
 {
   name = "Mesh upload"
   descr = "The user shall provide a mesh here."
   value = "default.stl"
   accept = ".stl, .ply"
  }
  make mesh( f )
 

Casts To

string

Members

bool exists()

Returns 'true' if the file exists locally, 'false' if it does not. This can be used to determine whether an open file was uploaded by the user.

string read()

Returns a string that contains the file content.

Optional Open Parameter Attributes

bool readonly

Tells the user interface or frontend to disable the setting of the open parameter.

string style

Specifies some limited styling instructions for the user interface or frontend.

int expose_opar

Controls the visibility state of the open parameter. Possible values are -1 (do not expose), 0 (expose when requested) and +1 (expose).

string accept

A string that may contain a comma-separated list of one or more file types or unique file type specifiers, describing which file types to allow for uploading. The content of this attribute is as the HTML attribute 'accept'.

Parameters

filename

Name of the local file.

🗙

Search results for