Macro: Block Z_MAX

Macro: Block Z_MAX

rafael.sansao
Advisor Advisor
1,311 Views
4 Replies
Message 1 of 5

Macro: Block Z_MAX

rafael.sansao
Advisor
Advisor

Hello,

I would like to be checking what is the Z_max of the block (in relation to the workplane of the toolpath). Regardless of the type of block.


Attached is a project with some proposed situations.
Any ideas how to get this value by macro?

 

Note: I currently export the block, import and read the limits. I'm looking for a more effective method.

Rafael Sansão

OptiNC - www.optinc.tech

EESignature

0 Likes
Accepted solutions (1)
1,312 Views
4 Replies
Replies (4)
Message 2 of 5

iamcdn79
Mentor
Mentor

I use this and works for me

 

REAL Top_Of_Block = Block.Limits.ZMax
// MESSAGE INFO "Top Of Block Is $Top_Of_Block"
MESSAGE INFO "Top Of Block Is ${(round(Block.Limits.ZMax , 3))}"

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

0 Likes
Message 3 of 5

rafael.sansao
Advisor
Advisor

Did you open the attached project?
Activate the toolpaths and run your macro. The result is always zero.

Note: In the name of the toolpath it has the value of Z_Max

Rafael Sansão

OptiNC - www.optinc.tech

EESignature

0 Likes
Message 4 of 5

iamcdn79
Mentor
Mentor

Yes I used your attached project, but when I open the block form it has z max as 0 for every toolpath, not sure why it is showing that value for every toolpath. Is that the block after exporting importing?


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

0 Likes
Message 5 of 5

rafael.sansao
Advisor
Advisor
Accepted solution

Problem solved:

REAL ARRAY Lims[] = limits(block)
REAL MaxZ = Lims[5]
MESSAGE INFO $MaxZ

Rafael Sansão

OptiNC - www.optinc.tech

EESignature