KaiBo Posted January 6, 2009 Share Posted January 6, 2009 I have written some code that pulls sheets and subsets from the sheetset manager, but the information that comes out, is out of order. Is there a way to pull this information out in the same order that it appears in the sheetset manager pallet? Or is there a way to get some kind of index number for each sheet and subset? Pulling the page numbers, does not help, because our page numbers have letters and numbers. Dim ShtNum As String Dim oSubset As AcSmSubset Dim pSubset As AcSmSubset Dim oSheet As AcSmSheet Dim oItem As IAcSmPersist Dim ShSetAR(1 To 3, 1 To 200) As String Dim ShSetARCount As Integer '' Synchronize Sheets with Sheet Properties Private Sub CopyShsetarray() '' Create a Reference to the Sheet Set Manager Object Dim oSheetSetMgr As AcSmSheetSetMgr Set oSheetSetMgr = New AcSmSheetSetMgr '' Get the current Sheet Set Dim oSheetDb As AcSmDatabase Set oSheetDb = oSheetSetMgr.GetDatabaseEnumerator().Next '' Get the objects in the Sheet Set Dim oEnum As IAcSmEnumPersist Set oEnum = oSheetDb.GetEnumerator '' Get the first object in the Enumerator MsgBox oSheetDb.GetFileName Set oItem = oEnum.Next '' Step through all the objects in the Sheet Set MsgBox oItem.GetTypeName Do While Not oItem Is Nothing '' Add Item to Array On Error Resume Next If oItem.GetTypeName = "AcSmSheet" Or oItem.GetTypeName = "AcSmSubset" Then ShSetARCount = 1 + ShSetARCount Set pSubset = oItem.GetOwner() ShSetAR(2, (ShSetARCount)) = pSubset.GetName ShSetAR(3, (ShSetARCount)) = oItem.GetTypeName If oItem.GetTypeName = "AcSmSheet" Then Set oSheet = oItem ShSetAR(1, (ShSetARCount)) = ShtNumFromPath(oSheet.GetLayout.GetFileName) Else Set oSubset = oItem ShSetAR(1, (ShSetARCount)) = oSubset.GetName End If 'MsgBox ShSetARCount & "___" & ShSetAR(1, (ShSetARCount)) & "___" & ShSetAR(2, (ShSetARCount)) & "___" & ShSetAR(3, (ShSetARCount)) End If '' Get the next Sheet Set oItem = oEnum.Next Loop Next End Sub Quote Link to comment Share on other sites More sharing options...
ML0940 Posted January 7, 2009 Share Posted January 7, 2009 Hi Kaibo, I am not totally sure what you are asking, however, this line Dim ShSetAR(1 To 3, 1 To 200) As String 'number of used rows in (1,0) may be a problem. Shouldn't those values be declared as integers as opposed to string variables? ML Quote Link to comment Share on other sites More sharing options...
KaiBo Posted January 7, 2009 Author Share Posted January 7, 2009 Ml0940, no it should not be integers, because I'm not trying to put integers in the array. for each sheet or subset in the sheetset I am putting in the name of the Item, it's parent name, whether it's a sheet or subset, and Ideally it's position in the sheetset. Only the last of these items is an integer, and I can’t figure out how to pull that information yet. I’m basically trying to create a link between our database and our sheetsets, and I need to know the order that things appear in the sheetset, because some of our employs don’t understand the complicated way our package needs to be arranged. Quote Link to comment Share on other sites More sharing options...
ML0940 Posted January 7, 2009 Share Posted January 7, 2009 I see, it is a string array. Yes, I understand the value of Sheet Sets and fields; once they are understood, they are very useful for streamlining some things. I have a VBA project that I did "almost" a year ago; I have been away from CAD and VBA for a few months now, however, I would be glad to share the project with you. I can not guarantee that it will get you what you need, but you can certainly take a look. Also, the sheet set manager automatically creates an index of each drawing. Again, I am rusty, but I may recall that you have have to loop through each Set to get to the subset. Well, if you'd like, I can get you the project? ML Quote Link to comment Share on other sites More sharing options...
KaiBo Posted January 7, 2009 Author Share Posted January 7, 2009 yes I'd love to see what you have done. I know what you mean about getting rusty, I rarely need to program more than once a year. Quote Link to comment Share on other sites More sharing options...
ML0940 Posted January 7, 2009 Share Posted January 7, 2009 The Sheet Sets are tricky, and the VBA code is bizarre, compared to other VBA/ACAD code. I recall spending a lot of time trying to find "any" info on Sheet Set code; there may be more since. OK, I am attaching The Project; you will need to unzip it. The primary function of this project was to deal with custom fields, however, I think that the answer you need "may" be in The CustomSheetSetProps Module, Sub routine: LoopThroughSheets. I believe that I am using all of the functions except for The MiscFunctions, which were extra, for a later time. I hope this helps. Let me know how you make out. ML CustSheetSetProps-1.zip Quote Link to comment Share on other sites More sharing options...
ML0940 Posted January 7, 2009 Share Posted January 7, 2009 Kaibo, I meant to say custom properties and fields, however, the same holds true; you would still need to iterate through each Drawing Set and Subset to get to your custom properties; that is why I am pretty sure that you will find what you need in there. I do recall it working 100%, last time I used it. OK, well, again, let me know how you make out. ML Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.