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: 

Tips & Tricks

94 REPLIES 94
Reply
Message 1 of 95
GlennM.MCAM
14107 Views, 94 Replies

Tips & Tricks

Hi all!

I thought it would be a good idea to post some tips and tricks for certain actions. Some of you will know them, other don't.
Please post as much tips & tricks as you want. Here are mine:

 

 

Since it is not possible to export the stockmodel as a dmt file, I save the viewmill state as dmt and use that as a block.

 

 

If you need a selection of your model and want to save this selection, use this macro:

CREATE LEVEL ; MODELCOMPSET EDIT LEVEL # ACQUIRE SELECTED

Greetings,

Glenn


Intel i7 4790 @ 3.60GHz -16GB RAM - Nvidia Quadro K620 - 250GB SSD - Win 7 Pro x64 SP1
PowerMILL Premium 2019.1 - PowerINSPECT Ultimate OMV 2017 SP6
94 REPLIES 94
Message 81 of 95
danmic7JH66
in reply to: jjohnybgood

@jjohnybgood wrote:

Hi danmic7JH66,

Can this be changed to also work from active NC Programme? ie where you have a number of toolpaths in the NC Programme then use macro to display details?


Yeah I don't think that's a problem, I'd have to look into it later on tomorrow night. Give me a couple days.

Message 82 of 95
iamcdn79
in reply to: GlennM.MCAM

If you are like me and have had a hard time rotating your model when you are zoomed in then you might like this macro. Basically, you are asked where you would like to drop a point on your model that you would like to rotate about, it creates a temporary workplane which is then deleted and you are allowed to rotate about that point. See video here of an example 

 

The macro is activated by right-clicking anywhere on your background.

 

To do this 

1) IT IS VERY IMPORTANT you make a backup copy of the original default.ppm file located in C:\Program Files\Autodesk\PowerMill 2019\sys\hci\popups

 

2)Add these lines to the default.ppm file 

	  <spacer/>
      <button
        command="macro 'C:\dcam\macros\Rotation for custom toolbar'"
        label="Rotate On"
      />
	   <spacer/>
      <button
        command='VIEW CENTRE VIEW'
        label="Rotate Off"

 See example

Capture.PNG

 

3) Add the attached macro to C:\dcam\macros dir 

 


Intel Core i9 13900KF CPU
128 GB Kingston Beast DDR4 SDRAM
PNY RTX A2000 6GB Video Card
WD 1 TB SSD Hard Drive
Windows 11 Pro

Message 83 of 95
kukelyk
in reply to: iamcdn79

i think there should be a final "/>" to the ppm file ..

 

Message 84 of 95
kukelyk
in reply to: iamcdn79

I made some modification, for projects without toolpaths:

STRING active_tp = ""
IF ENTITY_EXISTS('toolpath', '') {
	$active_tp = $toolpath.name
}

STRING $New_Workplane_Name = new_entity_name('workplane') 
MESSAGE INFO $New_Workplane_Name
IC TOOLPATHS YES
MODE WORKPLANE_CREATE ; INTERACTIVE POINT
WHILE NOT ENTITY_EXISTS('workplane', $New_Workplane_Name) {
	//Stay in loop till user click..
} 


ACTIVATE WORKPLANE # 
VIEW CENTRE ORIGIN  
DELETE WORKPLANE ;
IF $active_tp != "" {
	ACTIVATE TOOLPATH $active_tp
	ACTIVATE WORKPLANE FROMENTITY TOOLPATH ;
}
 // Turn Toolpath Snapping Off
IC TOOLPATHS NO

..and work fine, if I call macro "this_macro.mac", but it cause pmill crash, if called thru context menu.

and it would eliminate macro pause window..

What do You think, what is the problem?

Message 85 of 95
GlennM.MCAM
in reply to: GlennM.MCAM

This macro can be used for cylindrical parts if you want your model to be in XY center of the world workplane.

Just click the cylindrical surface on your model and run the macro.

 

Video: https://autode.sk/2PTBL5N

 

Macro:

 

 

