Hi there,
I've been trying to write a program that adds the current layout tab to the SSM. So far I have this:
AcSmAcDbLayoutReference layRef = new AcSmAcDbLayoutReference();
layRef.SetName(LayoutManager.Current.CurrentLayout);
string name = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Name;
layRef.SetFileName(name);
AcSmSheet sheet = sheetSet.ImportSheet(layRef);
My program crashes with "Object reference not set to an instance of an object." when it tries the "AcSmAcDbLayoutReference.SetFileName" method. There is no documentation so I have no idea if I'm doing this right. Any help would be appreciated!!
James LeVieux
Hi James,
Sorry for the delay.
Have you tried the ImportSheet method as demonstrated in this blog post ?
http://adndevblog.typepad.com/autocad/2013/09/using-sheetset-manager-api-in-vbnet.html
Regards,
Balaji
Hi Biagi
Yes...I was using that blog as a guide. I think I see where I went wrong but I still need some help. In the blog post there is a argument called "component" that is passed to the function.I know that a Component can be various SSM types....what exactly is it looking for?. I have no idea what kind of thing I'm supposed to pass to this function as the "component".
Private Function ImportASheet(ByVal component As IAcSmComponent, _ ByVal title As String, _ ByVal description As String, _ ByVal number As String, _ ByVal fileName As String, _ ByVal layout As String) As AcSmSheet Dim sheet As AcSmSheet ' Create a reference to a Layout Reference object Dim layoutReference As New AcSmAcDbLayoutReference layoutReference.InitNew(component)
I changed the code a bit and I am passing a SheetSet as the "component" but I get this error below. I know the SheetSet if valid because I can see the value for the name of the SheetSet in my list of locals:
Hi,
The object ARX SDK have an example of using SSM, its under Samples/dotNet/SheetSet, it may help you to understand the object model. Any way, the "component" in that code it's a SheetSetManager. As the same blog post says, this the way to reference that object:
Dim sheetSetManager As IAcSmSheetSetMgr
sheetSetManager = New AcSmSheetSetMgr
Gaston Nunez