Postprocessor development
  • Postprocessor development
v3.0.3
Search Results for

    Show / Hide Table of Contents

    PARTNO - Part number

    Command caption

    How the command appears in the CLData command list:

    PARTNO "<CAM system project name>"
    

    PARTNO is the first command in the list of technology commands of a project. Use PARTNO command to form NC-program initialization block. PARTNO command puts the project name into the CLDATA$ variable.

    Access from sppx

    Handler: program PartNo

    Example (from the Fanuc (30i)_Mill postprocessor):

    program PartNo
    ! Initialization of global variables
      MaxReal = 99999.999
      XT_ = 0;  FROMX_ = 0
      YT_ = 0;  FROMY_ = 0
      ZT_ = 0;  FROMZ_ = 0
    
      KorEcv = 40; KorEcv@=KorEcv
      KorDl  = 49; KorDl@=KorDl
      Cycle  = 80; Cycle@=Cycle
      Plane  = -17; Plane@=Plane
      GSpindl = 97; GSpindl@ = GSpindl
      CoordSys = 54; CoordSys@ = CoordSys; WCSNumber = 54
      PG = 0; PG@ = PG
      YAddress = "Y"
      IsRotaryInterpolation = 0
      IsMultiaxisInterpolation = 0
      CylR = 0
      Pi = 3.1415926535897932384626433832795
      Deg2Rad = Pi / 180
      Rad2Deg = 180 / Pi
      CirclesThroughRadius = 0
      call check_Euler_angles_types
      IsLocalCS = 0
      G68_2_X = MaxReal
      G68_2_Y = MaxReal
      G68_2_Z = MaxReal
      G68_2_I = MaxReal
      G68_2_J = MaxReal
      G68_2_K = MaxReal
      HasAxisA = 0
      HasAxisB = 0
      HasAxisC = 0
    
    ! Constsnt cycles variables
      CycleOn = 0          ! 0 - cycle Off, 1 - cycle On
      KodCycle = 0         ! constant cycle code
      Za = 0               ! work depth
      Zf = 0               ! safe level
      ZP_ = 0               ! reverse move level
      Zl = 0               ! depth of one drilling step
      Zi = 0               ! transitional value
      Dwell = 0            ! pause in constsnt cycles
      Fr = 0               ! work FEED_
    ! Set machene functions by default
      X = MaxReal; X@=X
      Y = MaxReal; Y@=Y
      Z = MaxReal; Z@=Z
      A = MaxReal; A@=A
      B = MaxReal; B@=B
      C = MaxReal; C@=C
      S = 0; S@=S
      SpDir = 5
      SpRPM = 0
      DrillPause = MaxReal; DrillPause@ = DrillPause;
      QStep = MaxReal; QStep@ = QStep;
      Zcycle=Maxreal; Zcycle@=Zcycle
      P=0;Q=0
      D_=0; H_=0;             ! values D, H
      RapFR  = 2000
      INTERP_ = 100;  INTERP_@ = 100
      Msp = 5; Msp@ = 5     ! spindle off
      Mc=9; Mc@=Mc;
      Zcycle=Maxreal
      OperationIsLathe = 2
      BlkN=100
    
    ! Creating NC heading
      output "%"
      MainProgramID = 5
      call GetProgNumberFromName(NCName$,MainProgramID)
      !Input "Input program number:", MainProgramID
    !  ProgNum = MainProgramID; ProgNum@ = MaxReal
      FormBlock
      s$ = NCName$
      call CheckProgramName(s$)
      output OutStr$ + UPCASE(s$)
    
      output ""
      Output "( GENERATED BY CAM )"
      Output "( DATE: " + CurDate + " )"
      Output "( TIME: " + CurTime + " )"
    
      output ""
      call PrintAllTools
      output ""
      Output "G00G21G40G49G69G80G90G17"
      output "<StartGoHome>"
    
      OutBlock
    end
    

    Access from .NET

    Handlers:

    public override void OnPartNo(ICLDPartNoCommand cmd, CLDArray cld)
    public override void OnStartProject(ICLDProject prj)   // project-level, raised on PARTNO
    

    Inheritance: ICLDPartNoCommand : ICLDCommand.

    Read the parameters from the strongly-typed cmd object (recommended); the raw cld[i] array (same indices as in sppx) and the named cmd["..."] helpers are available too. The table lists the command's members, including those inherited from its base interfaces; the common ICLDCommand members (navigation, CLD, CLDFile, TechOperation, ...) are described in the CLData access model.

    Member Type Description
    cmd.ProjectName string Returns the project's file name without path and extension.

    Example - OnStartProject (from the Fanuc (30i)_Mill_DN postprocessor):

    public override void OnStartProject(ICLDProject prj)
    {
        probingCycle.Init();
    
        mainNC = new NCFile();
        nc = mainNC;
        nc.OutputFileName = Settings.Params.Str["OutFiles.NCFileName"];
        // Log.Info("Output file name: " + nc.OutputFileName);
        nc.ProgNumber = Settings.Params.Int["OutFiles.NCProgNumber"];
        
        CirclesThroughRadius = Settings.Params.Bol["BlockFormat.CirclesThroughRadius"];
        
        if (Settings.Params.Bol["BlockFormat.Numbering"])
            nc.BlockN.Show();
        else
            nc.BlockN.Disable();
        if (Settings.Params.Bol["BlockFormat.Spaces"])
            nc.Block.WordsSeparator = " ";
        else
            nc.Block.WordsSeparator = "";
    
        nc.WriteLine("%");
        nc.WriteLine("O" + Str(nc.ProgNumber));
    
        nc.WriteLine();
        nc.WriteLine(String.Format("( {0} )", "Generated by CAM"));
        nc.WriteLine(String.Format("( {0} )", "Date: " + DateTime.Now.ToShortDateString()));
        nc.WriteLine(String.Format("( {0} )", "Time: " + DateTime.Now.ToShortTimeString()));
        nc.WriteLine();
    
        PrintAllTools();
        nc.WriteLine();
    
        nc.Block.Show(nc.GAbsInc, nc.GFeed ,nc.GMeasure, nc.GWCS, nc.GLCS, nc.GPlane, 
            nc.GLCompens, nc.GRCompens, nc.GInterp, nc.GCycle);
        nc.Block.Out();
        nc.OutWithN("G53", nc.Z.ToString(0));
        OutG53ABC();
    }
    

    See also

    • CLData access model
    In this article