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 for Workplane at Pick Position on Block - Possible?

9 REPLIES 9
SOLVED
Reply
Message 1 of 10
Anonymous
1886 Views, 9 Replies

Macro for Workplane at Pick Position on Block - Possible?

Is it possible to use a macro to create a workplane that has its location defined by the standard pick points (orange, yellow, green), and work for different block sizes?  The pickpoints seem to be defined by their absolute location not location relative to the block.

 

The workplane location wouldn't have to be at the pick points, as long as the location was always relative to the outer dimensions of the block.Pick Points ShownPick Points Shown

When viewing the command window during picking points is shows the following line:

 [_PICK_21068_\r] 

does anyone know what the number relates to, it changes for each point but seems a bit random.

Any help with this would be appreciated.

Thank you

Tags (3)
9 REPLIES 9
Message 2 of 10
rafael.sansao
in reply to: Anonymous

You can do the calculation and transform the workplane. Here is an example:

REAL $X = $Block.Limits.Xmin + (($Block.Limits.Xmax - $Block.Limits.Xmin) / 2)
REAL $Y = $Block.Limits.Ymin + (($Block.Limits.Ymax - $Block.Limits.Ymin) / 2)
REAL $Z = $Block.Limits.Zmax

CREATE WORKPLANE ; EDITOR
MODE COORDINPUT COORDINATES $X $Y $Z
MODE WORKPLANE_EDIT FINISH ACCEPT
ACTIVATE WORKPLANE #

Rafael Sansão

EESignature

Message 3 of 10
peter.lockyer
in reply to: Anonymous

Yes, there are commands to pick the coloured blobs whilst you're in the mode:

MODE WORKPLANE_CREATE ; INTERACTIVE BLOCK
MODE WORKPLANE_CREATE BLOCK XMIN YMID ZMAX

Obviously, the command takes an X, Y and Z value, and for each a MIN, MID or MAX modifier.

I hope that helps.



Peter Lockyer

Software Development Manager, Fusion 360 Manufacturing and PowerMill

Message 4 of 10
Anonymous
in reply to: rafael.sansao

I think this is definitely going to help, thank you , much appreciated!

 

Message 5 of 10
Anonymous
in reply to: rafael.sansao

Hi Raphael, 

 

I have a couple of questions......

When I try to create a second WP with different values i get several errors "local variable already defined: x" y, z, .

any tips for getting past this? seems like i would need to define a new variable but not sure how to label them.

 

Also when I try to rename the WP

EXPLORER SELECT Workplane "Workplane\1" NEW 
RENAME Workplane "1" "TOP MID"

it only works if I paste it into the command line as a separate function, rather then adding it to the other code.

 

This is one of my first experiments with writing macros, so that's probably half the problem!

Message 6 of 10
rafael.sansao
in reply to: Anonymous

You can create the Workplane with the correct name. It is not necessary to rename.

For the second workplane, you can not declare the variables again.
Check out the example:

// First Workplane
REAL $X = $Block.Limits.Xmin + (($Block.Limits.Xmax - $Block.Limits.Xmin) / 2)
REAL $Y = $Block.Limits.Ymin + (($Block.Limits.Ymax - $Block.Limits.Ymin) / 2)
REAL $Z = $Block.Limits.Zmax

CREATE WORKPLANE "TOP MID" EDITOR
MODE COORDINPUT COORDINATES $X $Y $Z
MODE WORKPLANE_EDIT FINISH ACCEPT
ACTIVATE WORKPLANE #

// Second Workplane
$X = $Block.Limits.Xmin + (($Block.Limits.Xmax - $Block.Limits.Xmin) / 2)
$Y = $Block.Limits.Ymin + (($Block.Limits.Ymax - $Block.Limits.Ymin) / 2)
$Z = $Block.Limits.Zmin

CREATE WORKPLANE "BOTTON MID" EDITOR
MODE COORDINPUT COORDINATES $X $Y $Z
MODE WORKPLANE_EDIT FINISH ACCEPT
ACTIVATE WORKPLANE #

Rafael Sansão

EESignature

Message 7 of 10
Anonymous
in reply to: rafael.sansao

Thanks again for your help Raphael, 

 

I have to remove this line:

ACTIVATE WORKPLANE #

then it to work as anticipated otherwise the  second WP seems to be calculated from the previous WP?

 

Message 8 of 10
rafael.sansao
in reply to: Anonymous

That's right.

Rafael Sansão

EESignature

Message 9 of 10
Anonymous
in reply to: rafael.sansao

Raphael, 

 

This is working really well for me, I was able to have the WP change location relative to block size, and also added some code to orientate the WP.  This is a great platform for me to expand upon.  I'm planning to add some additional clearance WP's for transitional movements between toolpaths.

 

Thanks for helping us!

 

I've attached my macro for reference.

 

 

Tags (3)
Message 10 of 10
rafael.sansao
in reply to: Anonymous

Very good. Congratulations on your work.

If your question has been answered, mark the answer as "accepted solution"

Rafael Sansão

EESignature

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

Post to forums  

Autodesk Design & Make Report