Hi Jeff, I'm aware that this is an old topic but this is a great idea, adding a new sheet view set on a sheet set manually takes a lot of time per view.
Can you add more information on how to use the code at post #1
The method is not exposed and using pinvoke
https://docs.microsoft.com/en-us/dotnet/standard/native-interop/pinvokedumpbin.exe can be used to retrieve the function signatures and here are some results for different versions of acad dlls
http://www.theswamp.org/index.php?topic=41527.msg499429#msg499429Here is an example of pinvoke using a win32 unmanaged function
https://docs.microsoft.com/en-us/dotnet/api/system.runtime.interopservices.dllimportattribute?view=net-6.0So once you get that you have the function information and using the
DllimportAttribute you can pass in the arguments to the parameters list below that updated for the function in first post to match the dot net types
- String filename Input fully qualified file name of the DWG file that contains the view; if null, this is assumed to be the current Database
- String viewName Input name of an ViewTableRecord in the drawing referred to by filename
- Point2d position Input desired location of the new viewport in paperspace coordinates of the current layout
- double scale Input scale of the model space within the viewport to the paperspace the viewport is being created in; this effectively dictates the size of the viewport
- ObjectId labelBlock Input object ID of the label block definition to be displayed below the viewport
- out ObjectId viewId Output the ID of an ViewTableRecord for a paperspace view showing the viewport, the label block, and a small padding area around the border on success, or ObjectId.Null otherwise
- out ObjectId vportId Output set to the ID of the Viewport created by this method on success, or ObjectId.Null otherwise
So looks like you will have to have a view created, and if the view is in the current drawing then would pass in a empty string to first argument filename
If you want to use a label block like you can through sheet sets it looks like you need to make sure the block is defined in the drawing and gets its ObjectID and pass that in. Example below I passed in ObjectID.Null so it ignored it and did not place one
Like when using sheetset manager to place views it creates a layout view and viewport which will update the ObjectID passed in last two arguments with the ObjectIDs of the created view and viewport. If you pass in a ID for a label block to be used looks like it doesn't gives you the ID the block reference for the label block
BTW, are you having issues using sheet sets with cloud servers?
I have not used them on a cloud server but from my understanding 2023 has improvements for that and is currently being updated to fix bugs and add more functionality