<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Betreff: Need help altering my macro to create a tool from database in PowerMill Forum</title>
    <link>https://forums.autodesk.com/t5/powermill-forum/need-help-altering-my-macro-to-create-a-tool-from-database/m-p/12637605#M2099</link>
    <description>&lt;P&gt;Ahhhh yes. My template did have a tool built into it. I thought I had saved it without, thank you. Also, the peck depth works, thank you!&lt;/P&gt;</description>
    <pubDate>Wed, 13 Mar 2024 12:21:12 GMT</pubDate>
    <dc:creator>E-Singer89</dc:creator>
    <dc:date>2024-03-13T12:21:12Z</dc:date>
    <item>
      <title>Need help altering my macro to create a tool from database</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/need-help-altering-my-macro-to-create-a-tool-from-database/m-p/12635714#M2095</link>
      <description>&lt;P&gt;So we have a macro that we run for drilling holes in plates. Currently we use one macro to separate the featureset into multiple featuresets by size then a second macro to drill those featuresets. The macro currently creates a new tool based on the featureset size. Is there an easy way to change this so that it first checks the project to make sure the tool doesnt already exist; and then if it doesnt goes and grabs the correct drill from the database to use in the drilling program?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;current macro looks like this&lt;/P&gt;&lt;LI-CODE lang="general"&gt;STRING msg6 = "Please highlight all numbered feature sets." + CRLF + "Then hit RESUME."
MACRO PAUSE $msg6

