Tool List Setup Sheet - NC program Name

Tool List Setup Sheet - NC program Name

Anonymous
Not applicable
1,432 Views
4 Replies
Message 1 of 5

Tool List Setup Sheet - NC program Name

Anonymous
Not applicable

Hi - I use a tool-list macro that I previously downloaded from this forum to create a list of tools from the active NC program. The macro works perfectly, except I would really like to add the NC program name to the sheet - I have tried and failed although i have manged to add the project name.

Can anyone help - 

//------------------------------------------------------------------------------------------------------------------------------------
// Ouvre un fichier pour écrire le tableau outil (Type HTML)
// Liste tous les outils du program NC Actif avec tri selon odre des numéros outils
//------------------------------------------------------------------------------------------------------------------------------------
// Modif 06/06/2016 : Export via ecriture fichier
// Modif 06/07/2017 : Gestion des espaces dans les noms des projets
//					: Format pour Chrome ou IE
//
// Modif 24/07/2017 : Erreur sur test dossier si plusieurs niveau , correction et ajout du test avant création HTML
// Modif 26/07/2017 : Integration export pour outil de tournage (Valable PMILL 2017)
//                  : Ajout appel JavaScript pour charger outil directement dans PMILL
//		    : Attention fait appel à une macro GoTool.mac qui est appelée depuis la macro doit etre dans C:\dcam\config\macro
//
//           Exemple macro : 
//           ===============
//		function main (STRING $Tool) {
//			PRINT $Tool
//			STRING $Cmd= "ACTIVATE TOOL '" + $Tool + "'"
//			DOCOMMAND $Cmd
//			// SPLITTER TABEXPLORE
//			SIMULATE AUTODRAW TOOL OFF
//			DELETE SCALE
//			$Cmd= "FORM TOOL '" + $Tool + "'"
//			DOCOMMAND $Cmd
//		}
//------------------------------------------------------------------------------------------------------------------------------------

