A QisMLib extension to create a database from a Gerber (RS274X) file
QisMGbrPS ExtensionQisMGbrPS C++ API (qismgbrps.h)QisMGbrPSNotifyVersion control (QisMGbrPSNotify)On_qismgbr_progressQisMGbrPSOptsParamTypeUnitTypeMirrorVersion control (QisMGbrPSOpts)Set_paramGet_paramReset (QisMGbrPSOpts)CloneCopyQisMGbrDcodesVersion control (QisMGbrPSFile)Has_dcodeDcode_listDcode_XYDcode_infoAperture_unitsWrite_CSVQisMGbrPSFileMetaInfoVersion control (QisMGbrPSFile)File_dbGet_error_msg (QisMGbrPSFile)Get_error_tag (QisMGbrPSFile)Save_to_gdsiiGet_meta_infoQisMGbrPSFileV2Query_dcodesDestroy_dcodesQuery OptionsQisMGbrPSVersion control (QisMGbrPS)Get_error_msg (QisMGbrPS)Get_error_tag (QisMGbrPS)New_objectDelete_objectLoad_gbrUnload_gbrQisMGbrPS commandsgbrpsfile.print_metagbrpsfile.save_gdsgbrps.unloadgbrps.loadgbrpsfile.query_dcodesdcodes.listdcodes.xydcodes.infodcodes.write_to_filegbrpsfile.destroy_dcodesQisMGbrPS Licensing (API)QisMGbrPS Licensing (Script)QisMGbrPS Version Historyqismgbrps dll/so v1.6 11-2025qismgbrps dll/so v1.5.1 04-2025qismgbrps dll/so v1.5 04-2025qismgbrps dll/so v1.4 05-2024qismgbrps dll/so v1.3 06-2023qismgbrps dll/so v1.2.1 05-2023qismgbrps dll/so v1.2 03-2022qismgbrps dll/so v1.1 12-2021qismgbrps dll/so v1.0 06-2021
Represents an interface to recieve notifications from QisMGbrPS
class QisMGbrPSNotify { ... };Cast to a pointer of another version in the class hierarchy (base/derived)
Get the latest version number. Version numbers start at 1 and are reflected in the class name using the suffix V<number>. E.g <baseclass>V<version>
The topmost base class is version 1 (V1 implied)
The cast returns NULL if a version number is not recognized/implemented
xxxxxxxxxxvirtual const char* QisMGbrPSNotify_name() const = 0;virtual void* QisMGbrPSNotify_cast(const int version) = 0;virtual const void* QisMGbrPSNotify_cast(const int version) const = 0;virtual int QisMGbrPSNotify_latest_version() const = 0;Callback to get progress message while Gbr is being processed
Return 0 to continue, non-zero to terminated the load
xxxxxxxxxxvirtual int On_qismgbr_progress(const char* msg) { return 0; }Represents an object to store options for importing Gbr
xxxxxxxxxxclass QisMGbrPSOpts { ... };PRM_DBG is used to preseve temp. files for troubleshooting
Set: MUST be followed by an int 1 (ON) or 0 (OFF)
Get: MUST be followed by int* to get the setting value
Default: 0
PRM_UM is used to set um as the units for all user specified values
Set: MUST be followed by an int value from QisMGbrPSOpts::UnitType
Get: MUST be followed by int* to get the setting value
Default: Same units as the Gerber file
PRM_MAXPTS is used to set the max. no. vetices per output polygon
Set: MUST be followed by an int value >= 4
Get: MUST be followed by int* to get the setting value
Default: 8190
PRM_ARCRES is used to control the arc resolution (degrees) (smoothing of arcs)
Set: MUST be followed by a double value
Get: MUST be followed by double* to get the setting value
Default: 45
PRM_ARCSAG is used to control the chord error (smoothing of arcs)
Set: MUST be followed by a double value
Get: MUST be followed by double* to get the setting value
Default: 0.5um
PRM_ARCSAGUNIT is used to indicate the units associated with the chord error
Set: MUST be followed by an int value from QisMGbrPSOpts::UnitType
Get: MUST be followed by int* to get the setting value
Default: UnitType::PRM_UM
PRM_THRNUM is used to control the no. threads used for gerber processing
Set: MUST be followed by an int value > 0
Get: MUST be followed by int* to get the setting value
Default: no. cpu(s) in the system
PRM_SPLITARGS is used to pass advanced arguments to the underlying gerber processor
Set: MUST be followed by a const char* of arguments separated by <space>
Get: MUST be followed by const char** to get the setting value
Default: <empty string>
To be used only in consultation with the Artwork team
PRM_ROT90 is used to rotate the design by a multiple of 90 deg. before loading
Set: MUST be followed by int that is multipled by 90 to form the angle
Get: MUST be followed by int* to get the setting value
Default: 0
Rotation is performed before mirror
PRM_MIRROR is used to reflex the design about X, Y or both before loading
Set: MUST be followed by int value from QisMGbrPSOpts::Mirror
Get: MUST be followed by int* to get the setting value
Default: Mirror::M_N
Rotation is performed before mirror
PRM_SCALEX is used to scale the design along X before loading
Set: MUST be followed by double value > 0.0
Get: MUST be followed by double* to get the setting value
Default: 1.0
PRM_SCALEY is used to scale the design along Y before loading
Set: MUST be followed by double value > 0.0
Get: MUST be followed by double* to get the setting value
Default: 1.0
PRM_SIZING_XY is used to size the design positively (>0.0) or negatively (0.0)
Set: MUST be followed by two double values representing sizing along X and Y respectively
Get: MUST be followed by two double* to get the setting value for X and Y respectively
Both X and Y values must have the same sign (positive or negative). Also, if one is 0.0, other MUST be 0.0 as well
Default: 0.0,0.0
Sizing will force the conversion of paths to boundaries
PRM_SIZING_UNIT indicates the units of the sizing value (default: same as target units)
Set: MUST be followed by an int value from QisMGbrPSOpts::UnitType
Get: MUST be followed by int* to get the setting value
PRM_SIZINGARGS is used to pass advanced arguments to the sizing routine
Set: MUST be followed by a const char* of arguments separated by <space>
Get: MUST be followed by const char** to get the setting value
Default: <empty string>
To be used only in consultation with the Artwork team
PRM_NOPATHS is used to convert path data to boundaries during database creation
Set: MUST be followed by a int that is either 1 (ON) or 0 (OFF)
Get: MUST be followed by int* to get the setting value
Default: 0 (OFF)
Sizing will force the conversion of paths to boundaries
PRM_GBRSCAN is used to compute and save certain Gerber specific information such as dcodes in the database
Set: MUST be followed by a int that is either 1 (ON) or 0 (OFF)
Get: MUST be followed by int* to get the setting value
Default: 0 (OFF)
xxxxxxxxxxenum ParamType { PRM_DBG=1, PRM_UM, PRM_MAXPTS, PRM_ARCRES, PRM_ARCSAG, PRM_ARCSAGUNIT, PRM_THRNUM, PRM_SPLITARGS, PRM_ROT90, PRM_MIRROR, PRM_SCALEX, PRM_SCALEY, PRM_SIZING_XY, PRM_SIZING_UNIT, PRM_SIZINGARGS, PRM_NOPATHS, PRM_GBRSCAN};Codes for various units supported by QisMGbrPS
xxxxxxxxxxenum UnitType { GBR_UNIT_MM = 0, GBR_UNIT_CM, GBR_UNIT_UM, GBR_UNIT_INCH, GBR_UNIT_MILS};Codes for types of mirroring
M_N - no mirroring
M_X - flip (negate) x
M_Y - flip (negate) y
M_XY - flip (negate) x and y
xxxxxxxxxxenum Mirror { M_N=0, M_X, M_Y, M_XY};Cast to a pointer of another version in the class hierarchy (base/derived).
Get the latest version number. Version numbers start at 1 and are reflected in the class name using the suffix V<number>. E.g <baseclass>V<version>
The topmost base class is version 1 (V1 implied).
The cast returns NULL if a version number is not recognized/implemented
xxxxxxxxxxvirtual const char* QisMGbrPSOpts_name() const = 0;virtual void* QisMGbrPSOpts_cast(const int version) = 0;virtual const void* QisMGbrPSOpts_cast(const int version) const = 0;virtual int QisMGbrPSOpts_latest_version() const = 0;Set/Get value for a specific option
type is a code for the option type. It can be any one of QisMGbrPSOpts::ParamType
... is used to pass the variable holding the value. It's type and count depends on the paramter in question.
Returns true if the paramter type was recognized and processed. false implies unknown/unsupported paramter type
xxxxxxxxxxvirtual bool Set_param(const int type, ...) = 0;virtual bool Get_param(const int type, ...) const = 0;Reset options to default values
xxxxxxxxxxvirtual void Reset() = 0;Create a clone from the current object. MUST be eventually destroyed using QisMGbrPS::Delete_object
xxxxxxxxxxvirtual QisMGbrPSOpts* Clone() const = 0;Copy settings from another object
xxxxxxxxxxvirtual bool Copy(const QisMGbrPSOpts* obj) = 0;Represents the results of a dcode query
Works ONLY IF the database was created with PRM_GBRSCAN enabled
xxxxxxxxxxclass QisMGbrDcodes { ... };Cast to a pointer of another version in the class hierarchy (base/derived).
Get the latest version number. Version numbers start at 1 and are reflected in the class name using the suffix V<number>. E.g <baseclass>V<version>
The topmost base class is version 1 (V1 implied).
The cast returns NULL if a version number is not recognized/implemented
xxxxxxxxxxvirtual const char* QisMGbrDcodes_name() const = 0;virtual void* QisMGbrDcodes_cast(const int version) = 0;virtual const void* QisMGbrDcodes_cast(const int version) const = 0;virtual int QisMGbrDcodes_latest_version() const = 0;Returns true if at lease one instance of the specified
dcodenumber was found in the query
xxxxxxxxxxvirtual bool Has_dcode(const int dcode) const = 0;Get a list of Dcodes found in the query
Returns a list containing n numbers
Returns NULL if the list is empty
xxxxxxxxxxvirtual const int* Dcode_list(unsigned long long& n) const = 0;Returns a list of X,Y co-ordinates (in user units) corresponding to a
dcodenumber
n is the number of X,Y pairs in the list (no. Dcode instances)
Returns NULL if no instances were found
xxxxxxxxxxvirtual const double* Dcode_XY(const int dcode, unsigned long long& n) const = 0;Returns an information string corresponding to a
dcodenumber
Returns NULL if no such dcode exists in the database
xxxxxxxxxxvirtual const char* Dcode_info(const int dcode) const = 0;Returns the aperture units (units associated with various values in the dcode information string) as either "inch" or "mm"
Returns NULL or empty string if the database was created without PRM_GBRSCAN
xxxxxxxxxxvirtual const char* Aperture_units() const = 0;Write all the collected Dcodes to a CSV file
One line per X,Y. X,Y values are in the aperture units
Returns true if the file was written (out_path was valid and writable)
xxxxxxxxxxvirtual bool Write_CSV(const char* out_path) const = 0;Represents a single database created from Gbr source
xxxxxxxxxxclass QisMGbrPSFile { ... };Represents the type of information about the Gerber source to be queried
MIF_IP_POS checks if the Gerber file polarity is positive (IPPOS) or negative (IPNEG)
MUST be followed by int* to get the value 1 (POS) 0 (NEG)
MIF_IGN_LAYERS returns a comma-separated list of layers (in the db) that do not participate in rasterization
This string can be empty
MUST be followed by const char** to get the layer string
MIF_DCODE_LAYER returns a layer (datatype 0) that contains X,Y locations of dcodes
This string can be empty
MUST be followed by const char** to get the layer string
Dcode layer is added to the list of ignore layers
MIF_APT_UNITS (if present) returns either "inch" or "mm". This is the units for interpreting any dcode values
This string can be empty
MUST be followed by const char** to get the layer string
xxxxxxxxxxenum MetaInfo { MIF_IP_POS=1 ,MIF_IGN_LAYERS ,MIF_DCODE_LAYER ,MIF_APT_UNITS};Cast to a pointer of another version in the class hierarchy (base/derived).
Get the latest version number. Version numbers start at 1 and are reflected in the class name using the suffix V<number>. E.g <baseclass>V<version>
The topmost base class is version 1 (V1 implied).
The cast returns NULL if a version number is not recognized/implemented
xxxxxxxxxxvirtual const char* QisMGbrPSFile_name() const = 0;virtual void* QisMGbrPSFile_cast(const int version) = 0;virtual const void* QisMGbrPSFile_cast(const int version) const = 0;virtual int QisMGbrPSFile_latest_version() const = 0;Get handle to the underlying QisMFile db so that it can be used with other APIs in the QisM system.
DO NOT destroy this handle using QisMLib::Unload_file. Use QisMGbrPS::Unload_gbr instead
xxxxxxxxxxvirtual NsQisMLib::QisMFile* File_db() = 0;virtual const NsQisMLib::QisMFile* File_db() const = 0;Get error message and tag (error code as a string) for a recent error
xxxxxxxxxxvirtual const char* Get_error_msg(const int code) const = 0;virtual const char* Get_error_tag(const int code) const = 0;Export the database to a GDSII file on disk at the specified path
gds_output_path(dir + filename + extension)
Returns 0 on success. Otherwise call Get_error_msg/Get_error_tag for more information
xxxxxxxxxxvirtual int Save_to_gdsii(const char* gds_output_path) const = 0;Get select information about the source Gerber file
info_type is the code associated with the information requested
xxxxxxxxxxvirtual bool Get_meta_info(const int info_type, ...) const = 0;Extension (version 2) to
QisMGbrPSFile
xxxxxxxxxxclass QisMGbrPSFileV2: public QisMGbrPSFile { ... };Run a query to collect instances of Dcodes that match the query options
Will only work if the database was created with PRM_GBRSCAN enabled
store is a buffer to retrive the handle of the query results
opts is a string of options separated by spaces. Options with spaces MUST be enclosed in double-quotes
Returns 0 on success. Otherwise use Get_error* for error information
The results object MUST be eventually destroyed to avoid resource leaks
xxxxxxxxxxvirtual int Query_dcodes(QisMGbrDcodes*& store, const char* opts = 0) = 0;virtual void Destroy_dcodes(QisMGbrDcodes* handle) = 0;Various parameters for Dcode Query
x/* Specify a region of interest (in user units). Only Dcode instances crossing the specified window will be collected */static const char* Key_ROI() { return "roi="; } //roi=%lf,%lf,%lf,%lf | roi={minx},{miny},{maxx},{maxy}
/* Only the list of specified dcodes will be collected */static const char* Key_ONLY() { return "only="; } //only=%d,..,%d | only={dcode},..,{dcode}QisMLib extension to create a db from Gbr data
xxxxxxxxxxclass QisMGbrPS: public NsQisMLib::QisMExtensionAPI { ... };Cast to a pointer of another version in the class hierarchy (base/derived).
Get the latest version number. Version numbers start at 1 and are reflected in the class name using the suffix V<number>. E.g <baseclass>V<version>
The topmost base class is version 1 (V1 implied). The cast returns NULL if a version number is not recognized/implemented
xxxxxxxxxxvirtual const char* QisMGbrPS_name() const = 0;virtual void* QisMGbrPS_cast(const int version) = 0;virtual const void* QisMGbrPS_cast(const int version) const = 0;virtual int QisMGbrPS_latest_version() const = 0;Get error message and tag (error code as a string) for a recent error
xxxxxxxxxxvirtual const char* Get_error_msg(const int code) const = 0;virtual const char* Get_error_tag(const int code) const = 0;Create/Destroy an instance of an object
class_name is name of the class whose object is to be created. Acceptable types are:
Returns handle to the newly created object. MUST be type-casted to the specified class before use
Every object created this way MUST be eventually destroyed using Delete_object to avoid memory/resource leak
xxxxxxxxxxvirtual void* New_object(const char* class_name) = 0;virtual void Delete_object(const char* class_name, void* handle) = 0;Create a database from a gbr file
filedb will contain a handle to the newly created db on success
lib_handle is the handle to QisMLib obtained via QisMLib_initialize_once
gbr_path is the path to a valid gbr (RS274X) file
working_dir if specified is path to a valid readable/writeable directory
options if specified is handle to an object carrying various import options
progress_updates if specified is a handler to receive progress updates
argc, argt, argv are reserved for internal/future use
Returns 0 on success. Otherwise call Get_error_msg, Get_error_tag for error information
Every QisMFile database created using Load_gbr MUST be eventually destroyed using Unload_gbr only
Requires ONE license of QISMCODE_GBRPS per call. The license is released once the database is created (The database itself does not require a license)
Multiple databases can co-exist and are only limited by system resources
xxxxxxxxxxvirtual int Load_gbr( QisMGbrPSFile*& filedb, NsQisMLib::QisMLib* lib_handle, const char* gbr_path, const char* working_dir = 0, const QisMGbrPSOpts* options = 0, QisMGbrPSNotify* progress_updates = 0, const int argc = 0, const char* const* argt = 0, void* const* argv = 0 ) = 0;virtual void Unload_gbr(QisMGbrPSFile* handle) = 0;QisMScript commands to create a database from a Gerber (RS274X) file
xxxxxxxxxxgbrpsfile.print_meta $filedb={id} [&ipneg={var}] [&ignlayers={var}] [&uselayers={var}]
Print meta-information about the Gerber from which a db was created
{id} is name associated with the db created from a Gerber file
&ipneg={var} if specified will set {var}=ipneg if the polarity is NEGATIVE. Otherwise {var} will be empty
&ignlayers={var} if specified will set {var} to the list of ignore layers (if present)
&uselayers={var} if specified will set {var} to the list of layers containing actual data (all layers - ign. layers)
xxxxxxxxxxgbrpsfile.save_gds $filedb={filedb_id} path={output_gds_path}
Save a GerberPS db as GDSII
{output_gds_path} is the path of the output GDSII file
{filedb_id} is name associated with the db created from a Gerber file
xxxxxxxxxxgbrps.unload $filedb={filedb_id}
Destroy a GerberPS db
{filedb_id} is name associated with the db created from a Gerber file
xxxxxxxxxxgbrps.load&filedb={filedb_id}path={gbr_file_path}workdir={wdir_path}[maxpts={num}][arcres={degrees}][arcsag={value}[{unit}]][thrnum={num}][unit=um][rotate={90x}][mirror=x|y|xy][scale={x}[,{y}]][sizing={x_uu},{y_uu}[{unit}]][nopaths][gbrscan][advanced={args}][advancedsz={args}][dbg]
Create a GerberPS (paint & scratch) db from a Gerber file
{filedb_id} is name to be associated with the newly created db
{gbr_file_path} is the path of a valid RS274X Gerber file
{wdir_path} if specified sets the working directory for the creation of temporary files. Default: CWD
maxpts sets the max. no. vertices in the output db. Default: 8190
arcres and arcsag if specified control the smoothness of arcs as they are converted to polygons. {unit} can be inch, mils, mm, cm, um or nm. Default: 45 deg and 1,um respectively
thrnum specifies the no. threads to be used for Gerber translation. Default: no. cpus in the system
unit=um if specified creates the db in um. Default: same units as the source db
rotate if specified rotates the design by the specified angle. MUST be a multiple of 90 degrees. Default: 0
mirror if specified reflects the design along X (flip x), Y (flip y) or XY (both x,y). Default: No reflection
scale if specified scales the design along X and optionally Y. If Y is omitted, {x} = {y}
sizing if specified applies positive or negative sizing along X and Y. The polarity (>0.0, <0.0 or ==0.0) of both values MUST be the same. {unit} can be inch, mils, mm, cm, um or nm.
nopaths if specified will convert the path data to boundaries during database creation. By default, path data will be available whenever possible
Sizing will force the conversion of paths to boundaries
gbrscan if specified will trigger the creation of dcode information in the database for use with gbrdcodes commands
advanced is a comma-separated list of args meant for the underlying Gerber engine. To be only used in consultation with the Artwork team
advancedsz is a comma-separated list of args meant for the underlying sizing engine. To be only used in consultation with the Artwork team
dbg if specified preserves the temporary files for troubleshooting. Default: Temp. files are deleted when the db is destroyed
This command also creates a variable of type QisMFile* with same name {filedb_id} so that the db can be used with other commands of the QisMLib scripting system. It also creates two other string variables of names {filedb_id}.grid and {filedb_id}.units set to the db grid and units in meters
xxxxxxxxxxgbrpsfile.query_dcodes$filedb={id}&dcodes={id}[roi={lx},{ly},{ux},{uy}][only={dcode}[,{dcode}]*
Run a query to retrive Dcode locations in the region of interest
$filedb={id} represents the source Gerber database
&dcodes={id} is the name to be associated with the results
roi={lx},{ly},{ux},{uy} is the region of interest. Only Dcodes whose x,y locations lie within the ROI will be collected. The home view is the default ROI
only=... limits the collection to only the specified dcode numbers
Multiple results can co-exist. Each result MUST be destroyed using gbrpsfile.destroy_dcodes to avoid resource leak
xxxxxxxxxxdcodes.list$dcodes={id}[&var={id}]
Print all the dcode numbers collected in the results as a comma-separated list
$dcodes={id} is the name associated with the query results
&var={id} if specified stores the list as a string
xxxxxxxxxxdcodes.xy$dcodes={id}dcode={number}[&var={id}]
Print all the X,Y co-ordinates collected for the specified dcode {number}
$dcodes={id} is the name associated with the query results
&var={id} if specified stores the list as a string
xxxxxxxxxxdcodes.info$dcodes={id}dcode={number}
Print information (shape, size etc.) associated with the specified dcode {number}
$dcodes={id} is the name associated with the query results
xxxxxxxxxxdcodes.write_to_file$dcodes={id}out={txt_path}
Write the dcode results to a CSV file (Dcode info,X,Y) at {txt_path}
$dcodes={id} is the name associated with the query results
The X,Y co-ordinates are in the aperture units (original Gerber units -- inch or mm)
xxxxxxxxxxgbrpsfile.destroy_dcodes$filedb={id}$dcodes={id}
Destroy the dcode query results
$filedb={id} represents the source Gerber database for the query
$dcodes={id} is the name associated with the results to be destroyed
Product name :
QisMGbrPSLicense code :11501
Acquire : QisMGbrPS::Load_gbr
Release : QisMGbrPS::Unload_gbr
Policy : One per call
Product name :
QisMGbrPSLicense code :11501
Acquire : gbrps.load
Release : gbrps.unload
Policy : One per call
New API and script commands to query dcodes in a region-of-interest
Fix to avoid console popup during cleanup
gbrpsfile.print_meta can be used to retrive values for image polarity and ignore layers
Default behavior w.r.t path data has changed. Now, by default paths are present in the newly created DB. This can be overriden using a new option
Sizing will force the conversion of paths to boundaries
Ability to support files with large SR counts
Bug fix - If only arcres was specified, it was reset to 0.0 causing issues in the underlying engine
Support for sizing
Bug fix - Loading failed if QisMLib was initialized without logging (QisMLog)
First cut
Last Updated -- Wed Nov 19 18:51:45 UTC 2025