Hi,
Unfortunately I’m not sure this is possible without exploding your CAD in Revit…
Here’s a link to help you with design script (the language of code blocks) https://dynamobim.org/wp-content/links/DesignScriptGuide.pdf
Hope that’s of interest,
Mark