Function Main() {
DIALOGS MESSAGE OFF
DIALOGS ERROR OFF
ECHO OFF DCPDEBUG UNTRACE COMMAND ACCEPT

//Check the name of the project and if it have been already save
STRING $projectName = project_pathname(1)


STRING Msg = ""
STRING Cmd = ""

IF $projectName == "" {
$Msg = "Impossible to create the documents for the export, you must first save the project!"
MESSAGE ERROR $Msg
MACRO ABORT 
}


IF NOT ENTITY_EXISTS(entity('ncprogram','')) {
  MESSAGE ERROR "There is no active NCProgram"
  MACRO ABORT
}

// Creating an Export_ExportTool directory in the Current Project
// ExportTool directory
STRING $ExportToolTempDir = project_pathname(0) + "/Exported_TOOL-LIST"
MKDIR $ExportToolTempDir
STRING $ExportToolImg = ''  
STRING $ToolName = ''
STRING $ModiToolName = ''


// Definition Html File  
STRING $Ligne=''
STRING $Fichier=$ExportToolTempDir+'/Exported_TOOL-LIST.html'

//Opening file
FILE OPEN $Fichier FOR WRITE AS filename

$Ligne = "<html>"
FILE WRITE $Ligne TO filename

$Ligne = "<title>TOOL_LIST</title>"
FILE WRITE $Ligne TO filename


$Ligne = "<head>"
FILE WRITE $Ligne TO filename

$Ligne = '	<script language=' + '"javascript">'
FILE WRITE $Ligne TO filename

$Ligne ="	// Get the PowerMILL object"
FILE WRITE $Ligne TO filename

$Ligne="	var PowerMill = top.external;"
FILE WRITE $Ligne TO filename
$Ligne=""
FILE WRITE $Ligne TO filename

$Ligne ="	function GoTool(NTool){" 
FILE WRITE $Ligne TO filename

$Ligne ="	var Lgn = " + '"Macro ' + "'C:\\dcam\\config\\macro\\GoTool'"  + '";'
FILE WRITE $Ligne TO filename

$Ligne ='	Lgn = Lgn + " ' + "'" + '" + NTool + "' + "'" + '";'
FILE WRITE $Ligne TO filename

$Ligne ="	PowerMill.Execute (Lgn,1);"
FILE WRITE $Ligne TO filename


$Ligne="	}"
FILE WRITE $Ligne TO filename
$Ligne= "	</script>"
FILE WRITE $Ligne TO filename
	
$Ligne = "</head>"
FILE WRITE $Ligne TO filename
$Ligne = "<body lang=FR>"
FILE WRITE $Ligne TO filename
$Ligne = "<H1>TOOL LIST</H1>"
FILE WRITE $Ligne TO filename

$Ligne = "<table border=1 cellspacing=1 cellpadding=1>"
FILE WRITE $Ligne TO filename


// First line
$Ligne = "<TR>"
FILE WRITE $Ligne TO filename
$Ligne = "<TD><H3><Center>Image</Center></H3></TD><TD><H3><Center>Name<Center></H3></TD><TD><H3><Center>Tool<br>Number</Center></H3></TD><TD><H3><Center>Diameter<Center></H3></TD><TD><H3><Center>Type<Center></H3></TD><TD><H3><Center>Tip<br>Radius</Center></H3></TD><TD><H3><Center>Cutting<br>Length</Center></H3></TD><TD><H3><Center>Overall<br>Length</Center></H3></TD><TD><H3><Center>Tool Holder<br>Name<Center></H3></TD><TD><H3><Center>Exposed<br>Length<Center></H3></TD><TD><H3><Center>Stamp<Center></H3></TD>"
FILE WRITE $Ligne TO filename
$Ligne = "</TR>"
FILE WRITE $Ligne TO filename


STRING $Fold=''
STRING $CFold=''
STRING $Sz="80p" 

/// List all the tools
IF NOT ENTITY_EXISTS(entity('ncprogram', '')) {
	MESSAGE ERROR "NO NcProgram activated"
	RESUME
}

// build the expression
STRING $expr = "RootType=='nctoolpath'"
// get the list of tool (sorted in the NCProgram order)
// STRING LIST $tl_list = extract(sort(filter(components(entity('ncprogram', '')), $expr) ,'tool.number'), 'tool.name')
STRING LIST $tl_list = extract(filter(components(entity('ncprogram', '')), $expr), 'tool.name')
INT Nb=remove_duplicates($tl_list)

/// Now process the tools in the list
FOREACH Tl IN $tl_list {
	ENTITY $tp=entity('Tool',$Tl)
    $ToolName = $tp.name
	ENTITY C_Tool = entity('Tool',$ToolName)
	$Fold=dirname(Pathname($C_Tool))
		
	IF $Fold != $CFold {
		// MESSAGE INFO " $Fold   $CFold " 
		$Ligne = "<TR><TD colspan=12 style='background:#4F81BD'><H3>"+ $Fold + "</H3></TD></TR>"
		FILE WRITE $Ligne TO filename
		$CFold=$Fold	
	}
	
	// From the Tools
	$Ligne = "<TR>"
	FILE WRITE $Ligne TO filename
        // Image
        
        $Ligne = "<TD>"
        FILE WRITE $Ligne TO filename
        $Ligne = '<div align="' + 'center"' + '>'
        FILE WRITE $Ligne TO filename
        
        // CREATION IMAGE
	$ModiToolName=REPLACE($ToolName," ","_")
	$ModiToolName=REPLACE($ModiToolName,"/","-") // Corrige les nom outils du type  1/4 Endmill
			
	IF $C_Tool.type == 'turn_profiling' OR $C_Tool.type == 'turn_grooving'  {
		VIEW MODE MILLING  // Attention ce n'est pas une erreur 
	        EDIT PAR 'Options.View.ViewCube.Show' 0
	        CALL BlankAll()
	        CALL ImageTurningTool($ToolName,$ModiToolName,$ExportToolTempDir)
	        EDIT PAR 'Options.View.ViewCube.Show' 1
	        $Sz="70p" 
        } ELSE {
 	        EDIT PAR 'Options.View.ViewCube.Show' 0
 	        // VIEW MODE MILLING  //Warning this is not an error
	        CALL BlankAll()      	
                CALL ImageMillingToolReal($ToolName,$ModiToolName,$ExportToolTempDir) 
                // Mode PMILL mais juste pour outil fraisage (2017 après ???)
                // CALL ImageMillingTool($ToolName,$ModiToolName,$ExportToolTempDir) 
	        EDIT PAR 'Options.View.ViewCube.Show' 1
	        $Sz="70p" 
                  
        }
                        
        // DEFINITION IMAGE
	// Pour Chrome
        // $Ligne = '<img src="./' + $ModiToolName + ".jpg" + '" alt="' + $ToolName + '"' + ' height="' + '10%"' +' />'
	// Pour IE
	$Ligne = '<img src="./' + $ModiToolName + ".jpg" + '" alt="' + $ToolName + '"' + ' height="' + $Sz + '"' + ' onClick="GoTool(' + "'" + $ToolName+ "'" + ');" />'
        FILE WRITE $Ligne TO filename
        
	$Ligne = "</div>"
	FILE WRITE $Ligne TO filename
    
	$Ligne = "</TD>"
    FILE WRITE $Ligne TO filename
        	
    // Infos Outils
	IF $C_Tool.type == 'turn_profiling' OR $C_Tool.type == 'turn_grooving'  { 
		$Ligne = "<TD>"+$tp.name + "</TD><TD><Center>" +$tp.Number.Value + "</Center></TD><TD>" + round($C_Tool.TurningInsert.InscribedDiameter,3) + "</TD><TD>" + $C_Tool.TurningInsert.InsertShape + "</TD><TD>" + round($C_Tool.TurningInsert.TipRadius,3) + "</TD><TD>" + round($C_Tool.TurningInsert.InsertLength,3) + "</TD><TD>" + round($C_Tool.GaugePoint.X,3) + "</TD><TD>" + round($C_Tool.GaugePoint.Z,3) + "</TD><TD>" + $tp.Description + "</TD>"
		FILE WRITE $Ligne TO filename
    } ELSE {
		$Ligne = "<TD>"+$tp.name + "</TD><TD><Center>" +$tp.Number.Value + "</Center></TD><TD><Center>" + round($tp.Diameter,3) + "</Center></TD><TD><Center>" + $tp.Type+ "</Center></TD><TD><Center>" + round($tp.TipRadius,3) + "</Center></TD><TD><Center>" + round($tp.Length,3) + "</Center></TD><TD><Center>" + round(gauge_length($tp),3)+ "</Center></TD><TD><Center>" + $tp.HolderName + "</Center></TD><TD><Center>" + $tp.Overhang + "</Center></TD>"
		FILE WRITE $Ligne TO filename
	}
	        

$Ligne = "</TR>"
FILE WRITE $Ligne TO filename	
}

$Ligne = "</table>"
FILE WRITE $Ligne TO filename
$Ligne = "</body>"
FILE WRITE $Ligne TO filename
$Ligne = "</html>"
FILE WRITE $Ligne TO filename

FILE CLOSE filename

MESSAGE INFO "Export fichier : $Fichier"
// Opening file with associated application

$Cmd = 'PMILLHELP URL "' + $Fichier + '"'
DOCOMMAND $Cmd

// OLE fileaction 'open' $Fichier

}

///-------------------------------------------------------------------------
///-------------------------------------------------------------------------
Function BlankAll(){
	VIEW MODEL ; SHADE OFF
	VIEW MODEL ; WIREFRAME OFF
	UNDRAW BLOCK
	DRAW SHADEDTOOLS

	UNDRAW TOOLPATH ALL
	UNDRAW NCPROGRAM ALL
	UNDRAW BOUNDARY ALL
	UNDRAW PATTERN ALL
	UNDRAW TOOL ALL
	UNDRAW FEATURESET ALL
	UNDRAW FEATUREGROUP ALL
	UNDRAW STOCKMODEL ALL
	UNDRAW WORKPLANE ALL
	
	UNDRAW MACHINETOOL ;
        VIEW MODE MILLING
        DEACTIVATE WORKPLANE
        ACTIVATE WORKPLANE "OUTPUT_WP"
	ROTATE TRANSFORM TOOL SIDE
	WAIT ZOOM
       	
}
///-------------------------------------------------------------------------
Function ImageTurningTool ( 
				STRING $TName
				STRING $ModiToolName
				STRING $ExpToolTempDir ) 

///-------------------------------------------------------------------------
///-------------------------------------------------------------------------

Function ImageMillingTool ( 
				STRING $TName
				STRING $ModiToolName
				STRING $ExpToolTempDir ) 
{

	STRING Cmd = ""
	STRING $ExportToolImg = $ModiToolName + ".jpg" 
		
	$ExportToolImg = REPLACE($ExportToolImg," ","_")
	$ExportToolImg = $ExpToolTempDir + "/" + $ExportToolImg
	$Cmd='FORM RAISE TOOLASSPREVIEWFORM "' + $TName + '"'
	DOCOMMAND $Cmd
	
	/// WAIT FORM Indispensable because otherwise the Macro will crash
	//  It is necessary to wait for the form to execute the continuation
	/// MACRO PAUSE "Outil $ToolName : $ExportToolImg"
	WAIT FORM
	
	// Generation Tool Preview
	$Cmd='EXPORT TOOLASSEMBLYPREVIEW FILE "' + $ExportToolImg  +'"'
	DOCOMMAND $Cmd
	YES
	
	FORM CANCEL TOOLASSPREVIEWFORM
	        
}

