SoftMotion CNC ¶ Coordinate Transformations SMC_CoordinateTransformation3D (FunctionBlock) SMC_DetermineCuboidBearing (FunctionBlock) SMC_InvCoordinateTransformation3D (FunctionBlock) SMC_TeachCoordinateSystem (FunctionBlock) SMC_UnitVectorToRPY (FunctionBlock) Direct Axis Control SMC_ControlAxisByPos (FunctionBlock) SMC_ControlAxisByPosVel (FunctionBlock) SMC_ControlAxisByVel (FunctionBlock) GCode Viewer SMC_GCodeViewer (FunctionBlock) DoBeforeLeave (Action) GeoInfo Help Functions SMC_AdaptHelpMarks (Function) SMC_CalcEndPnt (Function) SMC_CalcLengthGeo (Function) SMC_CalcStartPnt (Function) SMC_CutEnd (Function) SMC_CutStart (Function) SMC_GeoinfoInit (Function) SMC_GetAccVec (Function) SMC_GetAddAxValue (Function) SMC_GetClosestPnt (Function) SMC_GetLengthOfPrefix (Function) SMC_GetPnt (Function) SMC_GetPntPI (Function) SMC_GetTanVec (Function) SMC_GetTanVec3D (Function) SMC_InvertDirection (Function) SMC_RampInCorr (Function) SMC_RampOutCorr (Function) SMC_RecalculateHelpMarks (Function) SMC_SingleCorr (Function) OutQueue Functions SMC_AppendObj (Function) SMC_DeleteObj (Function) SMC_GetCount (Function) SMC_GetHistoryCount (Function) SMC_GetLastObj (Function) SMC_GetObj (Function) SMC_GetObjFromEnd (Function) SMC_GetObjFromHistory (Function) SMC_OutQueueInit (Function) SMC_OutQueueIsSyncing (Function) SMC_OutQueue_IsFull (Function) SMC_RestoreQueue (Function) SMC_SetObj (Function) SMC_SetQueueCapacity (Function) Posinfo Functions SMC_PosInfo_Trf_Inverse (Function) SMC_PosInfo_Trf_Mult (Function) Queue manipulation SMC_QueueSetReservedEntries (FunctionBlock) SMC_RotateQueue2D (FunctionBlock) SMC_DoBeforeLeave (Action) SMC_RotateQueueInit (Action) SMC_ScaleQueue3D (FunctionBlock) SMC_DoBeforeLeave (Action) SMC_ScaleQueueInit (Action) SMC_TranslateQueue3D (FunctionBlock) SMC_DoBeforeLeave (Action) SMC_TranslateQueueInit (Action) SoftMotion Function Blocks BlockSearch SMC_BlockSearch (FunctionBlock) SMC_DoBeforeLeave (Action) SMC_InitAction (Action) SMC_BlockSearchPos (Struct) SMC_BlockSearchSavePos (FunctionBlock) DecoderBuffer SMC_GCodeJumpBuffer (FunctionBlock) DoBeforeLeave (Action) SMC_ISentenceHistory (Interface) ContainsElement (Method) RegisterElement (Method) Reset (Method) SMC_MonotoneSentenceHistory (FunctionBlock) ContainsElement (Method) RegisterElement (Method) Reset (Method) M_Functions SMC_GetMParameters (FunctionBlock) SMC_PreAcknowledgeMFunction (FunctionBlock) NCDecoder_Help_Functions SMC_GetGWORD (FunctionBlock) SMC_AvoidLoop (FunctionBlock) SMC_AvoidLoopInit (Action) SMC_DoBeforeLeave (Action) SMC_CheckForLimits (FunctionBlock) CheckSinglePoint (Action) DoBeforeLeave (Action) SMC_CheckVelocities (FunctionBlock) DoBeforeLeave (Action) SMC_ExtendedVelocityChecks (FunctionBlock) SMC_DoBeforeLeave (Action) SMC_ExtendedVelocityChecksInit (Action) SMC_Interpolator (FunctionBlock) SMC_CheckForBlindPos (Action) SMC_DoBeforeLeave (Action) SMC_InterpolatorInit (Action) SMC_InterpolatorNewObject (Action) SMC_IsResegmentationDesired (Action) SMC_ResetOutputs (Action) SMC_Interpolator2Dir (FunctionBlock) Interpolator2DirInit (Action) SMC_Interpolator2Dir_SlowTask (FunctionBlock) SMC_LimitCircularVelocity (FunctionBlock) SMC_DoBeforeLeave (Action) SMC_LimitCircularVelocityInit (Action) SMC_LimitDynamics (FunctionBlock) SMC_AdaptAddAxes (Action) SMC_AdaptOrientationAddAxes (Action) SMC_AdaptToMaxAcceleration (Action) SMC_AdaptToMaxVelocity (Action) SMC_DoBeforeLeave (Action) SMC_LimitDynamicsInit (Action) SMC_NCDecoder (FunctionBlock) GetDCS (Method) SMC_ObjectSplitter (FunctionBlock) SMC_CalcAddAxes (Action) SMC_CalcOrientationAxes (Action) SMC_DoBeforeLeave (Action) SMC_InitAction (Action) SMC_RecomputeABCSlopes (FunctionBlock) DoBeforeLeave (Action) SMC_ReduceVelEndAtCorner (FunctionBlock) DoBeforeLeave (Action) SMC_RoundPath (FunctionBlock) SMC_DoBeforeLeave (Action) SMC_RoundPathInit (Action) SMC_SegmentAnalyzer (FunctionBlock) SMC_DoBeforeLeave (Action) SMC_InitAction (Action) SMC_SmoothAddAxes (FunctionBlock) DoBeforeLeave (Action) InitAction (Action) SMC_SmoothBSpline (FunctionBlock) DoBeforeLeave (Action) SMC_SmoothMerge (FunctionBlock) SMC_SmoothPath (FunctionBlock) SMC_DoBeforeLeave (Action) SMC_SmoothPathInit (Action) SMC_ToolCorr (FunctionBlock) SMC_DoBeforeLeave (Action) SMC_ToolCorrInit (Action) SMC_ToolLengthCorr (FunctionBlock) SMC_ToolRadiusCorr (FunctionBlock) SMC_XInterpolator (FunctionBlock) DoBeforeLeave (Action) Init (Action) NewObject (Action) ResetOutputs (Action)
Coordinate Transformations ¶ SMC_CoordinateTransformation3D (FunctionBlock) SMC_DetermineCuboidBearing (FunctionBlock) SMC_InvCoordinateTransformation3D (FunctionBlock) SMC_TeachCoordinateSystem (FunctionBlock) SMC_UnitVectorToRPY (FunctionBlock)
SMC_NC_CopySentenceChecked (FUN) ¶ FUNCTION SMC_NC_CopySentenceChecked : SMC_ERROR InOut: Scope Name Type Return SMC_NC_CopySentenceChecked SMC_ERROR Inout sentencesOut SMC_GSentenceQueue Inout Const itSentence SMC_GSentence_Iterator Output bNotEnoughSpace BOOL
GSentenceJumpBuffer ¶ SMC_GSentenceJumpBuffer (FunctionBlock)
SMC_GSentenceJumpBuffer (FB) ¶ FUNCTION_BLOCK SMC_GSentenceJumpBuffer This function block buffers g-code sentences in order to avoid a full restart of the g-code file on jumps (G20). It must be used before the SMC_NCNavigator function block. Note: this function block is part of SMC_ReadNCFile2 , so it is not necessary to instantiate it by hand. InOut: Scope Name Type Comment Inout sentencesOut SMC_GSentenceQueue The output sentence queue sentencesIn SMC_GSentenceQueue The input sentence queue Input bExecute BOOL While TRUE , the function block is active. bAbort BOOL If TRUE , the current processing of this function block is aborted Output bBusy BOOL TRUE while execution of function block is not finished. bError BOOL TRUE signals that an error has occurred within the function block. ErrorID SMC_ERROR Error identification, SMC_ERROR errorPos SMC_NC_SourcePosition The source-position where an error has been detected. numHits UDINT The number of jump targets found in the buffer. Reset at rising edge of bExecute. numMisses UDINT The number of jump targets not found in the buffer. Reset at rising edge of bExecute.
Interpreter ¶ Callstack SMC_DisplayNCCallstack (FunctionBlock) SMC_NCCallstackInfo (FunctionBlock) SMC_NCInterpreter (FunctionBlock) GetDCS (Method) SMC_NC_IStackAddressResolver (Interface) GetAddress (Method)
Callstack ¶ SMC_DisplayNCCallstack (FunctionBlock) SMC_NCCallstackInfo (FunctionBlock)
SMC_NCInterpreter (FB) ¶ FUNCTION_BLOCK FINAL SMC_NCInterpreter This function block is used to interpret a CNC program (Din 66025, G-code). The program is converted into a list of SMC_GeoInfo objects and stored in a queue of type SMC_OutQueue . In each call, usually one line of the program is interpreted. This function block should be called in a separate task with a priority lower than the priority of the bus task. It should be called together with the function blocks for reading the G-Code (e.g. SMC_ReadNCFile2 ) and for pre-processing the path (e.g. SMC_CheckVelocities ). It can be called multiple times per cycle. Note The interpreter must be called in the same task as the function block that fills the SMC_GSentenceQueue (input sentences ). Usually, the sentences are provided by SMC_ReadNCFile2 , SMC_ReadNCFromStream , or SMC_NCTokenParser . The maximum number of M-functions in a row is 64. If the G-Code contains more than 64 M-functions in a row, the error SMC_DEC_OUTQUEUE_RAN_EMPTY occurs. This restriction can be circumvented by inserting a G75 previous to the first M-function of the sequence. G4-elements count as M-functions, too. InOut: Scope Name Type Initial Comment Inout sentences SMC_GSentenceQueue The input queue of g-code sentences Input bExecute BOOL Execution starts on the rising edge. bAbort BOOL If TRUE , the current processing of this function block is aborted bAppend BOOL If TRUE , a rising edge of bExecute won’t lead to a reset of the out-queue. Instead, newly incoming data will be written to the end of the out-queue. piStartPosition SMC_POSINFO Start position of the path. Only the position of the axes (piStartPosition.dX/dY/dZ/dA/dB/dC/dA1/…/dA6) is used, the other members of piStartPosition are ignored. vStartToolLength SMC_Vector3d Start tool length. nSizeOutQueue UDINT This variable contains the size of the data buffer, the list of SMC_GEOINFO structure objects will be written to. This buffer must be able to hold at least five SMC_GEOINFO objects. Otherwise, the function block will not execute any actions at all. Its size may be predefined, but may be modified later only during a reset. It is recommended to create the buffer as described by the example below: ExampleBuf: Array[1..50] of SMC_GeoInfo; The appropriate buffer size will then be retrieved by use of the operator sizeof(ExampleBuf) . pbyBufferOutQueue POINTER TO ARRAY [0..0] OF SMC_GEOINFO This input must point to the first byte of the memory area that is allocated for the SMC_OUTQUEUE structure. This area must be at least as big as defined in nSizeOutQueue . Typically the allocation of the memory buffer is done in the declaration part of the IEC-program by defining an array of SMC_GEOINFO (e.g. BUF: ARRAY[1..50] OF SMC_GEOINFO ; for a buffer that can store 50 path elements). The value may be predefined, but may be modified later on only during a reset. bEnableSyntaxChecks BOOL TRUE Turns on syntax checks that will detect invalid G-code and stop with an error in this case. It is recommended to use the syntax checks. eOriConv SMC_ORI_CONVENTION SMC_ORI_CONVENTION.ADDAXES Defines the way the orientation in the A/B/C words is interpreted. For movement commands (such as G01, G02, …), the value determines how A/B/C are treated. For values other than SMC_ORI_CONVENTION .``ADDAXES``, the angles A/B/C may be normalized, even if no coordinate rotation has been programmed. For example with orientation convention ZYZ, a programmed orientation of A=90° B=0° C=0° may result in the (equivalent) rotation A=0° B=0° C=90° in the path element. For commands that set the decoder coordinate system (G54/G55/G56), the value determines how the coordinates A/B/C are treated. If the value is SMC_ORI_CONVENTION .``ADDAXES``, then A/B/C are treated as independent additional axes, for which offsets are set. For all other values, A/B/C are treated as an orientation, and the decoder coordinate system is rotated accordingly. Note If used with tool correction functions such as SMC_ToolLengthCorr , the same orientation convention has to be used there. dCircleTolerance LREAL Tolerance to decide whether the definition of a circle makes sense. case definition via target-position and radius: If the distance between start- and end-position (both projected onto the circle plane) is greater than 2 * the radius + MAX(fCircleTolerance, 1e-06) , the circle will be converted into a line. case definition via target- and center-position: Let x be the maximum of the distance between start- and center-position and the distance between target- and center-position (projecting everything onto the circle plane). If those distances differ by more than MAX(fCircleTolerance, 0.1 * x) , the circle will be converted into a line. pInterpreterStack POINTER TO BYTE Allows to supply a buffer for the interpreter stack. If 0, a default buffer of size 10240 Bytes is used. If <> 0, the given buffer will be used. This input is read each cycle. nInterpreterStackSizeBytes UDINT The size of the buffer pointed to by pInterpreterStack. Note that the size needs to be at least 1024 Bytes. dPrecision LREAL The precision of the path in technical units. This value indicates the precision of the positions read from the G-Code. For example, if the G-Code is given with 3 places after the decimal point, the precision should be set to 1e-3 units. The precision must be non-negative. The precision value is used for example by path preprocessors like SMC_ToolRadiusCorr and SMC_AvoidLoop . Output bDone BOOL This variable will be set to TRUE as soon as the input data has been processed completely. The function block will not perform any further actions until it gets reset. bBusy BOOL TRUE , while execution of function block is not finished. bError BOOL Signals that an error has occurred within the function block. wErrorID SMC_ERROR Error identification errorPos SMC_NC_SourcePosition The source-position where an error has been detected. poqDataOut POINTER TO SMC_OUTQUEUE Pointer to the SMC_OUTQUEUE structure that manages the decoded SMC_GEOINFO objects. iStatus SMC_DEC_STATUS The current status. iLineNumberDecoded DINT The variable contains the 0-based line number of the CNC file. GCodeText SMC_GCODE_TEXT The G-Code text of the current line. CallstackInfo SMC_NCCallstackInfo Information about the callstack of the current G-Code line. Used by SMC_DisplayNCCallstack . aActivePrograms ARRAY [0..(SoftMotion_NC2_Constants.IPR_CALLSTACK_SIZE - 1)] OF STRING The currently active programs and subprograms. aActivePrograms[0] holds the name of the (sub)program that is currently interpreted. If it is a sub-program, then aActivePrograms[1] holds the name of the calling (sub)program and so on. The list of active programs is terminated by an empty string. Methods: GetDCS Structure: GetDCS (Method)
SMC_ControlAxisByPos (FB) ¶ FUNCTION_BLOCK SMC_ControlAxisByPos The function block writes the set position fSetPosition to the drive structure Axis and monitors Axis for jumps. SMC_ControlAxisByPos is mostly used with CNC and an instance of the SMC_Interpolator . InOut: Scope Name Type Initial Comment Inout Axis AXIS_REF_SM3 Reference to axis See also: AXIS_REF_SM3 Input iStatus SMC_INT_STATUS Status of the instance of SMC_Interpolator bEnable BOOL TRUE : Starts execution bAvoidGaps BOOL TRUE TRUE : Starts the monitoring of the position If the velocity exceeds the limit value which is set in AXIS_REF_SM3.fSWMaxVelocity and configured in the drive dialog with the Maximum Values setting, then the bStopIpo output is set. The axis is moved to the position with the values fGapVelocity, fGapAcceleration and fGapDeceleration . On reaching the set position, bStopIpo is set to FALSE . fSetPosition LREAL Set position of the axis in [u]. Typically connected to the output of the transformation block fGapVelocity LREAL 1 Velocity for the bypassing of the jump in [u/s] fGapAcceleration LREAL 1 Acceleration for the bypassing of the jump in [u/s2] fGapDeceleration LREAL 1E+15 Deceleration for the bypassing of the jump in [u/s2] Note: Also used if bAvoidGaps is FALSE , for stopping when disabled fGapJerk LREAL 1E+16 Jerk for the bypassing of the jump in [u/s3] Note: also used if bAvoidGaps is FALSE , for stopping when disabled Output bBusy BOOL TRUE : Function block operating bCommandAborted BOOL TRUE : Execution was interrupted by another function block instance operating on axis. bError BOOL TRUE : Error has occurred iErrorID SMC_ERROR Error identification bStopIpo BOOL TRUE : Jump in velocity or position occurred and adaptation to new position is running. If bStopIpo is connected to the EmergencyStop input of the SMC_Interpolator instance, the interpolator waits until the axis is correctly positioned. See also: SMC_ERROR
SMC_ControlAxisByPosVel (FB) ¶ FUNCTION_BLOCK SMC_ControlAxisByPosVel This function block writes the set position fSetPosition and the set velocity fSetVelocity to the axis drive structure and monitors axis for jumps in a similar way to SMC_ControlAxisByPos . SMC_ControlAxisByPosVel is mostly used with CNC and an instance of the SMC_Interpolator . Note For direct checking of the set value of the axis, one of the SMC_Follow* blocks should be used. See also: SMC_ControlAxisByPos InOut: Scope Name Type Initial Comment Inout Axis AXIS_REF_SM3 Reference to axis See also: AXIS_REF_SM3 Input iStatus SMC_INT_STATUS Status of the instance of SMC_Interpolator bEnable BOOL TRUE : Starts execution bAvoidGaps BOOL TRUE TRUE : Monitoring of position and velocity If the velocity exceeds the limit value fSWMaxVelocity which is set in Axis and configured in the drive dialog with the maximum values setting, then bStopIpo is set to TRUE . The axis is moved with the values fGapVelocity, fGapAcceleration, fGapDeceleration and fGapJerk to the set position and brought to the set velocity. On reaching the set values bStopIpo is set to FALSE . fSetPosition LREAL Set position of the axis. Typically connected to the output of the transformation block. fSetVelocity LREAL Set velocity in [u/s] fGapVelocity LREAL Velocity for the bypassing of the jump in [u/s] fGapAcceleration LREAL Acceleration for the bypassing of the jump in [u/s2] fGapDeceleration LREAL 1E+15 Deceleration for the bypassing of the jump in [u/s2] Note: also used if bAvoidGaps is FALSE , for stopping when disabled fGapJerk LREAL 1E+16 Jerk for the bypassing of the jump in [u/s3] Note: also used if bAvoidGaps is FALSE , for stopping when disabled Output bBusy BOOL TRUE : Function block operating bCommandAborted BOOL TRUE : Execution was interrupted by another function block instance operating on Axis . bError BOOL TRUE : Error has occurred iErrorID SMC_ERROR Error identification bStopIpo BOOL TRUE : Jump in velocity or position occurred and adaptation to new position is running If bStopIpo is connected to the EmergencyStop input of the SMC_Interpolator instance, the interpolator waits until the axis is correctly positioned. See also: SMC_ERROR