FOREACH $f IN explorer_selected_entities() {
	REAL d = $f.Name
	IF $d &amp;lt;= 1.0 {
		STRING $dName = "" + $d + ""
		ACTIVATE FEATURESET $dName
			REAL $diameter = $d
			IMPORT TEMPLATE ENTITY TOOLPATH TMPLTSELECTORGUI "deep_drill.ptf"
				EDIT TPPAGE TOOL
				CREATE TOOL ; DRILL
				EDIT TOOL ; DIAMETER $diameter
				EDIT TOOL ; NUMBER COMMANDFROMUI 1
				STRING newTool = $diameter + "_Drill"
				RENAME Tool ; $newTool
			EDIT TPPAGE SWDrilling
			EDIT DRILL TYPE DEEP_DRILL
			EDIT DRILL DEPTH HOLE
			EDIT PAR 'AxialDepthOfCut.UserDefined' '1' EDIT DRILL PECK_DEPTH "0.05"
			EDIT TPPAGE SWToolRapidMv
			EDIT TOOLPATH SAFEAREA CALCULATE_DIMENSIONS
			EDIT TOOLPATH SAFEAREA PLUNGE_SIZE  "0"
			EDIT TPPAGE SWFeedSpeed
			EDIT FEEDRATE CUTTING_SPEED "60"
		
			IF $diameter &amp;gt;= .75 {
			EDIT FRATE "2.0"
			EDIT PRATE "2.0"

			}	ELSE {

			EDIT FRATE "3.0"
			EDIT PRATE "3.0"

			}	
			EDIT COOLANT ON
			EDIT TPPAGE SWDrilling&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Mar 2024 17:32:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/need-help-altering-my-macro-to-create-a-tool-from-database/m-p/12635714#M2095</guid>
      <dc:creator>E-Singer89</dc:creator>
      <dc:date>2024-03-12T17:32:40Z</dc:date>
    </item>
    <item>
      <title>Betreff: Need help altering my macro to create a tool from database</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/need-help-altering-my-macro-to-create-a-tool-from-database/m-p/12637142#M2096</link>
      <description>&lt;P&gt;try this:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;STRING msg6 = "Please highlight all numbered feature sets." + CRLF + "Then hit RESUME."
MACRO PAUSE $msg6

FOREACH $f IN explorer_selected_entities() {
	REAL d = $f.Name
	IF $d &amp;lt;= 1.0 {
		STRING $dName = "" + $d + ""
		ACTIVATE FEATURESET $dName
			REAL $diameter = $d
			IMPORT TEMPLATE ENTITY TOOLPATH TMPLTSELECTORGUI "deep_drill.ptf"


//////////////////////////////////////////////
//get a list of all drills with given diameter
entity list $tools = filter(folder('tool'),'this.Type == "drill" and this.Diameter == "' + $diameter + '"') 


//if list contains any drill with given diameter Activate that tool
if size($tools) &amp;gt; 0 {
	activate tool ${tools[0].Name}
} else {
	
	//check if theres a drill witth given diameter in the tool database
	FORM TOOLDBSEARCH
	TOOLDB QUERY SET TOOL_TYPE DRILL
	TOOLDB QUERY SET MIN_DIAMETER ${diameter}
	TOOLDB QUERY SET MAX_DIAMETER ${diameter}
	TOOLDB QUERY PRESET
	int $num = list_num_rows('ToolDBToolSearch.TDBResultsList')
	
	//if so activate that tool, if not create a tool...
	if $num &amp;gt; 0 {
		TOOLDB RESULTS_LIST SELECT 0 NEW
		TOOLDB RESULTS_LIST CREATE SELECTED
		TOOLDBSEARCH ACCEPT
	} else {
		TOOLDBSEARCH ACCEPT
		//Your Tool Creation Code goes here
		CREATE TOOL ; DRILL
		EDIT TOOL ; DIAMETER $diameter
		EDIT TOOL ; NUMBER COMMANDFROMUI 1
		STRING newTool = $diameter + "_Drill"
		RENAME Tool ; $newTool
	}

}
//////////////////////////////////////////////////////



			EDIT TPPAGE SWDrilling
			EDIT DRILL TYPE DEEP_DRILL
			EDIT DRILL DEPTH HOLE
			EDIT PAR 'AxialDepthOfCut.UserDefined' '1' EDIT DRILL PECK_DEPTH "0.05"
			EDIT TPPAGE SWToolRapidMv
			EDIT TOOLPATH SAFEAREA CALCULATE_DIMENSIONS
			EDIT TOOLPATH SAFEAREA PLUNGE_SIZE  "0"
			EDIT TPPAGE SWFeedSpeed
			EDIT FEEDRATE CUTTING_SPEED "60"
		
			IF $diameter &amp;gt;= .75 {
			EDIT FRATE "2.0"
			EDIT PRATE "2.0"

			}	ELSE {

			EDIT FRATE "3.0"
			EDIT PRATE "3.0"

			}	
			EDIT COOLANT ON
			EDIT TPPAGE SWDrilling

&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 13 Mar 2024 08:24:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/need-help-altering-my-macro-to-create-a-tool-from-database/m-p/12637142#M2096</guid>
      <dc:creator>icse</dc:creator>
      <dc:date>2024-03-13T08:24:54Z</dc:date>
    </item>
    <item>
      <title>Betreff: Need help altering my macro to create a tool from database</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/need-help-altering-my-macro-to-create-a-tool-from-database/m-p/12637495#M2097</link>
      <description>&lt;P&gt;So that worked as intended mostly, thank you! I made sure it didn't try to make new tools once tools were already in the program as well. However, the only odd thing it does that I can't seem to find why is that it's renaming the very first tool it brings in with a name of "1"&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.JPG" style="width: 184px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1336556iB0BBED789EE2D185/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.JPG" alt="Capture.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I did have one other question. I tried searching the forum but only found a solution for when using drilling methods and not standard drilling toolpaths; but is there a way to make it so peck depth is set to .1 of the tool diameter instead of the .05 static peck in the macro? I am new to using macros and the guy that used to write them where i work is no longer with us, so im trying to learn as much as i can.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Mar 2024 11:20:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/need-help-altering-my-macro-to-create-a-tool-from-database/m-p/12637495#M2097</guid>
      <dc:creator>E-Singer89</dc:creator>
      <dc:date>2024-03-13T11:20:15Z</dc:date>
    </item>
    <item>
      <title>Betreff: Need help altering my macro to create a tool from database</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/need-help-altering-my-macro-to-create-a-tool-from-database/m-p/12637542#M2098</link>
      <description>&lt;P&gt;1st point, maybe the tool is contained in your template:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;IMPORT TEMPLATE ENTITY TOOLPATH TMPLTSELECTORGUI "deep_drill.ptf"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;you can add this line to edit the peck depth:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;EDIT PAR 'AxialDepthOfCut.UserDefined' '1' EDIT DRILL PECK_DEPTH ${Tool.Diameter / 10}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Mar 2024 11:52:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/need-help-altering-my-macro-to-create-a-tool-from-database/m-p/12637542#M2098</guid>
      <dc:creator>icse</dc:creator>
      <dc:date>2024-03-13T11:52:24Z</dc:date>
    </item>
    <item>
      <title>Betreff: Need help altering my macro to create a tool from database</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/need-help-altering-my-macro-to-create-a-tool-from-database/m-p/12637605#M2099</link>
      <description>&lt;P&gt;Ahhhh yes. My template did have a tool built into it. I thought I had saved it without, thank you. Also, the peck depth works, thank you!&lt;/P&gt;</description>
      <pubDate>Wed, 13 Mar 2024 12:21:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/need-help-altering-my-macro-to-create-a-tool-from-database/m-p/12637605#M2099</guid>
      <dc:creator>E-Singer89</dc:creator>
      <dc:date>2024-03-13T12:21:12Z</dc:date>
    </item>
  </channel>
</rss>