///-------------------------------------------------------------------------
Function ImageMillingToolReal ( 
				STRING $TName
				STRING $ModiToolName
				STRING $ExpToolTempDir ) 
{
	ENTITY tl=entity('Tool',$TName)
	
	ROTATE TRANSFORM TOOL SIDE

	STRING Cmd = ""
	STRING $ExportToolImg = $ModiToolName + ".jpg" 
	
	$ExportToolImg = REPLACE($ExportToolImg," ","_")
	$ExportToolImg = $ExpToolTempDir + "/" + $ExportToolImg 
	   
	ACTIVATE TOOL $TName
	SIMULATE TOOL $TName 
	DELETE SCALE
	WAIT ZOOM
	
	PRINT $ExportToolImg
	// KEEP BITMAP WHITEBG FILESAVE $ExportToolImg YES
	
	DELETE SCALE
	WAIT ZOOM
	$Cmd='KEEP BITMAP WHITEBG FILESAVE "' + $ExportToolImg  +'" YES'	
	DOCOMMAND $Cmd	

}

VIEW MODE MILLING
DEACTIVATE TOOL
DEACTIVATE TOOLPATH
0 Likes
1,433 Views
4 Replies
Replies (4)
Message 2 of 5

5axes
Advisor
Advisor

like this :

//------------------------------------------------------------------------------------------------------------------------------------
// Ouvre un fichier pour écrire le tableau outil (Type HTML)
// Liste tous les outils du program NC Actif avec tri selon odre des numéros outils
//------------------------------------------------------------------------------------------------------------------------------------
// Modif 06/06/2016 : Export via ecriture fichier
// Modif 06/07/2017 : Gestion des espaces dans les noms des projets
//					: Format pour Chrome ou IE
//
// Modif 24/07/2017 : Erreur sur test dossier si plusieurs niveau , correction et ajout du test avant création HTML
// Modif 26/07/2017 : Integration export pour outil de tournage (Valable PMILL 2017)
//                  : Ajout appel JavaScript pour charger outil directement dans PMILL
//		    : Attention fait appel à une macro GoTool.mac qui est appelée depuis la macro doit etre dans C:\dcam\config\macro
//
//           Exemple macro : 
//           ===============
//		function main (STRING $Tool) {
//			PRINT $Tool
//			STRING $Cmd= "ACTIVATE TOOL '" + $Tool + "'"
//			DOCOMMAND $Cmd
//			// SPLITTER TABEXPLORE
//			SIMULATE AUTODRAW TOOL OFF
//			DELETE SCALE
//			$Cmd= "FORM TOOL '" + $Tool + "'"
//			DOCOMMAND $Cmd
//		}
//------------------------------------------------------------------------------------------------------------------------------------

Function Main() {
DIALOGS MESSAGE OFF
DIALOGS ERROR OFF
ECHO OFF DCPDEBUG UNTRACE COMMAND ACCEPT

//Check the name of the project and if it have been already save
STRING $projectName = project_pathname(1)


STRING Msg = ""
STRING Cmd = ""
STRING NcName= ""

IF $projectName == "" {
$Msg = "Impossible to create the documents for the export, you must first save the project!"
MESSAGE ERROR $Msg
MACRO ABORT 
}


IF NOT ENTITY_EXISTS(entity('ncprogram','')) {
  MESSAGE ERROR "There is no active NCProgram"
  MACRO ABORT
} ELSE {
	$NcName=$entity('ncprogram','').Name
}

// Creating an Export_ExportTool directory in the Current Project
// ExportTool directory
STRING $ExportToolTempDir = project_pathname(0) + "/Exported_TOOL-LIST"
MKDIR $ExportToolTempDir
STRING $ExportToolImg = ''  
STRING $ToolName = ''
STRING $ModiToolName = ''


// Definition Html File  
STRING $Ligne=''
STRING $Fichier=$ExportToolTempDir+'/Exported_TOOL-LIST.html'

//Opening file
FILE OPEN $Fichier FOR WRITE AS filename

$Ligne = "<html>"
FILE WRITE $Ligne TO filename

$Ligne = "<title>TOOL_LIST</title>"
FILE WRITE $Ligne TO filename


$Ligne = "<head>"
FILE WRITE $Ligne TO filename

$Ligne = '	<script language=' + '"javascript">'
FILE WRITE $Ligne TO filename

$Ligne ="	// Get the PowerMILL object"
FILE WRITE $Ligne TO filename

$Ligne="	var PowerMill = top.external;"
FILE WRITE $Ligne TO filename
$Ligne=""
FILE WRITE $Ligne TO filename

$Ligne ="	function GoTool(NTool){" 
FILE WRITE $Ligne TO filename

$Ligne ="	var Lgn = " + '"Macro ' + "'C:\\dcam\\config\\macro\\GoTool'"  + '";'
FILE WRITE $Ligne TO filename

$Ligne ='	Lgn = Lgn + " ' + "'" + '" + NTool + "' + "'" + '";'
FILE WRITE $Ligne TO filename

$Ligne ="	PowerMill.Execute (Lgn,1);"
FILE WRITE $Ligne TO filename


$Ligne="	}"
FILE WRITE $Ligne TO filename
$Ligne= "	</script>"
FILE WRITE $Ligne TO filename
	
$Ligne = "</head>"
FILE WRITE $Ligne TO filename
$Ligne = "<body lang=EN>"
FILE WRITE $Ligne TO filename
$Ligne = "<H1>TOOL LIST NcProgram : " + $NcName + "</H1>"
FILE WRITE $Ligne TO filename
$Ligne = "<table border=1 cellspacing=1 cellpadding=1>"
FILE WRITE $Ligne TO filename


// First line
$Ligne = "<TR>"
FILE WRITE $Ligne TO filename
$Ligne = "<TD><H3><Center>Image</Center></H3></TD><TD><H3><Center>Name<Center></H3></TD><TD><H3><Center>Tool<br>Number</Center></H3></TD><TD><H3><Center>Diameter<Center></H3></TD><TD><H3><Center>Type<Center></H3></TD><TD><H3><Center>Tip<br>Radius</Center></H3></TD><TD><H3><Center>Cutting<br>Length</Center></H3></TD><TD><H3><Center>Overall<br>Length</Center></H3></TD><TD><H3><Center>Tool Holder<br>Name<Center></H3></TD><TD><H3><Center>Exposed<br>Length<Center></H3></TD><TD><H3><Center>Stamp<Center></H3></TD>"
FILE WRITE $Ligne TO filename
$Ligne = "</TR>"
FILE WRITE $Ligne TO filename


STRING $Fold=''
STRING $CFold=''
STRING $Sz="80p" 

/// List all the tools
IF NOT ENTITY_EXISTS(entity('ncprogram', '')) {
	MESSAGE ERROR "NO NcProgram activated"
	RESUME
}

// build the expression
STRING $expr = "RootType=='nctoolpath'"
// get the list of tool (sorted in the NCProgram order)
// STRING LIST $tl_list = extract(sort(filter(components(entity('ncprogram', '')), $expr) ,'tool.number'), 'tool.name')
STRING LIST $tl_list = extract(filter(components(entity('ncprogram', '')), $expr), 'tool.name')
INT Nb=remove_duplicates($tl_list)

/// Now process the tools in the list
FOREACH Tl IN $tl_list {
	ENTITY $tp=entity('Tool',$Tl)
    $ToolName = $tp.name
	ENTITY C_Tool = entity('Tool',$ToolName)
	$Fold=dirname(Pathname($C_Tool))
		
	IF $Fold != $CFold {
		// MESSAGE INFO " $Fold   $CFold " 
		$Ligne = "<TR><TD colspan=12 style='background:#4F81BD'><H3>"+ $Fold + "</H3></TD></TR>"
		FILE WRITE $Ligne TO filename
		$CFold=$Fold	
	}
	
	// From the Tools
	$Ligne = "<TR>"
	FILE WRITE $Ligne TO filename
        // Image
        
        $Ligne = "<TD>"
        FILE WRITE $Ligne TO filename
        $Ligne = '<div align="' + 'center"' + '>'
        FILE WRITE $Ligne TO filename
        
        // CREATION IMAGE
	$ModiToolName=REPLACE($ToolName," ","_")
	$ModiToolName=REPLACE($ModiToolName,"/","-") // Corrige les nom outils du type  1/4 Endmill
			
	IF $C_Tool.type == 'turn_profiling' OR $C_Tool.type == 'turn_grooving'  {
		VIEW MODE MILLING  // Attention ce n'est pas une erreur 
	        EDIT PAR 'Options.View.ViewCube.Show' 0
	        CALL BlankAll()
	        CALL ImageTurningTool($ToolName,$ModiToolName,$ExportToolTempDir)
	        EDIT PAR 'Options.View.ViewCube.Show' 1
	        $Sz="70p" 
        } ELSE {
 	        EDIT PAR 'Options.View.ViewCube.Show' 0
 	        // VIEW MODE MILLING  //Warning this is not an error
	        CALL BlankAll()      	
                CALL ImageMillingToolReal($ToolName,$ModiToolName,$ExportToolTempDir) 
                // Mode PMILL mais juste pour outil fraisage (2017 après ???)
                // CALL ImageMillingTool($ToolName,$ModiToolName,$ExportToolTempDir) 
	        EDIT PAR 'Options.View.ViewCube.Show' 1
	        $Sz="70p" 
                  
        }
                        
        // DEFINITION IMAGE
	// Pour Chrome
        // $Ligne = '<img src="./' + $ModiToolName + ".jpg" + '" alt="' + $ToolName + '"' + ' height="' + '10%"' +' />'
	// Pour IE
	$Ligne = '<img src="./' + $ModiToolName + ".jpg" + '" alt="' + $ToolName + '"' + ' height="' + $Sz + '"' + ' onClick="GoTool(' + "'" + $ToolName+ "'" + ');" />'
        FILE WRITE $Ligne TO filename
        
	$Ligne = "</div>"
	FILE WRITE $Ligne TO filename
    
	$Ligne = "</TD>"
    FILE WRITE $Ligne TO filename
        	
    // Infos Outils
	IF $C_Tool.type == 'turn_profiling' OR $C_Tool.type == 'turn_grooving'  { 
		$Ligne = "<TD>"+$tp.name + "</TD><TD><Center>" +$tp.Number.Value + "</Center></TD><TD>" + round($C_Tool.TurningInsert.InscribedDiameter,3) + "</TD><TD>" + $C_Tool.TurningInsert.InsertShape + "</TD><TD>" + round($C_Tool.TurningInsert.TipRadius,3) + "</TD><TD>" + round($C_Tool.TurningInsert.InsertLength,3) + "</TD><TD>" + round($C_Tool.GaugePoint.X,3) + "</TD><TD>" + round($C_Tool.GaugePoint.Z,3) + "</TD><TD>" + $tp.Description + "</TD>"
		FILE WRITE $Ligne TO filename
    } ELSE {
		$Ligne = "<TD>"+$tp.name + "</TD><TD><Center>" +$tp.Number.Value + "</Center></TD><TD><Center>" + round($tp.Diameter,3) + "</Center></TD><TD><Center>" + $tp.Type+ "</Center></TD><TD><Center>" + round($tp.TipRadius,3) + "</Center></TD><TD><Center>" + round($tp.Length,3) + "</Center></TD><TD><Center>" + round(gauge_length($tp),3)+ "</Center></TD><TD><Center>" + $tp.HolderName + "</Center></TD><TD><Center>" + $tp.Overhang + "</Center></TD>"
		FILE WRITE $Ligne TO filename
	}
	        

$Ligne = "</TR>"
FILE WRITE $Ligne TO filename	
}

$Ligne = "</table>"
FILE WRITE $Ligne TO filename
$Ligne = "</body>"
FILE WRITE $Ligne TO filename
$Ligne = "</html>"
FILE WRITE $Ligne TO filename

FILE CLOSE filename

MESSAGE INFO "Export fichier : $Fichier"
// Opening file with associated application

$Cmd = 'PMILLHELP URL "' + $Fichier + '"'
DOCOMMAND $Cmd

// OLE fileaction 'open' $Fichier

}

