.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to add current layout to SSM

3 REPLIES 3
Reply
Message 1 of 4
CADdaddy.com
584 Views, 3 Replies

How to add current layout to SSM

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



3 REPLIES 3
Message 2 of 4
Balaji_Ram
in reply to: CADdaddy.com

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



Balaji
Developer Technical Services
Autodesk Developer Network

Message 3 of 4
CADdaddy.com
in reply to: Balaji_Ram

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:

 

Capture.PNG

 

Message 4 of 4
hgasty1001
in reply to: CADdaddy.com

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

 

 

 

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost