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
14826 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 2 of 95
kukelyk
in reply to: GlennM.MCAM

//save stockmodel as STL, load as 3d block
STRING stkmd = ""
IF NOT ENTITY_EXISTS('stockmodel','') {
	IF size(FOLDER('stockmodel')) == 0 {
		MESSAGE INFO "There is no stockmodel in the project.."
		MACRO ABORT
	} ELSEIF size(FOLDER('stockmodel')) == 1 {
		$stkmd = (FOLDER('model')[0]).Name
		ACTIVATE STOCKMODEL $stkmd
	} ELSE {
		//there are more stockmodels
		$stkmd = INPUT ENTITY STOCKMODEL "Select stockmodel:"
		ACTIVATE STOCKMODEL $stkmd
	}
} ELSE {
	$stkmd = $ENTITY('stockmodel','').Name
}
STRING stlfile = project_pathname(0) + "_" + $stkmd + ".stl"
EXPORT STOCKMODEL_SHADING ; $stlfile
EDIT BLOCK COORDINATE WORLD
EDIT BLOCKTYPE TRIANGLES
GET BLOCK $stlfile
BLOCK ACCEPT
UNDRAW StockModel $stkmd
Message 3 of 95
GlennM.MCAM
in reply to: kukelyk


@kukelyk wrote:
//save stockmodel as STL, load as 3d block
STRING stkmd = ""
IF NOT ENTITY_EXISTS('stockmodel','') {
	IF size(FOLDER('stockmodel')) == 0 {
		MESSAGE INFO "There is no stockmodel in the project.."
		MACRO ABORT
	} ELSEIF size(FOLDER('stockmodel')) == 1 {
		$stkmd = (FOLDER('model')[0]).Name
		ACTIVATE STOCKMODEL $stkmd
	} ELSE {
		//there are more stockmodels
		$stkmd = INPUT ENTITY STOCKMODEL "Select stockmodel:"
		ACTIVATE STOCKMODEL $stkmd
	}
} ELSE {
	$stkmd = $ENTITY('stockmodel','').Name
}
STRING stlfile = project_pathname(0) + "_" + $stkmd + ".stl"
EXPORT STOCKMODEL_SHADING ; $stlfile
EDIT BLOCK COORDINATE WORLD
EDIT BLOCKTYPE TRIANGLES
GET BLOCK $stlfile
BLOCK ACCEPT
UNDRAW StockModel $stkmd

Triangulation of the stockmodel takes a very long time. The model I am working with now will take an hour to triangulate Smiley Sad


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 4 of 95
kukelyk
in reply to: GlennM.MCAM

Viewmill simulation takes more time, I think..

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

I hope this topic gets a lot  more replies than the old forum page especially from delcam/autodesk staff

 

Here's my 2 cents... trimming macro that lets you create, edit, transform more than 1 trimming boundary. A lot more powerful than the current default one

 

CREATE BOUNDARY ; SKETCH 
EDIT BOUNDARY ; CURVEEDITOR START
CURVEEDITOR MODE LINE_MULTI

then another one to decide to keep inside or outside

 

CURVEEDITOR FINISH ACCEPT

BOOL $side = 0
$side = query "Do you want to Keep Inside?"


EDIT TOOLPATH LIMIT BOUNDARY
EDIT TOOLPATH LIMIT BOUNDARYNAME ;
EDIT TOOLPATH LIMIT BOUNDPLANEOPTIONS VIEW_PLANE
EDIT TOOLPATH LIMIT DELETE N
IF $side {
  EDIT TOOLPATH LIMIT KEEP INNER
} ELSE {
  EDIT TOOLPATH LIMIT KEEP OUTER
}
PROCESS TPLIMIT
DELETE BOUNDARY ;

Wish there was a way to have both macros run as one but as far as I know there isn't


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 6 of 95
kukelyk
in reply to: GlennM.MCAM

//Create plane from block, on the height of a selected point
REAL Z= 9898
$EdgeBreakWidth = $Z
WHILE $Z == 9898 {
	MODE OBTAIN ZHEIGHT 'EdgeBreakWidth'
	$Z = $EdgeBreakWidth
}
MODE CANCEL
CREATE PLANE ; $Z
Message 7 of 95
NanchenO
in reply to: kukelyk

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

Tags (1)
Message 8 of 95
kukelyk
in reply to: NanchenO

What is the goal of the update? Especially if Your toolpaths will be deleted?

Message 9 of 95
NanchenO
in reply to: kukelyk

Since our parts are similar, but never exactly the same, we copy a project under a new name, delete the model, correct the boundaries, curves, patterns... and the blocks. Then we just have to calculate the toolpathes and check them.

 

That is the goal of this macro.

 

Olivier

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

To avoid getting the message that the second point doesn't lie on the same plane when creating a rectangle boundary, hold down the ctrl key

Capture.PNG


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 11 of 95
iamcdn79
in reply to: GlennM.MCAM

To go directly to the bottom of your explorer tree hit the "End" button on your keyboard

 

To go to the top hit "Home"

 

