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: 

Macro to make measurements

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

Macro to make measurements

Good Morning

 

 

Overview ;

I am a very, very forgetful man and I have a habit of forgetting to include some data with my line up sheets. Usually parallel sizing or distance from a face of a vise.  

 

I would like to get around this by having a macro measure the distance of the bottom most part of my "PART" (see screenshot 1) and a pre-defined work plane, then spitting this data out to something I can store and call out on my setup sheet.

 

My measurement work plane (The active one) is static and will always be available. In my PowerMill session it is a point called "Measurement"

My PART measurement point will be dynamic. I'd like to have that assigned by the "Create workplane from block - Block Edge". The problem with that is the pick command.

 

I feel like there are likely some macro commands that will omit clicking entirely that will be what I'm looking for.

 

To break it down process wise;

 

Activate Workplane "Measurement"

Create Workplane based on the Y- block edge

Name this WorkPlane "Measurement - Part"

Measure relative distance between Measurement and Measurement - Part

Save Y value as "YDistance"

Save Z value as "ZDistance"

Save X value as "XDistance"

 

I would then like to write these values to my NC Program notes

 

 

A1 - Part.PNGA2 - Vise.PNGA3 - Vise + part.PNG

 

Any and all help is appreciated. I may be going about this the wrong way entirely.

2 REPLIES 2
Message 2 of 3
LasseFred
in reply to: Anonymous

// Check to see if the project variable "XYZ_MAAL" already exists
BOOL $chk = 0
$chk = ERROR $project.XYZ_MAAL
if $chk {
// Project variable does not exist so create it!.... Use EDIT PAR CREATE STRING "XYZ_MAAL" ...... for a global STRING variable
EDIT PAR CREATE STRING "XYZ_MAAL"
}
// Edit the value of the project variable
$project.XYZ_MAAL = " [NONE] "

// Check to see if the project variable "Block_Z_MIN" already exists
BOOL $chk1 = 0
$chk1 = ERROR $project.Block_Z_MIN
if $chk1 {
// Project variable does not exist so create it!.... Use EDIT PAR CREATE STRING "Block_Z_MIN" ...... for a global STRING variable
EDIT PAR CREATE STRING "Block_Z_MIN"
}
// Edit the value of the project variable
$project.Block_Z_MIN = " [NONE] "


// FORM BLOCK
EDIT MODEL ALL DESELECT ALL
DRAW BLOCK
EDIT BLOCK RESETLIMIT "0"
EDIT BLOCKTYPE BOX
EDIT BLOCK LIMITTYPE MODEL
EDIT BLOCK RESET

REAL $BLOCK_LENGTH_X = (-1 * round(Block.Limits.XMin;3)) + round(Block.Limits.XMax;3)
REAL $BLOCK_LENGTH_Y = (-1 * round(Block.Limits.YMin;3)) + round(Block.Limits.YMax;3)
REAL $BLOCK_LENGTH_Z = (-1 * round(Block.Limits.ZMin;3)) + round(Block.Limits.ZMax;3)
REAL $BLOCK_MIN_Z = (round(Block.Limits.ZMin;3))


$project.XYZ_MAAL = "FÆRDIG MÅL : X " + $BLOCK_LENGTH_X + " Y " + $BLOCK_LENGTH_Y + " Z " + $BLOCK_LENGTH_Z
$project.Block_Z_MIN = $BLOCK_MIN_Z


UNDRAW BLOCK

BLOCK CANCEL
EDIT MODEL ALL DESELECT ALL
BLOCK CANCELLED

it makes project variables 

______________________
Lasse F.
Message 3 of 3
Anonymous
in reply to: LasseFred

Saving the block dimensions as a variable is something we already do so I'm turbo-dumb for missing it as a valid way to measure two points.

 

Thanks!

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

Post to forums  

Autodesk Design & Make Report