void GCode::writeHeader(QString filename) { comment ("Program generated from :" + fileName) ; ///@todo have to get the header code from settings dialog comment("program start"); comment("Units = millimeters"); appendCode ("G21"); comment("Absolute coordinates"); appendCode (" G90"); comment(" feed per minute mode "); appendCode ("G94"); /// @todo get Home at start option from settings comment("Homing"); home(); }
void BSONObjBuilder::appendMinForType( const StringData& fieldName , int t ) { switch ( t ) { // Shared canonical types case NumberInt: case NumberDouble: case NumberLong: append( fieldName , - std::numeric_limits<double>::max() ); return; case Symbol: case String: append( fieldName , "" ); return; case Date: // min varies with V0 and V1 indexes, so we go one type lower. appendBool(fieldName, true); //appendDate( fieldName , numeric_limits<long long>::min() ); return; case Timestamp: // TODO integrate with Date SERVER-3304 appendTimestamp( fieldName , 0 ); return; case Undefined: // shared with EOO appendUndefined( fieldName ); return; // Separate canonical types case MinKey: appendMinKey( fieldName ); return; case MaxKey: appendMaxKey( fieldName ); return; case jstOID: { OID o; appendOID( fieldName , &o); return; } case Bool: appendBool( fieldName , false); return; case jstNULL: appendNull( fieldName ); return; case Object: append( fieldName , BSONObj() ); return; case Array: appendArray( fieldName , BSONObj() ); return; case BinData: appendBinData( fieldName , 0 , BinDataGeneral , (const char *) 0 ); return; case RegEx: appendRegex( fieldName , "" ); return; case DBRef: { OID o; appendDBRef( fieldName , "" , o ); return; } case Code: appendCode( fieldName , "" ); return; case CodeWScope: appendCodeWScope( fieldName , "" , BSONObj() ); return; }; log() << "type not supported for appendMinElementForType: " << t; uassert( 10061 , "type not supported for appendMinElementForType" , false ); }
///@todo: when implmenting post-processor replace G00, G01, with user specified codes void GCode::rapidMove(QPointF p,qreal Z){ p=partTrans.map(p); if (!qFuzzyCompare(p.x(),lastX) || !qFuzzyCompare(p.y(),lastY) ) { appendCode("G00"); if (p.x()!=lastX) appendNumCode ("X",p.x()); if (p.y()!=lastY) appendNumCode ("Y",p.y()); ///appendNumCode ("Z",Z); cartidgeReturn(); setLastPos(p); } }
void GCode::ArcCut (QPointF p,qreal Z,QPointF p2,qreal radius,bool cw){ p=partTrans.map(p); /// p2=partTrans.map(p2); if (!cw){ appendCode("G03"); } else{ appendCode("G02"); } appendNumCode ("X",p.x()); appendNumCode ("Y",p.y()); if (radius==0) { appendNumCode ("I",p2.x()); appendNumCode ("J",p2.y()); } else{ appendNumCode ("R",radius); } cartidgeReturn(); setLastPos(p); }
void GCode::feedRateMove (QPointF p,qreal Z){ p=partTrans.map(p); ///@todo: change qfuzzycompare to precision related check ///@note Qfuzzycompare is used to limit unnessary(cause not within precision) moves of the tool if (!qFuzzyCompare(p.x(),lastX) || !qFuzzyCompare(p.y(),lastY) ) { appendCode("G01"); if (p.x()!=lastX) appendNumCode ("X",p.x()); if (p.y()!=lastY) appendNumCode ("Y",p.y()); ///appendNumCode ("Z",Z); cartidgeReturn(); setLastPos(p); } }
void BSONObjBuilder::appendMinForType( const string& field , int t ){ switch ( t ){ case MinKey: appendMinKey( field.c_str() ); return; case MaxKey: appendMinKey( field.c_str() ); return; case NumberInt: case NumberDouble: case NumberLong: append( field.c_str() , - numeric_limits<double>::max() ); return; case jstOID: { OID o; memset(&o, 0, sizeof(o)); appendOID( field.c_str() , &o); return; } case Bool: appendBool( field.c_str() , false); return; case Date: appendDate( field.c_str() , 0); return; case jstNULL: appendNull( field.c_str() ); return; case String: append( field.c_str() , "" ); return; case Object: append( field.c_str() , BSONObj() ); return; case Array: appendArray( field.c_str() , BSONObj() ); return; case BinData: appendBinData( field.c_str() , 0 , Function , 0 ); return; case Undefined: appendUndefined( field.c_str() ); return; case RegEx: appendRegex( field.c_str() , "" ); return; case DBRef: { OID o; memset(&o, 0, sizeof(o)); appendDBRef( field.c_str() , "" , o ); return; } case Code: appendCode( field.c_str() , "" ); return; case Symbol: appendSymbol( field.c_str() , "" ); return; case CodeWScope: appendCodeWScope( field.c_str() , "" , BSONObj() ); return; case Timestamp: appendTimestamp( field.c_str() , 0); return; }; log() << "type not support for appendMinElementForType: " << t << endl; uassert( "type not supported for appendMinElementForType" , false ); }
void GCode::writeEnd(){ comment("program End"); appendCode ("M2"); }