.NET

.NET

Reply
Distinguished Contributor
CADdaddy.com
Posts: 208
Registered: ‎04-10-2005
Message 1 of 6 (279 Views)

finding sheet set properties for current drawing

279 Views, 5 Replies
04-02-2013 04:22 PM

I am writing a program acts on the current drawing by using data in the SSM.  If the current drawing is found to be a member of a sheet set (using sysvar SSFOUND) it cycles through all the sheet in the sheet set looking for a sheet entry that matches.  Sometimes a match is not found because the layout name in the SSM does not match the layout  name in the current tab (sysvar CTAB).  Is there a more directly way...and one that works?  I just need a reliable way to get the AcSmSheet object the correlates to the current drawing.

 

James LeVieux

 

SSM layout problem2.PNG

*Expert Elite*
Hallex
Posts: 1,569
Registered: ‎10-08-2008
Message 2 of 6 (262 Views)

Re: finding sheet set properties for current drawing

04-02-2013 10:12 PM in reply to: CADdaddy.com

See this article it may helps

http://adndevblog.typepad.com/autocad/2012/08/create-a-new-sheet-using-com-sheetset-api.html

_____________________________________
C6309D9E0751D165D0934D0621DFF27919
Distinguished Contributor
CADdaddy.com
Posts: 208
Registered: ‎04-10-2005
Message 3 of 6 (245 Views)

Re: finding sheet set properties for current drawing

04-03-2013 08:28 AM in reply to: Hallex

Thanks for the reply but that article does not address the problem.

 

James

Distinguished Contributor
CADdaddy.com
Posts: 208
Registered: ‎04-10-2005
Message 4 of 6 (238 Views)

Re: finding sheet set properties for current drawing

04-03-2013 10:25 AM in reply to: CADdaddy.com

IAcSmSheetSetMgr.GetSheetFromLayout() looks promising.  No documentation naturally.  Can anyone tell me how to aquire this AXDBLib.AcadObject as a layout?  I was able to add the reference to AXDBlib but I just don't know the AutoCAD API well enough to extract the object in question.

 

GetSheetFromLayout.PNG

 

James

Valued Mentor
DiningPhilosopher
Posts: 370
Registered: ‎05-06-2012
Message 5 of 6 (230 Views)

Re: finding sheet set properties for current drawing

04-03-2013 06:12 PM in reply to: CADdaddy.com

You get the Layout's managed wrapper object, and pass the value of it's AcadObject property. The Layout object can be obtained from the LayoutId property of a BlockTableRecord.

 

If you're not familiar with any of those managed API objects mentioned above, download the available learning materials from Autodesk's web site.

 

Distinguished Contributor
CADdaddy.com
Posts: 208
Registered: ‎04-10-2005
Message 6 of 6 (214 Views)

Re: finding sheet set properties for current drawing

04-04-2013 09:20 AM in reply to: DiningPhilosopher

Thanks!... that got me on the right track.  This basically works:

 

        public AcSmSheet GetCurrentSheet()
        {

            Document doc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
            AcSmSheet sheet=new AcSmSheet();
            AXDBLib.AcadObject obj;   //requires AXDBlib reference
            LayoutManager LM = LayoutManager.Current;
            
            using (Transaction acTrans = doc.Database.TransactionManager.StartTransaction())
            {
                try
                {
                    obj = (AXDBLib.AcadObject)LM.GetLayoutId(LM.CurrentLayout).GetObject(OpenMode.ForRead).AcadObject;
                    sheetSetMgr.GetSheetFromLayout(obj, out sheet);
                }
                catch(System.Exception e)
                {
                    MessageBox.Show("There was an error getting the sheet set info for this layout: " + e.Message);
                }
             }
            return sheet;

        }

 

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.