Tool Tree Set-Up Sheet

Tool Tree Set-Up Sheet

Anonymous
Not applicable
11,563 Views
58 Replies
Message 1 of 59

Tool Tree Set-Up Sheet

Anonymous
Not applicable

I am looking for help to make a macro that will take all of my tools on the tool tree, organize them in numerical order and then export them into a format that is printable.  This would be beneficial when I have a multi-program Powermill file, so that the operator only has to look at one tooling list when setting up the machine for all the programs.

 

 

This info into printable form:

 

2017-07-06 15_19_23-PowerMill Explorer.png

 

Thanks for any help.

0 Likes
11,564 Views
58 Replies
Replies (58)
Message 21 of 59

5axes
Advisor
Advisor

Last modification :

 

The HTML document is now load into PMILL directly and if you clic on the image the tool definition is Open . Usefull to make a quick review of your tool (Ie to add a missing tool number or modify a wrong tool holder definition) :

Liste_Tool_B.jpg

 

Message 22 of 59

Rui_Ramos
Advocate
Advocate

hello,

Great Macro!!

 

could you please upload de file again, it says "file is corrupted..."

 

thanks 

 

 

0 Likes
Message 23 of 59

5axes
Advisor
Advisor

One copy of the last "release" can be found there : https://knowledge.autodesk.com/fr/community/article/99886

Message 24 of 59

Rui_Ramos
Advocate
Advocate

Greetings 5axes,

 

is it possible to change the macro (fantastic macro by the way!!) to list only the tools of the selected Ncprograms? can you please help me with that issue?

 

 

thanks in advance,

 

have a nice day

 

Rui

 

0 Likes
Message 25 of 59

5axes
Advisor
Advisor

Replace the line :

 

