How do I disable clearance check for a layer or for only some certain elements?
You can specify a design rule for that component:
Design > Rule > Placement > Component Clearance
,
Add new rule like this:
Advanced query: InComponent('D1') //assume the component is 'D1' Constraints: Min Vertical Clearance 0mil Min Horizontal Clearance 0mil
Then Altium Designer will not check this component's clearance.
This isn't necessarily an answer on how to do this specifically in Altium, but more of a generic thought: why not simply specify the outline of the heatsink so you can see it in the board layout view, and know it's there, but not have it be something that is used in a clearance check?
This seems like the easiest way to approach this sort of problem without having to try and make the program understand exactly what's going on. In fact, it almost seems like more work to try and quantify that there is space under a part. To do it properly, you'd need to quantify the 3D aspect of ALL components on the board so it could properly calculate clearances in 3D.
You can use Design > Rules > Placement > ComponentClearance > New Rule
The lowercase and star after the component are in place in case you have multiple components who have collisions like: usb_1, usb_2 and usb_3
Make sure that the priority of this rule is higher than other rules, who might be conflicting with this one.