///-------------------------------------------------------------------------
///-------------------------------------------------------------------------
Function BlankAll(){
	VIEW MODEL ; SHADE OFF
	VIEW MODEL ; WIREFRAME OFF
	UNDRAW BLOCK
	DRAW SHADEDTOOLS

	UNDRAW TOOLPATH ALL
	UNDRAW NCPROGRAM ALL
	UNDRAW BOUNDARY ALL
	UNDRAW PATTERN ALL
	UNDRAW TOOL ALL
	UNDRAW FEATURESET ALL
	UNDRAW FEATUREGROUP ALL
	UNDRAW STOCKMODEL ALL
	UNDRAW WORKPLANE ALL
	
	UNDRAW MACHINETOOL ;
        VIEW MODE MILLING
        DEACTIVATE WORKPLANE
        ACTIVATE WORKPLANE "OUTPUT_WP"
	ROTATE TRANSFORM TOOL SIDE
	WAIT ZOOM
       	
}
///-------------------------------------------------------------------------
Function ImageTurningTool ( 
				STRING $TName
				STRING $ModiToolName
				STRING $ExpToolTempDir ) 

///-------------------------------------------------------------------------
///-------------------------------------------------------------------------

Function ImageMillingTool ( 
				STRING $TName
				STRING $ModiToolName
				STRING $ExpToolTempDir ) 
{

	STRING Cmd = ""
	STRING $ExportToolImg = $ModiToolName + ".jpg" 
		
	$ExportToolImg = REPLACE($ExportToolImg," ","_")
	$ExportToolImg = $ExpToolTempDir + "/" + $ExportToolImg
	$Cmd='FORM RAISE TOOLASSPREVIEWFORM "' + $TName + '"'
	DOCOMMAND $Cmd
	
	/// WAIT FORM Indispensable because otherwise the Macro will crash
	//  It is necessary to wait for the form to execute the continuation
	/// MACRO PAUSE "Outil $ToolName : $ExportToolImg"
	WAIT FORM
	
	// Generation Tool Preview
	$Cmd='EXPORT TOOLASSEMBLYPREVIEW FILE "' + $ExportToolImg  +'"'
	DOCOMMAND $Cmd
	YES
	
	FORM CANCEL TOOLASSPREVIEWFORM
	        
}

