Community
PowerMill Forum
Welcome to Autodesk’s PowerMill Forums. Share your knowledge, ask questions, and explore popular PowerMill topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to automatically write and accept NC Program form

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
Anonymous
730 Views, 2 Replies

How to automatically write and accept NC Program form

I am attempting to automate a process we have here and need to write/accept an NC program form automatically.

 

Our code looks like this:

 

CREATE NCPROGRAM "Foo Mill" EDIT NCPROGRAM "Foo Mill" APPEND TOOLPATH "Foo Mill" DEACTIVATE NCPROGRAM

//expand NC program folder
EXPLORER SELECT ncprogram ROOT
DEBUG EXPLORER KEY RIGHT

STRING $path = "F:\Macros\"

STRING $postpath = $path + "HAASVF-4ax 6Nov14-4.pmoptz"
$command = 'EDIT NCPROGRAM "Foo Mill" TAPEOPTIONS ' + '"' + $postpath + '"' + 'FORM ACCEPT SelectOptionFile'
DOCOMMAND $command
EDIT NCPROGRAM 'Foo Mill' SET WORKPLANE "G54"

EDIT NCPROGRAM 'Foo Mill' ITEM 0 COMPONENT 0 FIXTUREOFFSET "G55"

//create Bor NC program
CREATE NCPROGRAM ; EDIT NCPROGRAM ; QUIT FORM NCTOOLPATH
RENAME NCPROGRAM "1" "Bor Mill"
$postpath = $path + "HAASVF-4ax 6Nov14-4.pmoptz"
$command = 'EDIT NCPROGRAM "Bor Mill" TAPEOPTIONS ' + '"' + $postpath + '"' + 'FORM ACCEPT SelectOptionFile'
DOCOMMAND $command
EDIT NCPROGRAM 'Bor Mill' SET WORKPLANE "G54"
EDIT NCPROGRAM ; APPEND TOOLPATH "Flat1"
EDIT NCPROGRAM ; APPEND TOOLPATH "Flat2"
EDIT NCPROGRAM ; APPEND TOOLPATH "Flat3"
EDIT NCPROGRAM ; APPEND TOOLPATH "Flat4"
EDIT NCPROGRAM ; APPEND TOOLPATH "Flat5"
EDIT NCPROGRAM ; APPEND TOOLPATH "Flat6"
EDIT NCPROGRAM ; APPEND TOOLPATH "Flat7"
EDIT NCPROGRAM ; APPEND TOOLPATH "Flat8"
EDIT NCPROGRAM ; APPEND TOOLPATH "Flat9"
EDIT NCPROGRAM ; APPEND TOOLPATH "CH1"
EDIT NCPROGRAM ; APPEND TOOLPATH "CH2"
EDIT NCPROGRAM ; APPEND TOOLPATH "CH3"
EDIT NCPROGRAM ; APPEND TOOLPATH "CH4"
EDIT NCPROGRAM ; APPEND TOOLPATH "CH5"
EDIT NCPROGRAM ; APPEND TOOLPATH "CH6"
EDIT NCPROGRAM ; APPEND TOOLPATH "CH7"
EDIT NCPROGRAM ; APPEND TOOLPATH "CH8"
EDIT NCPROGRAM ; APPEND TOOLPATH "CH9"

EDIT NCPROGRAM ; APPEND TOOLPATH "ID"
EDIT NCPROGRAM ; APPEND TOOLPATH "Drill"
EDIT NCPROGRAM ; APPEND TOOLPATH "Drill2"
EDIT NCPROGRAM ; APPEND TOOLPATH "Slot"
EDIT NCPROGRAM ; APPEND TOOLPATH "Taper"
EDIT NCPROGRAM 'Bor Mill' SELECT\r 0 NEW
EDIT NCPROGRAM 'Bor Mill' SELECT\r 22 SERIES

EDIT NCPROGRAM 'Bor Mill' ITEM SELECTED COMPONENT SELECTED FIXTUREOFFSET "G55"

// My stuff
STRING $StrSavePath = "E:\Output.tap"
EDIT NCPROGRAM "Bor Mill" FILENAME $StrSavePath
KEEP NCPROGRAM "Bor Mill"
NCTOOLPATH APPLY
NCTOOLPATH ACCEPT

 

The "My Stuff" section previously looked like this:

EDIT NCPROGRAM "Bor Mill" FILENAME FILESAVE

 

In which a save dialog would pop up and then the NC Program window would then to which an operator would click "Write" and then "Accept".  My alterations above doesn't display the NC Program window but it also doesn't save the tap file.   ($StrSavePath is read from a file, that part is not shown.  what is shown above is for debug purposes).

Labels (5)
2 REPLIES 2
Message 2 of 3
TK.421
in reply to: Anonymous

you're looking for something along the lines of this, where the ; is the active nc program instead of the name

    // Post the code with overwrite and close the form
    ACTIVATE NCPROGRAM ; KEEP NCPROGRAM ; \n YES
    TEXTINFO ACCEPT
--------------------------------------
the numbers never lie
Message 3 of 3
Anonymous
in reply to: Anonymous

I was able to solve this by doing the following:

 

EDIT NCPROGRAM "Bor Mill" FILENAME  + '"' + $FilePath + '"'

ACTIVATE NCPROGRAM "Bor Mill" KEEP NCPROGRAM ;

NCTOOLPATH ACCEPT FORM ACCEPT NCTOOLPATHLIST FORM ACCEPT NCTOOLLIST FORM ACCEPT PROBINGNCOPTS

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Technology Administrators


Autodesk Design & Make Report