To go incrementally up or down hit "Page Up" or "Page Down"


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 12 of 95
GlennM.MCAM
in reply to: GlennM.MCAM

Hi,

last friday I managed to toggle the drawing of the tool with 1 key (In my case this is F8 but you can choose whatever you want).

This is what I've done: I have 3 macro's. Each macro has it's own function: draw tool, draw tool shaded and undraw tool.

At the end of each macro, the keyshortcut is changed to the next macro (= next tool draw)

 

To get this working save the 3 macro's below (change the path to the correct location!) and then you need to manualy run 1 of the 3 macro's in the navigation menu in order to get the F8 key assigned . After this you just press F8 and it toggles the drawing of the tool.

No toolpaths need to be active.

 

These are the 3 macro's:

 

 

Draw tool, no shade (ToolDraw.mac)

 

//DRAW TOOL
UNDRAW SHADEDTOOLS
DRAW TOOL $Toolpath.Tool

//DELETE PREVIOUS ASSIGNMENT
FORM CUSTOMKEYBOARD
CUSTOMKEYBOARD SELECT MACRO "L:\...\ToolDraw.mac"
CUSTOMKEYBOARD DELETE SELECTED

//SET SHORTCUT F8 TO DRAW TOOL SHADED
CUSTOMKEYBOARD ADD MACRO
CUSTOMKEYBOARD MACRO FILEOPEN
"L:\...\ToolDrawShaded.mac"
CUSTOMKEYBOARD SHORTCUT "0x77" //shortcut: F8
CUSTOMKEYBOARD ASSOCIATE
FORM ACCEPT CUSTOMKEYBOARD

 

 

Draw tool, shaded (ToolDrawShaded.mac)

 

//DRAW TOOL SHADED
DRAW SHADEDTOOLS


//DELETE PREVIOUS ASSIGNMENT
FORM CUSTOMKEYBOARD
CUSTOMKEYBOARD SELECT MACRO "L:\...\ToolDrawShaded.mac"
CUSTOMKEYBOARD DELETE SELECTED

//SET SHORTCUT F8 TO UNDRAW TOOL
CUSTOMKEYBOARD ADD MACRO
CUSTOMKEYBOARD MACRO FILEOPEN
"L:\...\ToolUndraw.mac"
CUSTOMKEYBOARD SHORTCUT "0x77" //shortcut: F8
CUSTOMKEYBOARD ASSOCIATE
FORM ACCEPT CUSTOMKEYBOARD

 

 

Undraw tool (ToolUndraw.mac)

 

//UNDRAW TOOL
UNDRAW TOOL ALL


//DELETE PREVIOUS ASSIGNMENT
FORM CUSTOMKEYBOARD
CUSTOMKEYBOARD SELECT MACRO "L:\...\ToolUndraw.mac"
CUSTOMKEYBOARD DELETE SELECTED

//SET SHORTCUT F8 TO DRAW TOOL
CUSTOMKEYBOARD ADD MACRO
CUSTOMKEYBOARD MACRO FILEOPEN
"L:\...\ToolDraw.mac"
CUSTOMKEYBOARD SHORTCUT "0x77" //shortcut: F8
CUSTOMKEYBOARD ASSOCIATE
FORM ACCEPT CUSTOMKEYBOARD

 

 


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
Tags (1)
Message 13 of 95
kukelyk
in reply to: GlennM.MCAM

Great job.

These will be a bit faster if You modify like this:

//DRAW TOOL
UNDRAW SHADEDTOOLS
DRAW TOOL $Toolpath.Tool

//DELETE PREVIOUS ASSIGNMENT
//FORM CUSTOMKEYBOARD //unnecessary code..
CUSTOMKEYBOARD SELECT MACRO "L:\...\ToolDraw.mac"
CUSTOMKEYBOARD DELETE SELECTED

//SET SHORTCUT F8 TO DRAW TOOL SHADED
CUSTOMKEYBOARD ADD MACRO
CUSTOMKEYBOARD MACRO "L:\...\ToolDrawShaded.mac" // //FILEOPEN unnecessary..

CUSTOMKEYBOARD SHORTCUT "0x77" //shortcut: F8
CUSTOMKEYBOARD ASSOCIATE
//FORM ACCEPT CUSTOMKEYBOARD //unnecessary code..
 

 

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

Capture.PNG

 

The selection tools 'select concave radii' selects all the red rads, to be able to select the green rads create a workplane that is rotated 180 in the Z to the model, make it active and pick 'select concave radii'


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 15 of 95
gosmann.andreas
in reply to: iamcdn79

to del Bad Surfaces

 

UNDRAW LEVEL ALL
DRAW LEVEL "Bad Surfaces"
EDIT LEVEL "Bad Surfaces" SELECT ALL
DELETE MODEL SELECTED
DELETE LEVEL "Bad Surfaces"
DRAW LEVEL ALL
Message 16 of 95
danmic7JH66
in reply to: kukelyk

Oohhhh, I'm going to use that.

Message 17 of 95
danmic7JH66
in reply to: GlennM.MCAM

I export models that I've colored and fixed through powermill so I added this macro to a keyboard shortcut

 

