A QisMLib component to compose GDSII/OASIS files on disk Binary:
qismlib64.dll/libqism64.so
QisMcadWriterGlossary of TermsUser UnitGrid DBUQisMcadWriter C++ API (qismcadwriterapi.h)struct QisMcadOptsclass QisMcadOffsetsVersion ControlReset()Add_single()Add_lattice()Add_arbitrary()class QisMcadPropertyVersion ControlReset()Add_fields()class QisMcadBlockVersion ControlGet_block_error_msg()Get_block_error_tag()Get_block_error_context()Units_m()Grid_m()Grid_uu()File_path()Repetition()Real_to_int()Boundary()Path()Text()Reference()class QisMcadWriterVersion ControlGet_error_msg()Get_error_tag()Get_error_context()Begin_cad()Begin_cell()File_block()Create_block()Commit_and_destroy()Destroy_without_commit()End_cell()End_cad()class QisMcadWriterAPIVersion ControlGet_error_msg()Get_error_tag()Get_error_context()Open_CAD()Close_writer()QisMCADWriter Commandscadwriter.open cadwriter.begin_cellcadwriter.create_blockcadwriter.boxcadwriter.textcadwriter.box_setcadwriter.bstore cadwriter.boundarycadwriter.pathcadwriter.circlecadwriter.referencecadwriter.commit_blockcadwriter.end_cellcadwriter.closeQisMcadWriter API LicensingQisMcadWriter Script Licensing
USer Unit (UU) is a value for a spatial entity (co-ordinate, distance) measured in terms of the standard units of measurement such as m, cm, mm, um, nm, inch, or mils
Each CAD design has a fixed user unit that applies to the entire CAD design
E.g. UU = 1 um or 1e-6 m
Grid is the smallest addresable location or measurable distance in the 2D X,Y space
It represents the resolution of the data. Anything smaller than the grid is meaningless w.r.t the data in question
The absolute value of the grid can be expressed in standard units E.g Grid = 1e-9 m or nm
The Grid can also be expressed relative to the user units of the data E.g Grid = 0.001 UU
Each design has a fixed grid that applies to the entire CAD design
DBU (Database Unit) is a value for a spatial entity (co-ordinate, distance) measured in terms of the Grid
E.g for UU = um and Grid = 1 nm; DBU = 1 nm or 0.001 UU or 1e-9 m
Optional parameters for various operations
xstruct QisMcadOpts{ /* Options for QisMcadWriterAPI::Open_CAD */
/* Specify the output CAD format (default: gdsii) */ static const char* OPEN_FORMAT_OASIS() { return "oasis"; } static const char* OPEN_FORMAT_GDSII() { return "gdsii"; } static const char* OPEN_ACSV() { return "acsv="; } static const char* OPEN_ACSP() { return "acsp="; }
/* Options for QisMcadWriter::Create_block */
/* * `hint={string}` * If specified, add `{string}` to the block file name */ static const char* BLOCK_FILE_HINT() { return "hint="; }
/* Options for QisMcadWriter::Commit_and_destroy */
/* * If specified, keep the temporary files upon block destruction */ static const char* COMMIT_KEEP() { return "keep"; }};API to define repetitions (as x,y offsets) for geometries, texts and references
xxxxxxxxxxclass QisMcadOffsets { ... };Cast this pointer to any other version (base/derived)
The version number is embedded in the class name in form of a suffix V<number>
Get the latest version number supported by this implementation
xxxxxxxxxxvirtual const char* QisMcadOffsets_name(const int version) const = 0;virtual void* QisMcadOffsets_cast(const int version) = 0;virtual const void* QisMcadOffsets_cast(const int version) const = 0;virtual int QisMcadOffsets_latest_version() const = 0;Clear the list of repeating offsets
Returns a handle to the same API object
xxxxxxxxxxvirtual QisMcadOffsets* Reset() = 0;Add a single offset at
xandy(in dbu) to the existing list
xxxxxxxxxxvirtual void Add_single(const int x, const int y) = 0;Add offsets that repeat uniformly along X and Y to the existing list
n is the N-dimension (typically no. columns / repetition along X)
m is the M-dimension (typically no. rows / repetition along Y)
ndx, ndy, mdx, mdy are the X and Y offsets along the respective dimensions (in dbu)
Returns false if the parameters are invalid (n < 1 or m < 1)
xxxxxxxxxxvirtual bool Add_lattice( const int n, const int ndx, const int ndy, const int m, const int mdx, const int mdy ) = 0;Add arbitrary list of offsets (in dbu) to the existing list
np is no. offsets
xy is a list of x,y offsets (num ints = np * 2)
Returns false if the parameters are invalid (xy is NULL or np < 1)
xxxxxxxxxxvirtual bool Add_arbitrary(const int* xy, const int np) = 0;Represents properties to be associated with appropriate records
xxxxxxxxxxclass QisMcadProperty { ... };Cast this pointer to any other version (base/derived)
The version number is embedded in the class name in form of a suffix V<number>
Get the latest version number supported by this implementation
xxxxxxxxxxvirtual const char* QisMcadProperty_name(const int version) const = 0;virtual void* QisMcadProperty_cast(const int version) = 0;virtual const void* QisMcadProperty_cast(const int version) const = 0;virtual int QisMcadProperty_latest_version() const = 0;Clear the property fields
Returns a handle to the same API object
xxxxxxxxxxvirtual QisMcadProperty* Reset() = 0;Add data to the current property
addr is a pointer to user defined data of sz bytes
Adding fields is cumulative until Reset
xxxxxxxxxxvirtual void Add_fields(const void* addr, const int sz) = 0;API to work with a data block. A data block is a contiguous chunk of CAD records that represents geometries, texts and cell references
A cell can have multiple data blocks. A data black cannot include a cell record
A data block may be compressed as in case of OASIS (CBLOCKs)
A data can be associated with it's own separate file on disk. This is particularly useful in multi-threaded or multi-process operations
Each CAD file also has ONE data block that is associated with the CAD file itself
xxxxxxxxxxclass QisMcadBlock { ... };Cast this pointer to any other version (base/derived)
The version number is embedded in the class name in form of a suffix V<number>
Get the latest version number supported by this implementation
xxxxxxxxxxvirtual const char* QisMcadBlock_name(const int version) const = 0;virtual void* QisMcadBlock_cast(const int version) = 0;virtual const void* QisMcadBlock_cast(const int version) const = 0;virtual int QisMcadBlock_latest_version() const = 0;Get information about an error condition corresponding the the return value (
code)
msg is a human-readable description of the error
tag is a application-parseable string that represents the error category
context is reserved for restricted use
xxxxxxxxxxvirtual const char* Get_block_error_msg(const int code) = 0;virtual const char* Get_block_error_tag(const int code) = 0;virtual const char* Get_block_error_context(const int code) = 0;Get the units, grid of the CAD block in meter
xxxxxxxxxxvirtual double Units_m() const = 0;virtual double Grid_m() const = 0;virtual double Grid_uu() const = 0;Get the path of the block on disk
xxxxxxxxxxvirtual const char* File_path() const = 0;Use this to define repetitions (offsets) for various records
Repeating offsets are held until cleared
xxxxxxxxxxvirtual QisMcadOffsets* Repetition() = 0;Convert a list of values in user units to database units
xy is a list of values in user-units, nv is no. pts (2 values per pt.)
r_to_i is the grid expressed in user-units. dbu = round(uu/r_to_i)
Num. values in the returned buffer is the same as the input
The values are held in the buffer until the next call
xxxxxxxxxxvirtual int* Real_to_int(const double* xy, const int nv, const double r_to_i) = 0;Add a boundary to the data block
xy is the list of x,y co-ordinates (in dbu)
nv is the number of vertices (x,y pairs) in xy. Num. values in xy = nv*2
lnum, dnum are the layer and datatype numbers respectively
repeat if specified (not NULL) adds repetitions to this boundary
properties are reserved for future use
Returns 0 on success. Otherwise use Get_error_* for error information
xxxxxxxxxxvirtual int Boundary( const int* xy, const int nv, const unsigned short lnum, const unsigned short dnum, const QisMcadOffsets* repeat = 0, const QisMcadProperty* properties = 0 ) = 0;Add a path to the data block
xy is the list of x,y co-ordinates (in dbu)
nv is the number of vertices (x,y pairs) in xy. Num. values in xy = nv*2
type can be R for round-ended, F for flush-ended or H for half-width extended paths
width is the path width (in dbu)
lnum, dnum are the layer and datatype numbers respectively
repeat if specified (not NULL) adds repetitions to this boundary
properties are reserved for future use
Returns 0 on success. Otherwise use Get_error_* for error information
xxxxxxxxxxvirtual int Path( const int* xy, const unsigned int nv, const char type, const unsigned int width, const unsigned short lnum, const unsigned short dnum, const QisMcadOffsets* repeat = 0, const QisMcadProperty* properties = 0 ) = 0;Add a text to the data block
textstr is the text string
x and y represent the insertion point (in dbu)
lnum, dnum are the layer and datatype numbers respectively
repeat if specified (not NULL) adds repetitions to this boundary
properties are reserved for future use
Returns 0 on success. Otherwise use Get_error_* for error information
xxxxxxxxxxvirtual int Text( const char* textstr, const int x, const int y, const unsigned short lnum, const unsigned short dnum, const QisMcadOffsets* repeat = 0, const QisMcadProperty* properties = 0 ) = 0;Add a cell reference to the data block
name identifies the cell being referenced
x and y represent the insertion point (in dbu)
scale, angle and flip (flip Y or mirror about X) represent the transformations
repeat if specified (not NULL) adds repetitions to this boundary
properties are reserved for future use
Returns 0 on success. Otherwise use Get_error_* for error information
xxxxxxxxxxvirtual int Reference( const char* name, const int x, const int y, const double scale, const double angle, const bool flip, const QisMcadOffsets* repeat = 0, const QisMcadProperty* properties = 0 ) = 0;Represents a GDSII/OASIS writer object
xxxxxxxxxxclass QisMcadWriter { ... };Cast this pointer to any other version (base/derived)
The version number is embedded in the class name in form of a suffix V<number>
Get the latest version number supported by this implementation
xxxxxxxxxxvirtual const char* QisMcadWriter_name(const int version) const = 0;virtual void* QisMcadWriter_cast(const int version) = 0;virtual const void* QisMcadWriter_cast(const int version) const = 0;virtual int QisMcadWriter_latest_version() const = 0;Get information about an error condition corresponding the the return value (
code)
msg is a human-readable description of the error
tag is a application-parseable string that represents the error category
context is reserved for restricted use
xxxxxxxxxxvirtual const char* Get_error_msg(const int code) = 0;virtual const char* Get_error_tag(const int code) = 0;virtual const char* Get_error_context(const int code) = 0;Write the opening records for the CAD file
Returns 0 on success. Otherwise use Get_error_* for error information
xxxxxxxxxxvirtual int Begin_cad() = 0;Start a new cell definition
cellname cannot be empty or NULL
This DOES NOT automatically close the previous cell definition. For formats such as OASIS, that is ok. For formats such as GDSII, an explicit call to End_cell needs to be made. In generate, a call to Begin_cell MUST have a matching call to End_cell
Returns 0 on success. Otherwise use Get_error_* for error information
xxxxxxxxxxvirtual int Begin_cell(const char* cellname) = 0;Get a handle to the file (main) block of the CAD stream
DO NOT delete the file block
Returns 0 on success. Otherwise use Get_error_* for error information
xxxxxxxxxxvirtual QisMcadBlock* File_block() = 0;Create a new data block
opts is a string of optional parameters separated by spaces
ecode is a buffer to receive the error code should this operation fail
NOT MULTI-THREAD SAFE
Every block created by this method MUST be eventually committed or destroyed
Returns 0 on success. Otherwise use Get_error_* for error information
xxxxxxxxxxvirtual QisMcadBlock* Create_block(int* ecode, const char* opts) = 0;Merge the specified
blockto the main (file) block and then destroy thatblock
opts is a string of optional parameters separated by spaces
Returns 0 on success. The block has been destroyed. DO NOT CALL Destroy_without_commit
Otherwise use Get_error_* for error information. The may not have been destroyed so YOU MUST CALL Destroy_without_commit
Blocks should not be comitted outside of cell definitions
xxxxxxxxxxvirtual int Commit_and_destroy(QisMcadBlock* block, const char* opts) = 0;Destroy the CAD block without merging with the main (file) stream
Returns 0 on success. Otherwise use Get_error_* for error information
xxxxxxxxxxvirtual void Destroy_without_commit(QisMcadBlock* block) = 0;End the current cell definition
Returns 0 on success. Otherwise use Get_error_* for error information
xxxxxxxxxxvirtual int End_cell() = 0;Write the closing records for the CAD file
Returns 0 on success. Otherwise use Get_error_* for error information
xxxxxxxxxxvirtual int End_cad() = 0;Primary interface to the QisMcadWriter API
xxxxxxxxxxclass QisMcadWriterAPI: public QisMExtensionAPI { ... };Cast this pointer to any other version (base/derived)
The version number is embedded in the class name in form of a suffix V<number>
Get the latest version number supported by this implementation
xxxxxxxxxxvirtual const char* QisMcadWriterAPI_name(const int version) const = 0;virtual void* QisMcadWriterAPI_cast(const int version) = 0;virtual const void* QisMcadWriterAPI_cast(const int version) const = 0;virtual int QisMcadWriterAPI_latest_version() const = 0;Get information about an error condition corresponding the the return value (
code)
msg is a human-readable description of the error
tag is a application-parseable string that represents the error category
context is reserved for restricted use
xxxxxxxxxxvirtual const char* Get_error_msg(const int code) = 0;virtual const char* Get_error_tag(const int code) = 0;virtual const char* Get_error_context(const int code) = 0;Create a GDSII or OASIS writer
file_path is the path of the output file (with extension)
units_m is the CAD units in meter
grid_m is the CAD grid in meter
ecode is a buffer to recieve the error handle should this operation fail
opts is a string of optional parameters separated by spaces
On success returns a handle to the CAD writer object. Otherwise call Get_error_* with *ecode for error information
These operations are NOT MULTI-THREAD SAFE
Every CAD writer created this way MUST be eventually destroyed using Close_writer
xxxxxxxxxxvirtual QisMcadWriter* Open_CAD( const char* file_path, const double units_m, const double grid_m, int* ecode, const char* opts = 0 ) = 0;virtual void Close_writer(QisMcadWriter* handle) = 0;xxxxxxxxxxcadwriter.open&writer={writer_id}grid_m={grid_in_meters}units_m={units_in_meters}path={output_file_path}[format={GDS|OAS}]
Open a GDSII/OASIS file composer
{writer_id} is name of a variable to be associated with the writer object
{grid_in_meters} is the file resolution expressed in meters
{units_in_meters} is the file units expressed in meters
{output_file_path} is the path (dir + name + extension) where the output file will be created
format if specified determines the file format (default : GDS)
Every open MUST have a corresponding close
xxxxxxxxxxcadwriter.begin_cell $writer={writer_id} name={cellname}
Open a cell definition
{writer_id} is name of a variable associated with an open writer object
{cellname} is name of the cell to be defined
Every begin_cell MUST have a corresponding end_cell
xxxxxxxxxxcadwriter.create_block$writer={writer_id}&block={block_id}
Create a new block of data to write geometries, texts and cell references
The block format (GDSII/OASIS...) and the grid/units are inherited from the parent writer
A cell can have multiple blocks. However, a block cannot enclose a cell definition
The parent writer itself contains a single block called the File block that represents the main stream
While a block can be composed independently of the main stream, it MUST be eventually comitted to become part of the main stream and be destroyed
xxxxxxxxxxcadwriter.box$writer={writer_id} | $block={block_id}{box={minx},{miny},{maxx},{maxy} | center={x},{y},{width},{height}}[layer={layer}:{datatype}][repeat=NM,{n},{ndx},{ndy},{m},{mdx},{mdy} | repeat=PTS,{dx0},{dy0}..{dxn},{dyn}]
Write a rectangular box to the current cell
{writer_id} is name of a variable associated with an open writer object
{block_id} is name of a variable associated with an open block object
{minx}..{miny} are the min-max extents of the box in file units
{x},{y} is the center point and {width},{height} are the box dimensions in file units
{layer}:{datatype} if specified is the layer to be associated with the box (default: 0:0)
Repetitions (optional) can be specified in two forms:
Regular repetition is specified using the number of instances {n} in one direction with offsets {ndx},{ndy} and {m} instances in an orthogonal direction with offsets {mdx},{mdy}.
Arbitrary repetition is specified using a set of deltas {dx},{dy} from the first instance
xxxxxxxxxxcadwriter.text$writer={writer_id} | $block={block_id}text={string}pos={x},{y}[layer={layer}:{datatype}][repeat=NM,{n},{ndx},{ndy},{m},{mdx},{mdy} | repeat=PTS,{dx0},{dy0}..{dxn},{dyn}]
Write the text {string} to the current cell
{writer_id} is name of a variable associated with an open writer object
{block_id} is name of a variable associated with an open block object
{x},{y} is the insertion point in file units
{layer}:{datatype} if specified is the layer to be associated with the text (default: 0:0)
Repetitions (optional) can be specified in two forms:
Regular repetition is specified using the number of instances {n} in one direction with offsets {ndx},{ndy} and {m} instances in an orthogonal direction with offsets {mdx},{mdy}.
Arbitrary repetition is specified using a set of deltas {dx},{dy} from the first instance
xxxxxxxxxxcadwriter.box_set$writer={writer_id} | $block={block_id}$set={box_set_id}[layer={layer}:{datatype}]
Write a set of rectangular boxes to the current cell
{writer_id} is name of a variable associated with an open writer object
{block_id} is name of a variable associated with an open block object
{box_set_id} is name of a variable associated with the set of boxes to be written
{layer}:{datatype} if specified is the layer to be associated with the box (default: 0:0)
xxxxxxxxxxcadwriter.bstore$writer={writer_id} | $block={block_id}$bin={bstore_id}
Write a set of boundaries to the current cell
{writer_id} is name of a variable associated with an open writer object
{block_id} is name of a variable associated with an open block object
{bstore_id} is name of a variable associated with the set of boundaries to be written
xxxxxxxxxxcadwriter.boundary$writer={writer_id} | $block={block_id}{{deltas={dx0},{dy0},{dx1},{dy1}[,{dx},{dy}]* pos={x},{y}} | xy={x1},{y1}..{xn},{yn}}[repeat=NM,{n},{ndx},{ndy},{m},{mdx},{mdy} | repeat=PTS,{dx0},{dy0}..{dxn},{dyn}][layer={layer}:{datatype}]
Write a boundary to the current cell (with or without repetitions)
All co-ordinates are in file units
{writer_id} is name of a variable associated with an open writer object
{block_id} is name of a variable associated with an open block object
deltas is a list of offsets from the boundary origin 0,0 that form the vertices of the boundary. There MUST be at least two deltas to form a boundary (with 4 vertices). When specifying the deltas, the origin 0,0 and the last delta (to close the boundary) are implied and therefore omitted. e.g deltas=100,0,0,100,-100,0 defines a square of length 100.
Alongside deltas, pos is the location where the first instance of the boundary is to be placed
Alternately, one can specify the co-ordinates of the boundary using an x,y list xy=
{layer}:{datatype} if specified is the layer to be associated with the box (default: 0:0)
Repetitions (optional) can be specified in two forms:
Regular repetition is specified using the number of instances {n} in one direction with offsets {ndx},{ndy} and {m} instances in an orthogonal direction with offsets {mdx},{mdy}.
Arbitrary repetition is specified using a set of deltas {dx},{dy} from the first instance
xxxxxxxxxxcadwriter.path$writer={writer_id} | $block={block_id}{{deltas={dx0},{dy0},{dx1},{dy1}[,{dx},{dy}]* pos={x},{y}} | xy={x1},{y1}..{xn},{yn}}width={path_width}[type={FLUSH | HALF | ROUND}][repeat=NM,{n},{ndx},{ndy},{m},{mdx},{mdy} | repeat=PTS,{dx0},{dy0}..{dxn},{dyn}][layer={layer}:{datatype}]
Write a path to the current cell (with or without repetitions)
All co-ordinates are in file units
{writer_id} is name of a variable associated with an open writer object
{block_id} is name of a variable associated with an open block object
deltas is a list of offsets from the path origin 0,0 that form the vertices of the path. There MUST be at least one delta to form a path (with 2 vertices). When specifying the deltas, the origin 0,0 is implied and therefore omitted. e.g deltas=100,0 defines a one-segment horizontal path of length 100 units.
Alongside deltas, pos is the location where the first instance of the boundary is to be placed
Alternately, one can specify the co-ordinates of the path using an x,y list xy=
{path_width} MUST be specified (> 0.0)
{layer}:{datatype} if specified is the layer to be associated with the box (default: 0:0)
type if specified represents the path type. Default: FLUSH
Repetitions (optional) can be specified in two forms:
Regular repetition is specified using the number of instances {n} in one direction with offsets {ndx},{ndy} and {m} instances in an orthogonal direction with offsets {mdx},{mdy}.
Arbitrary repetition is specified using a set of deltas {dx},{dy} from the first instance
xxxxxxxxxxcadwriter.circle$writer={writer_id} | $block={block_id}circle={x},{y},{radius},{arcres},{arcsag}[repeat=NM,{n},{ndx},{ndy},{m},{mdx},{mdy} | repeat=PTS,{dx0},{dy0}..{dxn},{dyn}][layer={layer}:{datatype}]
Write a circle (converted to a polygon) to the current cell (with or without repetitions)
All co-ordinates are in file units
{writer_id} is name of a variable associated with an open writer object
{block_id} is name of a variable associated with an open block object
{x},{y} are the co-ordinates of the center, {arcres} and {arcsag} specify the fineness of the approximation of the polygon w.r.t the circle
{layer}:{datatype} if specified is the layer to be associated with the box (default: 0:0)
Repetitions (optional) can be specified in two forms:
Regular repetition is specified using the number of instances {n} in one direction with offsets {ndx},{ndy} and {m} instances in an orthogonal direction with offsets {mdx},{mdy}.
Arbitrary repetition is specified using a set of deltas {dx},{dy} from the first instance
xxxxxxxxxxcadwriter.reference$writer={writer_id} | $block={block_id}name={cellname}pos={x},{y}[repeat=NM,{n},{ndx},{ndy},{m},{mdx},{mdy} | repeat=PTS,{dx0},{dy0}..{dxn},{dyn}][scale={scale}][angle={degrees}][flipy]
Write a cell reference to the current cell (with or without repetitions)
All co-ordinates are in file units
{writer_id} is name of a variable associated with an open writer object
{block_id} is name of a variable associated with an open block object
{cellname} is name of the cell to be referenced
pos is the location where the first instance of the boundary is to be placed
{scale} , {angle} and flipy if specified apply transformation to the reference
Repetitions (optional) can be specified in two forms:
Regular repetition is specified using the number of instances {n} in one direction with offsets {ndx},{ndy} and {m} instances in an orthogonal direction with offsets {mdx},{mdy}.
Arbitrary repetition is specified using a set of deltas {dx},{dy} from the first instance
xxxxxxxxxxcadwriter.commit_block$writer={writer_id}$block={block_id}
Commit (merge with the main stream) a block and destroy it
{writer_id} is name of a variable associated with an open writer object
{block_id} is name of a variable associated with an open block object to be committed
The block will be merged at the current end of the main stream (File block)
At the end of this operation, the block in question is destroyed and unavailable for further use
xxxxxxxxxxcadwriter.end_cell $writer={writer_id}
Close a cell definition
{writer_id} is name of a variable associated with an open writer object
xxxxxxxxxxcadwriter.close $writer={writer_id}
Close a GDSII/OASIS composer
{writer_id} is name of a variable associated with the writer object to be closed
Product name:
QisMcadWriterProduct code:16001(GDSII),16007(OASIS)
| Operation | Policy |
|---|---|
QisMcadWriterAPI::Open_CAD - GDSII | Acquire one license of 16001 per call |
QisMcadWriterAPI::Open_CAD - OASIS | Acquire one license of 16007 per call |
QisMcadWriterAPI::Close_writer | Release 16001 or 16007 depending on the format |
Product name:
QisMcadWriterProduct code:16001(GDSII),16007(OASIS)
| Operation | Policy |
|---|---|
cadwriter.open - format=GDSII | Acquire one license of 16001 per call |
cadwriter.open - format=OASIS | Acquire one license of 16007 per call |
cadwriter.close | Release 16001 or 16007 depending on the format |
Last Updated -- Wed Nov 19 18:22:02 UTC 2025