I only work with layers. However in my case everything is visible. There are no hidden objects.
I just need to know which Element is visible within a Detail to export the slected objects along with the detail in seperate files. (One file per drawing).
Actually My app should like this:
loop through all objects der in model space
Delete all objects except the ones visible in the detail
delete all layouts except the current one
save the file as a dwg file
Close the file, reopen it and Export the next layout
This is the only way i found to Export a single layout with its Geometrie as a dwg File.
Commenting on your first post, in rhinoscript, you could enable the detail, after checking that the view is Rhino.IsLayout, then use Rhino.ViewNearCorners to get the array of exact corner 3d points of the open detail, then with this array of points use Rhino.ObjectsByRegion to select the objects in the modelspace, (option to select by window or crossing window).
In your 2nd post, perhaps you could then export (while the detail is still enabled) these selected objects to a file, re-enable the layout, copy the border and relevant detail to the clipboard.
Then open the new file created from ExportSelected using code, in the new file, create a layout to the correct size and paste the border and detail from the clipboard, then close the file again from code… or something along these lines. The border, detail and objects will all be the same locations as the original.
I think this would all be done as a Rhino file, then a further operation with code to save as .dwg, so you’d end up with 2 sets of files, which may (or may not) be beneficial for any further editing.