// TURNS DIALOGS OFF

 

DIALOGS MESSAGE OFF

GRAPHICS LOCK

 

// DE-SELECTS ALL MODELS TO ENSURE YOU ARE EXPORTING THE ENTIRE // PART

 

EDIT MODEL ALL DESELECT ALL

 

// ASKS IF YOU MADE SURE THE LEVELS ARE CORRECT

 

string yesnoprompt = "DID YOU DELETE ALL OTHER MODELS, MAKE SURE THE LEVELS ARE CORRECT AND COPY THE MODEL NAME"

bool carryon = 0

$carryon = query $yesnoprompt

IF ($carryon == 1) {

 

// DELETES EMPTY LEVELS AND WORKPLANES

 

DELETE LEVEL EMPTY

DELETE WORKPLANE ALL

 

// TURNS DIALOGS ON

 

DIALOGS MESSAGE ON

GRAPHICS UNLOCK

 

// EXPORTS MODEL

 

EXPORT MODEL ALL FILESAVE

}

 

Using this macro saves me a lot of headaches for a couple reasons. If you have a surface selected powermill will only export out that specific surface. This macro ensures that doesn't happen.

Workplanes also export out on your model and this deletes them before it exports.

I also added a helpful yes no prompt to make sure that I followed my own process properly.

Message 18 of 95
GlennM.MCAM
in reply to: danmic7JH66

@danmic7JH66 I have a variant on your macro. This one exports the model as a ddz file (to use in PowerInspect for example). If 2 or more models are present in the "Models" tree, you get a prompt to ask which one you want to export. It saves the file with the same name that is in the "Models" tree (if model is named "cad-model123" than it will be exported as "cad-model123.ddz". Planes are ignored.

 

STRING LIST models = {}
FOREACH md IN FOLDER('model') {
     IF position($md.name, "Planes") == -1 {
          INT k = add_last($models, $md.name)
     }
}
STRING output_model = ''
IF size($models) == 1 {
     $output_model = $models[0]
} ELSE {
     $output_model = INPUT ENTITY MODEL "Choose model"
}
STRING ddz_filename = dirname(project_pathname(0), '/') +'/' +  $output_model + ".ddz"
EXPORT MODEL $output_model  $ddz_filename
MESSAGE INFO "Model Exported"

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 19 of 95
danmic7JH66
in reply to: GlennM.MCAM

I'll have to take a look at this when I get a few minutes! thanks!


@GlennM.MCAM wrote:

@danmic7JH66 I have a variant on your macro. This one exports the model as a ddz file (to use in PowerInspect for example). If 2 or more models are present in the "Models" tree, you get a prompt to ask which one you want to export. It saves the file with the same name that is in the "Models" tree (if model is named "cad-model123" than it will be exported as "cad-model123.ddz". Planes are ignored.

 

STRING LIST models = {}
FOREACH md IN FOLDER('model') {
     IF position($md.name, "Planes") == -1 {
          INT k = add_last($models, $md.name)
     }
}
STRING output_model = ''
IF size($models) == 1 {
     $output_model = $models[0]
} ELSE {
     $output_model = INPUT ENTITY MODEL "Choose model"
}
STRING ddz_filename = dirname(project_pathname(0), '/') +'/' +  $output_model + ".ddz"
EXPORT MODEL $output_model  $ddz_filename
MESSAGE INFO "Model Exported"

 

Message 20 of 95
danmic7JH66
in reply to: GlennM.MCAM

Since I do all the data prep for my department, I like to define surfaces to chamfer for the guys.  The problem is it takes too long for me to trace a curve out in powershape and add it to a level (for macro selection) so I came up with this.

 

// TURNS DIALOG OFF
// DIALOGS MESSAGE OFF

FOREACH $pal IN folder('model') {

if position ($pal.name,"CAM") >= 0 {
 
FOREACH $mod IN folder('model') {
  STRING Lname = lcase($mod.name)
  if position ($lname,"cam") >= 0 {
 
    STRING path = pathname(mod)
    STRING base = basename(path)

STRING CHAMFERNAME = INPUT "NAME YOUR CHAMFER"

DELETE 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"
RENAME LEVEL "1" $CHAMFERNAME
EDIT LEVEL $CHAMFERNAME ACQUIRE SELECTED
EDIT MODEL "1" CLIPBOARD COPY
EDIT MODEL $BASE CLIPBOARD PASTE
DELETE MODEL "1"
EDIT LEVEL "Wireframes" SELECT ALL
EDIT LEVEL $CHAMFERNAME ACQUIRE SELECTED
DELETE LEVEL EMPTY

// TURNS DIALOG ON
// DIALOGS MESSAGE ON

What it does is creates a pattern off a selected surface, asks you to name the chamfer (for the level), pauses to edit the pattern however is needed in curve editor, converts the pattern to a model, copies the model, pastes it into the workpiece, and finally deletes the pattern model. 

 

By doing this the programmers are able to see how I want things chamfered and I can macro it out.  Not sure how useful it'll be to anybody else but works fantastic for me.

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

Post to forums  

Technology Administrators


Autodesk Design & Make Report