INT countSurface = 0
FOREACH m in folder('model') {
$countSurface = $countSurface + number_selected(m.Components)
}
IF $countSurface > 0 {
EDIT BLOCK ALL UNLOCK
EDIT BLOCKTYPE CYLINDER
EDIT BLOCK TOLERANCE "0.010"
EDIT BLOCK RESET
REAL CentX = ($Block.Centre.X)*-1
REAL CentY = ($Block.Centre.Y)*-1
CREATE LEVEL ; MODELCOMPSET
EDIT LEVEL # ACQUIRE SELECTED
ACTIVATE Level #
EDIT MODEL ALL DESELECT ALL
TRANSFORM RESET TRANSFORM TYPE MOVE TRANSFORM MOVEX
$CentX
TRANSFORM MODEL ALL
TRANSFORM RESET TRANSFORM TYPE MOVE TRANSFORM MOVEY
$CentY
TRANSFORM MODEL ALL
EDIT LEVEL # SELECT ALL
EDIT BLOCK RESET
DELETE Level #
REAL CenterXaftermove = ROUND($Block.Centre.X, 10)
REAL CenterYaftermove = ROUND($Block.Centre.Y, 10)
REAL Diameter = ROUND(Block.Diameter, 5)
MESSAGE INFO "X Centre= $CenterXaftermove" +CRLF+ "Y Centre= $CenterYaftermove" +CRLF+ "Diameter= $Diameter"

} ELSE {
MESSAGE WARN "No surfaces selected"
}

 

 


Intel i7 4790 @ 3.60GHz -16GB RAM - Nvidia Quadro K620 - 250GB SSD - Win 7 Pro x64 SP1
PowerMILL Premium 2019.1 - PowerINSPECT Ultimate OMV 2017 SP6
Message 86 of 95
rui_rita
in reply to: GlennM.MCAM

Hi

Some people miss the "old" edit holes function

 

see screencast

 

copy the xml file to \config\pmll4\ ( or whatever you use)

 

 



Os melhores cumprimentos | Best regards
Rui Rita
________________________________
NEWCAM, Lda.
Message 87 of 95
kishormahajan
in reply to: NanchenO

can you explain me ,
how do its work.


@NanchenO wrote:

Update all the blocks, according to their types:

// Macro pour mettre a jout les bruts
// Close the logfile if it was left open from a previous macro
DIALOGS MESSAGE OFF
FILE CLOSE logfile
DIALOGS MESSAGE ON

// Deletes the old results
DELETE FILE C:\temp\brut.txt
STRING logfile = "C:\temp\brut.txt"
// Open (Overwrite) the file specified by the user
FILE OPEN $logfile FOR WRITE AS logfile
STRING $head = 'Resume de la macro'
FILE WRITE $head TO logfile
$head = ' '
FILE WRITE $head TO logfile

STRING $brut = ''
STRING $path = ''
STRING $Rep = ''
STRING $data = ''
STRING $upd = ''
STRING $oldpath=''
STRING $oldrep=''
BOOL $frontiere = 0
REAL $max = 99999.999
REAL $min = -99999.999

EDIT PREFERENCE SELRAISEFORM NO
DEACTIVATE TOOLPATH

FOREACH ent IN folder("TOOLPATH") {
	ACTIVATE TOOLPATH $ent
	If $Toolpath.Block.Type == "triangles" {
		If $brut == '' {
			$brut = FILESELECT "Selectionner le nouveau brut" "*.dmt; *.prt.*"
			$path = "'" + $brut + "'"
		}
		If $Rep == '' {
			$Rep = INPUT ENTITY WORKPLANE "Selectionner le plan de travail du brut"
		}
		$oldpath=$toolpath.Block.FileName
		$oldrep=$toolpath.Block.NamedWorkplane.Name
		//If $oldpath!= $path {
			If $Statistics.CuttingMoves.Lengths.Linear != 0 {
				INVALIDATE TOOLPATH $ent
				YES
			}
			EDIT TPPAGE SWBlock
			EDIT BLOCKTYPE TRIANGLES
			EDIT BLOCK COORDINATE NAMED
			EDIT BLOCK NAMEDWORKPLANE $Rep
			$ent.Block.FileName = $brut
			GET BLOCK $brut
			BLOCK ACCEPT
			EDIT BLOCK NAMEDWORKPLANE $Rep
			DRAW BLOCK
			EDIT BLOCK UPDATEFORM
			EDIT TOOLPATH $ent REAPPLYFROMGUI
			YES
			$data = ($toolpath.name + ', Type : ' + $toolpath.Block.Type + ', Repere : ' + $Rep + ', Fichier : ' + $path)
			FILE WRITE $data TO logfile
			$data = ('')
			FILE WRITE	$data TO logfile
			//} else {
			//$data = ($toolpath.name + ', Type : ' + $toolpath.Block.Type + ', Repere : ' + $Rep + ', Fichier : ' + $path)
			//FILE WRITE $data TO logfile
			//$data = ('')
			//FILE WRITE	$data TO logfile
		//}
	}
	If $Toolpath.Block.Type == "box" {
		IF entity_exists(Boundary) {
			BOOL $frontiere = 1
			If $Statistics.CuttingMoves.Lengths.Linear != 0 {
				INVALIDATE TOOLPATH $ent
				YES
			}
			EDIT TPPAGE SWBlock
			EDIT BLOCKTYPE BOX
			EDIT BLOCK NAMEDWORKPLANE $toolpath.workplane.name
			EDIT BLOCK LIMITTYPE BOUNDARY
			EDIT BLOCK RESET
			EDIT BLOCK ZMIN UNLOCK
			EDIT BLOCK ZMAX UNLOCK
			$max = ($ZRange.Maximum.Value + 1.0)
			$min = ($ZRange.Minimum.Value - 1)
			EDIT BLOCK ZMIN $min
			EDIT BLOCK ZMAX $max
			EDIT BLOCK ZMIN LOCK
			EDIT BLOCK ZMAX LOCK
			EDIT BLOCK RESET
			EDIT BLOCK UPDATEFORM
			EDIT TOOLPATH $ent REAPPLYFROMGUI
			STRING $data = ($toolpath.name + ', Type : ' + $toolpath.Block.Type + ', Frontiere : ' + $Boundary.Name + ', Zmax ' + $max  + ', Zmin ' + $min)
			FILE WRITE $data TO logfile
			$data = ('')
			FILE WRITE $data TO logfile
		} Else {
		STRING $data = ($toolpath.name + ', Type : ' + $toolpath.Block.Type + ', PAS DE FRONTIERE !!! -> PAS TRAITE !!!')
		FILE WRITE $data TO logfile
		$data = ('')
		FILE WRITE	$data TO logfile
		}
	}
	If $Toolpath.Block.Type == "cylinder" {
		IF entity_exists(Boundary) {
			BOOL $frontiere = 1
			If $Statistics.CuttingMoves.Lengths.Linear != 0 {
				INVALIDATE TOOLPATH $ent
				YES
			}
			EDIT TPPAGE SWBlock
			EDIT BLOCKTYPE CYLINDER
			EDIT BLOCK NAMEDWORKPLANE $toolpath.workplane.name
			EDIT BLOCK LIMITTYPE BOUNDARY
			EDIT BLOCK RESET
			EDIT BLOCK ZMIN UNLOCK
			EDIT BLOCK ZMAX UNLOCK
			$max = ($ZRange.Maximum.Value + 1.0)
			$min = ($ZRange.Minimum.Value - 1)
			EDIT BLOCK ZMIN $min
			EDIT BLOCK ZMAX $max
			EDIT BLOCK ZMIN LOCK
			EDIT BLOCK ZMAX LOCK
			EDIT BLOCK RESET
			EDIT BLOCK UPDATEFORM
			EDIT TOOLPATH $ent REAPPLYFROMGUI
			STRING $data = ($toolpath.name + ', Type : ' + $toolpath.Block.Type + ', Frontiere : ' + $Boundary.Name + ', Zmax ' + $max  + ', Zmin ' + $min)
			FILE WRITE $data TO logfile
			$data = ('')
			FILE WRITE $data TO logfile
		} Else {
		STRING $data = ($toolpath.name + ', Type : ' + $toolpath.Block.Type + ', PAS DE FRONTIERE !!! -> PAS TRAITE !!!')
		FILE WRITE $data TO logfile
		$data = ('')
		FILE WRITE	$data TO logfile
		}	
	}
	If $Toolpath.Block.Type == "boundary" {
		IF entity_exists(Boundary) {
			BOOL $frontiere = 1
			If $Statistics.CuttingMoves.Lengths.Linear != 0 {
				INVALIDATE TOOLPATH $ent
				YES
			}
EDIT TPPAGE SWBlock
	EDIT BLOCKTYPE BOUNDARY
	EDIT BLOCK NAMEDWORKPLANE $toolpath.workplane.name
	EDIT BLOCK LIMITTYPE BOUNDARY
	EDIT BLOCK RESET
	EDIT BLOCK ZMIN UNLOCK
	EDIT BLOCK ZMAX UNLOCK
	REAL $max = ($ZRange.Maximum.Value + 1.0)
	REAL $min = ($ZRange.Minimum.Value - 1)
	EDIT BLOCK ZMIN $min
	EDIT BLOCK ZMAX $max
	EDIT BLOCK ZMIN LOCK
	EDIT BLOCK ZMAX LOCK
	EDIT BLOCK RESET
	EDIT BLOCK UPDATEFORM
	EDIT TOOLPATH $ent REAPPLYFROMGUI
	
	EDIT TPPAGE SWBlock
	EDIT BLOCKTYPE BOUNDARY
	EDIT BLOCK NAMEDWORKPLANE $toolpath.workplane.name
	EDIT BLOCK LIMITTYPE BOUNDARY
	EDIT BLOCK RESET
	EDIT BLOCK ZMIN UNLOCK
	EDIT BLOCK ZMAX UNLOCK
	$max = ($ZRange.Maximum.Value + 1.0)
	$min = ($ZRange.Minimum.Value - 1)
	EDIT BLOCK ZMIN $min
	EDIT BLOCK ZMAX $max
	EDIT BLOCK ZMIN LOCK
	EDIT BLOCK ZMAX LOCK
	EDIT BLOCK RESET
	EDIT BLOCK UPDATEFORM
	EDIT TOOLPATH $ent REAPPLYFROMGUI
			STRING $data = ($toolpath.name + ', Type : ' + $toolpath.Block.Type + ', Frontiere : ' + $Boundary.Name + ', Zmax ' + $max  + ', Zmin ' + $min)
			FILE WRITE $data TO logfile
			$data = ('')
			FILE WRITE $data TO logfile
		} Else {
		STRING $data = ($toolpath.name + ', Type : ' + $toolpath.Block.Type + ', PAS DE FRONTIERE !!! -> PAS TRAITE !!!')
		FILE WRITE $data TO logfile
		$data = ('')
		FILE WRITE	$data TO logfile
		}		
	}
	If $Toolpath.Block.Type == "picture" {
		STRING $data = ($toolpath.name + ', Type : ' + $toolpath.Block.Type + ', TYPE IMAGE -> PAS TRAITE !!!')
		FILE WRITE $data TO logfile
		$data = ('')
		FILE WRITE	$data TO logfile
	}
	DEACTIVATE TOOLPATH
	DEACTIVATE BOUNDARY
}

