Create rectangle pattern from block macro

Create rectangle pattern from block macro

jasmcd1
Observer Observer
491 Views
5 Replies
Message 1 of 6

Create rectangle pattern from block macro

jasmcd1
Observer
Observer

Hi. Pretty new to writing macros in Powermill. I'm trying to write a macro for creating a specific toolpath based on some user input and need to create a rectangle in a pattern based on the block. I've figured it out except for getting the rectangle points from the block. If I just record the macro and pick points it works, but I want to be able to have the macro get the points from the block automatically. Hopes this makes sense. Any ideas? Thank you.

0 Likes
Accepted solutions (1)
492 Views
5 Replies
Replies (5)
Message 2 of 6

TK.421
Advisor
Advisor

you want the x,y corners of the block?

 

REAL xMinus = $toolpath.Block.Limits.XMin

REAL xPlus = $toolpath.Block.Limits.XMax

 

and so on for y and z

 

is that what youre l;ooking for?


the numbers never lie
0 Likes
Message 3 of 6

jasmcd1
Observer
Observer

I think that may be part of the solution, but how do I then use those values to create the rectangle? When I create the rectangle manually I have to pick points (top of block corners in this case) on the screen...

 

jasmcd1_0-1665611227863.png

 

0 Likes
Message 4 of 6

TK.421
Advisor
Advisor
Accepted solution

i see what you're saying

 

try something like this:

REAL xMinus = $toolpath.Block.Limits.XMin
REAL yMinus = $toolpath.Block.Limits.YMin
REAL xPlus = $toolpath.Block.Limits.XMax
REAL yPlus = $toolpath.Block.Limits.YMax

CREATE PATTERN ; EDIT PATTERN ; CURVEEDITOR NOGUI START
CURVEEDITOR MODE RECTANGLE
MODE COORDINPUT COORDINATES $xMinus $yMinus 0
MODE COORDINPUT COORDINATES $xPlus $yPlus 0
CURVEEDITOR FINISH ACCEPT

the numbers never lie
Message 5 of 6

jasmcd1
Observer
Observer

That worked perfectly! Thank you!!!

Message 6 of 6

TK.421
Advisor
Advisor

Awesome!


the numbers never lie
0 Likes