FOREACH tp IN folder($a_f) {

 

by

 

IF NOT ENTITY_EXISTS(entity('ncprogram', '')) {
 MESSAGE ERROR "No Ncprogram activated"
 RESUME
}
FOREACH Tl IN list_nctools(entity('ncprogram', '')) {
ENTITY $tp=entity('Tool',$Tl)

Message 26 of 59

Rui_Ramos
Advocate
Advocate

5axes,

thanks for the help,  but I wanted to list the tools of the selected Ncprograms, not the activated Ncprogram...Maybe I´ve explained wrong!!

it´s listing only the activated Ncprogram.

 

 

thanks

 

 

 

0 Likes
Message 27 of 59

5axes
Advisor
Advisor

ok

so Replace

 

Function Main() {

 

by

 

Function Main( STRING $Selected_NCP) {

 

And

 

FOREACH tp IN folder($a_f) {

 

by

 

FOREACH Tl IN sort(list_nctools(entity('ncprogram', $Selected_NCP))) {
ENTITY $tp=entity('Tool',$Tl)

 

(In this case you don't need to test if  an activ ncprogam exists)

 

 

Add in your ncprogram.xml file the line

 

<button command='MACRO "Export_Outil_NCProg_Html" "%s"' label="Export HTML" />

 

to launch the macro via the user menu

 

Message 28 of 59

Rui_Ramos
Advocate
Advocate

IT GIVES AN ERROR!!

0 Likes
Message 29 of 59

5axes
Advisor
Advisor

This macro MUST be launch via the user menu ( ncprogram.xml)

 

User menu.jpg

 

0 Likes
Message 30 of 59

Rui_Ramos
Advocate
Advocate

5axes,

Thank you very much !!

 

have a nice day!!

 

 

Rui

 

 

 

 

 

0 Likes
Message 31 of 59

5axes
Advisor
Advisor

If the Tool.identifier is not Equal to the tool.name you can have some issues with my last solution : https://forums.autodesk.com/t5/powermill-forum/macro-looking-for-a-smarter-solution-to-select-a-give...

 

So the new solution :

 

replace

 

FOREACH tp IN folder($a_f) {
        $ToolName = $tp.name

 

by

 

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

/// List every tool of the list
FOREACH ToolName IN $tl_list {
 
    ENTITY $tp=$entity('Tool',$ToolName)

 

Smiley Wink

 

Message 32 of 59

Rui_Ramos
Advocate
Advocate

Greetings 5axes,

how do I do that, I´m struggling here to launch this macro....Smiley Frustrated: , with no success!!

 

thanks 

0 Likes
Message 33 of 59

Anonymous
Not applicable

Is there a way to use the tool number in the NC programme instead of the tool??

0 Likes
Message 34 of 59

rob_carri
Advocate
Advocate

hi

 

@5axes, please, you could modify the macro only for the tools that you select

 

thank you

0 Likes
Message 35 of 59

5axes
Advisor
Advisor

If you are using a release 2018 or 2019 it's quite simple because you can use the function explorer_selected_entities()

in this case replace in the macro the existing  FOREACH   loop  by  :  FOREACH tp IN explorer_selected_entities() {

/// Liste tous les outils
// FOREACH tp IN folder($a_f) {
FOREACH tp IN explorer_selected_entities() {

As you can have in the explorer some selected entities which are not some tool element you should add a test in the loop to test if the entities are some Tool definition :

 

FOREACH tp IN explorer_selected_entities() {
        STRING Root = tokens(pathname($tp), "\")[0]
        IF $Root != 'Tool' {
        	BREAK
        }
....

 

0 Likes
Message 36 of 59

gosmann.andreas
Advocate
Advocate

How do i start the Marcro with Macro Button without usermenu?

0 Likes
Message 37 of 59

wm_pm
Advocate
Advocate

Hello everybody,
can this macro be changed so that it only outputs the tools in the active folder?
Many Thanks

 

//
// Ouvre un fichier pour écrire le tableau outil (Type HTML)
// Liste tous les outils
//
// Modif 06/06/2016 : Export via ecriture fichier
//

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 de créer les documents pour l'export, vous devez d'abord sauver le projet !"
MESSAGE ERROR $Msg
MACRO ABORT
}

//Création d'un répertoire Export_ExportTool dans le Projet en cours
// Répertoire Export ExportTool
STRING $ExportToolTempDir = project_pathname(0) + "/Werkzeugliste"
MKDIR $ExportToolTempDir
STRING $ExportToolImg = ''
STRING $ToolName = ''

// Definition Fichier Html
STRING $Ligne=''
STRING $Fichier=$ExportToolTempDir+'/Werkzeugliste.html'

//Ouverture fichier
FILE OPEN $Fichier FOR WRITE AS filename

$Ligne = "<html>"
FILE WRITE $Ligne TO filename
$Ligne = "<head>"
FILE WRITE $Ligne TO filename
$Ligne = "<title>Export outil</title>"
FILE WRITE $Ligne TO filename
$Ligne = "</head>"
FILE WRITE $Ligne TO filename
$Ligne = "<body lang=DE>"
FILE WRITE $Ligne TO filename
$Ligne = "<H1>Werkzeugliste $project.orderno $projectName </H1>"
FILE WRITE $Ligne TO filename

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


// Première ligne
$Ligne = "<TR>"
FILE WRITE $Ligne TO filename
$Ligne = "<H2><TD>Bild</TD><TD>Name</TD><TD>Nummer</TD><TD>Durchmesser</TD><TD>Typ</TD><TD>Eckenradius</TD><TD>Ausspannlänge</TD><TD>Werkzeughalter</TD></H2>"
FILE WRITE $Ligne TO filename
$Ligne = "</TR>"
FILE WRITE $Ligne TO filename

/// Liste tous les outils
FOREACH tp IN folder('Tool') {
// Depuis les Outils
$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
$ToolName = $tp.name
$ExportToolImg = $ExportToolTempDir + "/" + $ToolName + ".jpg"
$ExportToolImg = REPLACE($ExportToolImg," ","_")
$Cmd='FORM RAISE TOOLASSPREVIEWFORM "' + $ToolName + '"'
DOCOMMAND $Cmd

/// WAIT FORM Indispensable car sinon la Macro plante
// Il faut attendre la forme pour executer la suite
/// MACRO PAUSE "Outil $ToolName : $ExportToolImg"
WAIT FORM

// Generation Tool Preview
$Cmd="EXPORT TOOLASSEMBLYPREVIEW FILE " + $ExportToolImg
DOCOMMAND $Cmd

YES

FORM CANCEL TOOLASSPREVIEWFORM

//<img style="margin: -4px 400px -4px 5px" src="c:/Temp/vue.jpg" alt="ScreenShot" height="70%" />
$Ligne = '<img src="' + $ExportToolImg + '" alt="' + $ToolName + '"' + 'height="' + '10%"' +' />'
FILE WRITE $Ligne TO filename

$Ligne = "</div>"
FILE WRITE $Ligne TO filename
$Ligne = "</TD>"
FILE WRITE $Ligne TO filename

// Infos Outils
$Ligne = "<TD>"+$tp.name + "</TD><TD>" +$tp.Number.Value + "</TD><TD>" + round($tp.Diameter,3) + "</TD><TD>" + $tp.Type+ "</TD><TD>" + round($tp.TipRadius,3)+"</TD><TD>" + round($tp.Overhang,3) + "</TD><TD>" + $tp.HolderName + "</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"
// Ouverture fichier avec application associée
ole fileaction 'open' $Fichier

0 Likes
Message 38 of 59

5axes
Advisor
Advisor

Faster solution for large tool list 

VIEW ANIMATION TIMELIMIT "0"
0 Likes
Message 39 of 59

rob_carri
Advocate
Advocate

good morning

 

please do not get the macro work with the selected nc programs. someone can help me I have 2 versions. the difference is that one takes the description instead of the name of the holder

0 Likes
Message 40 of 59

rob_carri
Advocate
Advocate

all I want is to insert a column to the original macro and specify the name of the program that uses the tool

 

11.JPG

0 Likes