EDIT PREFERENCE SELRAISEFORM YES

FILE CLOSE logfile
OLE FILEACTION 'open' $logfile

 

Olivier


 

Message 88 of 95
iamcdn79
in reply to: GlennM.MCAM

With the new dynamic rotation feature that is out in the latest version of 2019 it cannot rotate around a toolpath due to the limitation of it taking to much memory or being slow.

 

I find it especially difficult to rotate when I have my model turned off and just my toolpath on, so I have created a macro that creates a temporary pattern for the active toolpath and rotates around that pattern that is overlayed over the toolpath, when you are finished rotating around the pattern simply accept the macro pause and it will delete the temporary pattern and you can go about your daily routine.

 

FUNCTION MAIN {
STRING Msg = ""
STRING Name = "Toolpath Rotation"
IF folder_exists("Pattern\"+$Name) {
ACTIVATE FOLDER ${"Pattern\"+$Name}
} ELSE {
 CREATE FOLDER "Pattern" $Name
 ACTIVATE FOLDER ${"Pattern\"+$Name}
}
VIEW CENTRE DYNAMIC
CREATE PATTERN ;
EDIT PATTERN ; INSERT TOOLPATH ;
DEACTIVATE TOOLPATH
DRAW Toolpath #
EDIT PATTERN ; CURVEEDITOR START
MACRO PAUSE $Msg
CURVEEDITOR FINISH ACCEPT
DELETE PATTERN ;
ACTIVATE TOOLPATH #
DELETE PATTERN FOLDER ${"Pattern\"+$Name}
}

 


Intel Core i9 13900KF CPU
128 GB Kingston Beast DDR4 SDRAM
PNY RTX A2000 6GB Video Card
WD 1 TB SSD Hard Drive
Windows 11 Pro

Message 89 of 95
5axes
in reply to: iamcdn79

New version of the macro to measure and display Draft angle Value.

 

//------------------------------------------------------------------------------------------------------------
// Measure and display draft angle Value
// F2 to call the macro
//   -- Press F2 Each time you want to measure a new angle
// 	
// Release 25/10/2017
// Release 12/07/2018  Modification with a time limitation to 60s to pick one point on the part
//------------------------------------------------------------------------------------------------------------

FUNCTION MAIN() {
	REAL $TLimit = 200  // Time Limit in S / 0.25 to select a position

	VIEW MODEL ; SHADE UNDERCUT
	ECHO OFF DCPDEBUG UNTRACE COMMAND ACCEPT
	DIALOGS MESSAGE OFF

	MEASURE CLEAR_ALL MODE VECTOR START MEASURE DIRECTION
	MODE DIRECTION ALIGN GEOM
		
	BOOL $F_E=FALSE
	REAL $LIMIT_WHILE=0
        REAL $Timer = 0.25
	
	DO {
		WAIT $Timer
// Detect the point selection $F_E=BOOL($widget('DirectionInput.Accept').Sensitive) $LIMIT_WHILE=$LIMIT_WHILE+$Timer IF $LIMIT_WHILE>$TLimit { DIRECTION CANCEL MESSAGE ERROR "Exceeded time for point selection $TLimit : $LIMIT_WHILE" MACRO ABORT } } WHILE NOT $F_E // Get the Direction vector REAL V_I= REAL($widget('DirectionInput.DirectionFrame.I').value) REAL V_J= REAL($widget('DirectionInput.DirectionFrame.J').value) REAL V_K= REAL($widget('DirectionInput.DirectionFrame.K').value) REAL Calc =0 IF $V_K == 0 { $Calc=90 } ELSE { $Calc=sqrt(($V_I*$V_I)+($V_J*$V_J)) // PRINT $Calc $Calc = Atan($Calc/$V_K) IF $Calc > 180 { $Calc=$Calc-180 } } DIRECTION CANCEL DIALOGS MESSAGE ON STRING $Result = "Draft angle : " + $round($Calc,2) MESSAGE INFO $Result }
Message 90 of 95
Anonymous
in reply to: GlennM.MCAM

I ran across this thread and thought it was a shame that it disappeared so, I hope we can bring it back to the front again.

 

One thing I use all the time is a simple macro to reapply my updated settings after I change them on an uncalculated toolpath. I'll have many uncalculated and don't want to wait for the form to close then open the next one. This will apply the settings(same as hitting OK) but, the form doesn't close. I can then activate the next one and apply again as many times I want without the form closing. Truthfully, this should be added as an option on the toolpath form.

 

EDIT TOOLPATH # REAPPLY

 

Also attached is a macro that I use for electrodes. It will program the electrode with .005 orbit, .008 orbit, and .01 orbit. All I do is bring in the electrode and save it then the macro does the rest for me. The toolpath templates are done in the long form way(there's probably a better way to do it) but, I like it this way. It makes it easier to make adjustments to the toolpath parameters if I need to change them. This macro has little bits of many of the macros posted on the forum. Thanks to everyone for posting so I could create it. There are some level and color specific calls in the macro so if anyone is interested, I can post a project for you to check out. I have many of these with different tools that I can chose from depending on the geometry of the electrode.

 

Message 91 of 95
LAV_PERM77
in reply to: iamcdn79

hello.
HOW DO I ADD A MENU ITEM TO SEVERAL SELECTED TRAJECTORIES ?

2023-01-03_19-25-54.png

 

Found how to add a menu if one trajectory is selected (C:\Program Files\Autodesk\PowerMILL 2020\sys\hci\popups\explorer), and I can't find where the menu for the selected set is.

Message 92 of 95
iamcdn79
in reply to: GlennM.MCAM

You need to create a file called Toolpath.xml and put it into C:\dcam\pmill2.


Intel Core i9 13900KF CPU
128 GB Kingston Beast DDR4 SDRAM
PNY RTX A2000 6GB Video Card
WD 1 TB SSD Hard Drive
Windows 11 Pro

Message 93 of 95
dianepokin
in reply to: GlennM.MCAM

facing error

ELETE LEVEL EMPTY
CREATE PATTERN ;
EDIT PATTERN ; INSERT MODEL
EDIT PATTERN ; CURVEEDITOR START
MACRO PAUSE "VERIFY/EDIT CHAMFER SEGMENTS"
CURVEEDITOR FINISH ACCEPT
EDIT MODEL ALL DESELECT ALL
EDIT PATTERN ; CLIPBOARD COPY
CREATE MODEL CLIPBOARD
DELETE PATTERN ALL
CREATE LEVEL ; LEVEL
ACTIVATE LEVEL "1"
Message 94 of 95

here is a macro that turn on View MIll , and as what toolpaths to simulate, and if you want to pause in between toolpaths. ( tips: you can slow down toolpath using the slider, if the simulation errors out, and wants to go to next toolpath without the previous toolpath being finished simulated,  you can press the play button to allow it to continue and finish it before next simulation.

 

 

 

 

//DEFINE BLOCK BEFORE IT SIMULATES SELECTED TOOLAPTHS 
 
RESET LOCALVARS
//UNSET MACROFIX
 
UNDRAW STOCKMODEL ALL
SIMULATE VIEWMILL SUSPEND
 
ENTITY LIST $SELECTED_TOOLPATHS = INPUT ENTITY MULTIPLE TOOLPATH "SELECT TOOLPATHS TO BE ADDED"
FORM RIBBON TAB "Tool"
DRAW SHADEDTOOLS
SIMULATE VIEWMILL START
SIMULATE VIEWMILL SHADING RAINBOW
EDIT PAR 'Simulation.Speed' 75
 
//STRING LIST $COUNTY = $SELECTED_TOOLPATHS
//i = size(COUNTY)
bool carryon = ""
string yesnoprompt = "Would you like the ViewMill to pause in between programs?"
$carryon = query $yesnoprompt
 
IF ($carryon == 0) {
FOREACH tp IN $SELECTED_TOOLPATHS { 
ACTIVATE TOOLPATH $tp.Name 
PRINT $tp.Name
SIMULATE TOOLPATH ; FORM RIBBON TAB SIMULATION
SIMULATE PLAY
    }
} ELSE { 
FOREACH tp IN $SELECTED_TOOLPATHS { 
ACTIVATE TOOLPATH $tp.Name 
PRINT $tp.Name
SIMULATE TOOLPATH ; FORM RIBBON TAB SIMULATION
SIMULATE PLAY
DEACTIVATE Toolpath
MACRO PAUSE "TOOLPATH SIM PAUSED"  
}
}
 
PRINT = size($COUNTY)
 
 
MACRO ABORT
Message 95 of 95
icse
in reply to: GlennM.MCAM

Ever whished for a universal delete selected hotkey?

 

Heres a macro that checks wich entity types are selected, then let you chose one and deletes the selected parts.

I bound it to CTRL+D.

 

The drop down menue can be navigated by the mousewheel.

 

string list $rootTypes = {'featureset','pattern','boundary','model'}
string list $selectedTypes = {}

foreach $rt in $rootTypes {
	if entity_exists(entity($rt,'')) {
		entity $ent = entity($rt,'')
		if number_selected($ent.RootType, $ent.Name) > 0 {
			int $i = add_last($selectedTypes,$rt)
		}
	}
} 


if entity_exists(entity('toolpath','')) and entity('toolpath','').Computed {

	graphics lock
	
	bool $wasVisible = widget('TPList').Visible
	FORM TPLIST
	
	bool $isSelected = size(filter(selected_list_rows('TPList.TPListView'),'this == 1')) > 0
	
	if not $wasVisible {
		TPLIST ACCEPT
	}
	graphics unlock
	
	if $isSelected {
		int $i = add_last($selectedTypes,'toolpath')
	}	

}




if size($selectedTypes) <= 0 {
	return
}
int $index = -1

if size($selectedTypes) == 1 {
	$index = 0
} else {
	$index = input choice $selectedTypes 'Select type to remove:'
} 

if $index != -1 {
	String $cmd = 'DELETE ' + $selectedTypes[$index] + ' "' + entity($selectedTypes[$index],'').Name + '" SELECTED'	
	DoCommand $cmd
}

 

 

Not tested it but pm 2025 users could also use number_selected() insted of selected_list_rows('TPList.TPListView') for toolpaths.

 

Should look somehting like this:

 

string list $rootTypes = {'toolpath','featureset','pattern','boundary','model'}
string list $selectedTypes = {}

foreach $rt in $rootTypes {
	if entity_exists(entity($rt,'')) {
		entity $ent = entity($rt,'')
		if number_selected($ent.RootType, $ent.Name) > 0 {
			int $i = add_last($selectedTypes,$rt)
		}
	}
} 


if size($selectedTypes) <= 0 {
	return
}
int $index = -1

if size($selectedTypes) == 1 {
	$index = 0
} else {
	$index = input choice $selectedTypes 'Wich Type to remove?'
} 

if $index != -1 {
	String $cmd = 'DELETE ' + $selectedTypes[$index] + ' "' + entity($selectedTypes[$index],'').Name + '" SELECTED'	
	DoCommand $cmd
}

 

 

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

Post to forums  

Technology Administrators