///-------------------------------------------------------------------------
Function ImageMillingToolReal ( 
				STRING $TName
				STRING $ModiToolName
				STRING $ExpToolTempDir ) 
{
	ENTITY tl=entity('Tool',$TName)
	
	ROTATE TRANSFORM TOOL SIDE

	STRING Cmd = ""
	STRING $ExportToolImg = $ModiToolName + ".jpg" 
	
	$ExportToolImg = REPLACE($ExportToolImg," ","_")
	$ExportToolImg = $ExpToolTempDir + "/" + $ExportToolImg 
	   
	ACTIVATE TOOL $TName
	SIMULATE TOOL $TName 
	DELETE SCALE
	WAIT ZOOM
	
	PRINT $ExportToolImg
	// KEEP BITMAP WHITEBG FILESAVE $ExportToolImg YES
	
	DELETE SCALE
	WAIT ZOOM
	$Cmd='KEEP BITMAP WHITEBG FILESAVE "' + $ExportToolImg  +'" YES'	
	DOCOMMAND $Cmd	

}
0 Likes
Message 3 of 5

Anonymous
Not applicable

Perfect - thanks.

 

$Ligne = "<H1>TOOL LIST NcProgram : " + $NcName + "</H1>"

Can I ask where you got the NcName variable from?

 

0 Likes
Message 4 of 5

5axes
Advisor
Advisor
$NcName=$entity('ncprogram','').Name
0 Likes
Message 5 of 5

todd.murphy8YH67
Contributor
Contributor

Hello 5axes,

 

is there a way to have it also state if toolpath has cutter wear , and what type as well?

 

thank you

0 Likes