[Artwork] / [QisMLib] / [Programmer's Corner]
API to create a QisM database from a Gerber file
- Header file : qismgerber.h
- Extension : qismgerber64.dll
- Platform: Win64
QisMGerber API (BETA)interface QisMGerbermethod Load_gerbermethod Unload_gerbermethod New_objectmethod Delete_objectmethod Get_error_msgmethod Get_error_taginterface QisMGerberFilemethod File_dbmethod Save_to_gdsiimethod Get_error_msgmethod Get_error_taginterface QisMGerberOptsenum UnitTypeenum ParamTypemethod Set_parammethod Get_parammethod Resetmethod Clonemethod Copycallback interface QisMGerberNotifycallback On_qismgerber_progress
QisMGerberclass QisMGerber: public NsQisMLib::QisMExtensionAPI { .. };The main interface to the QisMGerber extension
Obtained by calling QisMLib::Get_extension_api as follows:
xusing namespace NsQisMLib;using namespace NsQisMGerber;QisMGerber* QisMGerber_get_api(QisMLib* qismlib){ assert(qismlib != NULL); QisMExtensionAPI* extn = qismlib->Get_extension_api(QISMEXTENSION_GERBER); if(NULL == extn) { fprintf(stderr, "error: failed to locate the extension %s", QISMEXTENSION_GERBER); return NULL; } return (QisMGerber*)(extn->Extension_class_ptr());}Load_gerberUnload_gerberxxxxxxxxxxvirtual int Load_gerber( QisMGerberFile*& filedb, NsQisMLib::QisMLib* lib_handle, const char* gerber_path, const char* working_dir = 0, const QisMGerberOpts* options = 0, QisMGerberNotify* progress_updates = 0, const int argc = 0, const char* const* argt = 0, void* const* argv = 0 ) = 0;Create a database from a Gerber file
filedb will contain a handle to the newly created db on successlib_handle is the handle to the QisMLib obtained via QisMLib_initialize_once (qismlib.h)gerber_path is the path to a valid Gerber (RS274X) fileworking_dir if specified is path to a valid readable/writable directoryoptions if specified is handle to an object carrying various import optionsprogress_updates if specified returns progress messages to the client app via C++ callbacks while the Gerber file is being processedargc, argt, argv are reserved for internal/future useGet_error_msg, Get_error_tag for error informationLoad_gerber(..) MUST be eventually destroyed using Unload_gerber(..) onlyNew_objectDelete_objectxxxxxxxxxxvirtual void* New_object(const char* class_name) = 0;virtual void Delete_object(const char* class_name, void* handle) = 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
Get_error_msgGet_error_tagxxxxxxxxxxvirtual const char* Get_error_msg(const int code) const = 0;virtual const char* Get_error_tag(const int code) const = 0;Get error message and tag (error code represented as a string) for a recent error
code is a non-zero integer that represents the failure of one of the methods of this interfaceQisMGerberFilexxxxxxxxxxclass QisMGerberFile { .. };QisMGerber::Load_gerber and destroyed via QisMGerber::Unload_gerberFile_dbxxxxxxxxxxvirtual NsQisMLib::QisMFile* File_db() = 0;virtual const NsQisMLib::QisMFile* File_db() const = 0;QisMFile handle so that it can be used along with other APIs in the QisMLib systemSave_to_gdsiixxxxxxxxxxvirtual int Save_to_gdsii(const char* gds_output_path) const = 0;Export the database to a GDSII file on disk at the specified path gds_output_path (dir + filename + extension)
Get_error_msg/Get_error_tag for more informationGet_error_msgGet_error_tagxxxxxxxxxxvirtual const char* Get_error_msg(const int code) const = 0;virtual const char* Get_error_tag(const int code) const = 0;Get error message and tag (error code represented as a string) for a recent error
code is a non-zero integer that represents the failure of one of the methods of this interfaceQisMGerberOptsxxxxxxxxxxclass QisMGerberOpts { .. };QisMGerber::New_object and destroyed using QisMGerber::Delete_objectUnitTypexxxxxxxxxxenum UnitType { UNT_SOURCE=0 //same units as the source Gerber file ,UNT_IN ,UNT_MIL ,UNT_CM ,UNT_MM ,UNT_UM };ParamTypexxxxxxxxxxenum ParamType { PRM_ARCRES=1 ,PRM_ARCSAG ,PRM_ARCSAG_UNIT ,PRM_POLY_BUTTING ,PRM_POLY_BUTTING_OVERLAP ,PRM_POLY_BUTTING_OVERLAP_UNIT ,PRM_THRNUM ,PRM_ADV_ARGS ,PRM_DBG_MODE ,PRM_OUTPUT_UNIT };Codes to indicate the parameter type for the Set_param and Get_param methods
PRM_ARCRES indicates arc resolution for converting arcs to line segments
value type: double (Set_param), double* (Get_param)
Default: 45.0
xxxxxxxxxxdouble value = 45.0;this->Set_param(QisMGerberOpts::PRM_ARCRES, value);this->Get_param(QisMGerberOpts::PRM_ARCRES, &value);PRM_ARCSAG indicates chord-error for converting arcs to line segments in the specified unit (PRM_ARCSAG_UNIT)
value-type: double (Set_param), double* (Get_param)
default: 1.0
xxxxxxxxxxdouble value = 1.0;this->Set_param(QisMGerberOpts::PRM_ARCSAG, value);this->Get_param(QisMGerberOpts::PRM_ARCSAG, &value);PRM_ARCSAG_UNIT indicates units for specifying chord error. To be used with PRM_ARCSAG
value-type: int (Set_param), int* (Get_param) (one of QisMGerberOpts::UnitType)
default: QisMGerberOpts::UNT_UM
xxxxxxxxxxint value = QisMGerberOpts::UNT_UM;this->Set_param(QisMGerberOpts::PRM_ARCSAG_UNIT, value);this->Get_param(QisMGerberOpts::PRM_ARCSAG_UNIT, &value);PRM_POLY_BUTTING indicates to output polygons with holes as butting polygons
value-type: int (Set_param), int* (Get_param) (1 or 0)
default: 1 (on)
xxxxxxxxxxint value = 1;this->Set_param(QisMGerberOpts::PRM_POLY_BUTTING, value);this->Get_param(QisMGerberOpts::PRM_POLY_BUTTING, &value);PRM_POLY_BUTTING_OVERLAP indicates amount of overlap value for butting polygons in the specified units (PRM_POLY_BUTTING_OVERLAP_UNIT)
value-type: double (Set_param), double* (Get_param)
default: 0.0
xxxxxxxxxxdouble value = 0.0;this->Set_param(QisMGerberOpts::PRM_POLY_BUTTING_OVERLAP, value);this->Get_param(QisMGerberOpts::PRM_POLY_BUTTING_OVERLAP, &value);PRM_POLY_BUTTING_OVERLAP_UNIT indicates unit for butting overlap value
value-type: int (Set_param), int* (Get_param) (one of QisMGerberOpts::UnitType)
default: QisMGerberOpts::UNT_SOURCE
xxxxxxxxxxint value = QisMGerberOpts::UNT_SOURCE;this->Set_param(QisMGerberOpts::PRM_POLY_BUTTING_OVERLAP_UNIT, value);this->Get_param(QisMGerberOpts::PRM_POLY_BUTTING_OVERLAP_UNIT, &value);PRM_THRNUM indicates no. threads to be used for various stages of Gerber translation
value-type: int (Set_param), int* (Get_param)
default: 0 (use no. cpus)
xxxxxxxxxxint value = 0;this->Set_param(QisMGerberOpts::PRM_THRNUM, value);this->Get_param(QisMGerberOpts::PRM_THRNUM, &value);PRM_ADV_ARGS indicates advanced arguments (reserved for internal use/debugging)
value-type: const char* (Set_param), const char** (Get_param)
default: ""
xxxxxxxxxxconst char* value = "";this->Set_param(QisMGerberOpts::PRM_ADV_ARGS, value);this->Get_param(QisMGerberOpts::PRM_ADV_ARGS, &value);PRM_DBG_MODE indicates enable/Disable diagnostic mode
value-type: int (Set_param), int* (Get_param) (1 or 0)
default: 0 (off)
xxxxxxxxxxint value = 0;this->Set_param(QisMGerberOpts::PRM_DBG_MODE, value);this->Get_param(QisMGerberOpts::PRM_DBG_MODE, &value);PRM_OUTPUT_UNIT indicates units for the output db
value-type: int (Set_param), int* (Get_param) (one of QisMGerberOpts::UnitType)
default: QisMGerberOpts::UNT_UM
xxxxxxxxxxthis->Set_param(QisMGerberOpts::PRM_OUTPUT_UNIT, value);this->Get_param(QisMGerberOpts::PRM_OUTPUT_UNIT, &value);Set_paramGet_paramxxxxxxxxxxvirtual bool Set_param(const int type, ...) = 0;virtual bool Get_param(const int type, ...) const = 0;Set/Get value for a specific option
type is a code for the option type. It can be any one of QisMGerberOpts::ParamType... is used to pass the variable holding the value. It's type and count depends on the parameter in question. See QisMGerberOpts::ParamType for usage detailstrue if the parameter type was recognized and processed. false implies unknown/unsupported parameter typeResetxxxxxxxxxxvirtual void Reset() = 0;Clonexxxxxxxxxxvirtual QisMGerberOpts* Clone() const = 0;QisMGerber::Delete_object("QisMGerberOpts", ..)Copyxxxxxxxxxxvirtual bool Copy(const QisMGerberOpts* obj) = 0;QisMGerberNotifyxxxxxxxxxxclass QisMGerberNotify { .. };On_qismgerber_progressxxxxxxxxxxvirtual int On_qismgerber_progress(const char* msg) { return 0; }Callback to get progress message while Gerber is being processed during QisMGerber::Load_gerber