archie.manza,
I can do that without any problem but it doesn't really solve my problem. With this solution I now have to insert a minimum of 30 layout templates and edit each one. If I save the template with 30 as my creation template then everytime I open a new dwg I get all 30 whether I want them or not. I need to keep my new drawing template at 1 sheet.
If I use the template with more than one layout tab, I have the same problem. I can etransmit the file to a new directory but the minute I change the name of the file, I have to re associate all of the "expected layout" paths. If there were a way to etransmit, archive or save as a new name without having to reassociate every sheet, I would be in business.
Because you have to edit each sheet properties after creation and re enter the drawing number, I do not think that your solution will be any quicker than manually reassociating the files.
The issue of distinguishing sheet type (VM, IP, FO) and designating standard 1 of 1, 2of 3, etc for 30 sheets is intimidating at best. we have over 100 different possible sheet designations with combinations of 1-6 sheets 1 of 6, 2 of 6, etc.
I would be better off just putting the drawing number hard coded in the title block of each sheet type and then inserting the templates one at a time. But once again, this defeats the use of using prerecorded data in the sheet properties which is where we would gain the most benefit.
What I really could use is a simple vb script that would cycle through the sheet list and update the "expected layout" field. something like:
Code:
Private Sub ChangeProperties() '(sProperty As String, sValue As String, ByVal oSheet As AcSmSheet)
Dim propval As New AcSmCustomPropertyValue
Dim bag As IAcSmCustomPropertyBag
Dim sProperty As String
Dim sValue As String
Dim oSheet As AcSmSheet
Dim ssMgr As IAcSmSheetSetMgr
Set ssMgr = New AcSmSheetSetMgr
Dim mgrIter As IAcSmEnumDatabase
Set mgrIter = ssMgr.GetDatabaseEnumerator
Dim dbCur As IAcSmDatabase
Set dbCur = mgrIter.Next
Dim aSheetSet As IAcSmSheetSet
Do While Not dbCur Is Nothing
Set aSheetSet = dbCur.GetSheetSet
ThisDrawing.Utility.Prompt vbCrLf & aSheetSet.GetName
ThisDrawing.Utility.Prompt vbCrLf & dbCur.GetFileName
Set aSheetSet = Nothing
Set dbCur = mgrIter.Next
Loop
'Set mgrIter = Nothing
'Set ssMgr = Nothing
Set oSheet = dbCur.GetSheetSet
'set oSheet = AcSmSheet.
Set bag = oSheet.GetCustomPropertyBag
PropFlag = CUSTOM_SHEET_PROP ????????????????? < Expected layout here?
propval.InitNew bag
propval.SetFlags PropFlag
propval.SetValue sValue
bag.SetProperty sProperty, propval
Set propval = Nothing
Set bag = Nothing
'Dim ssMgr As IAcSmSheetSetMgr
Set ssMgr = New AcSmSheetSetMgr
Dim db As IAcSmDatabase
Dim dbIter As IAcSmEnumDatabase
Set dbIter = ssMgr.GetDatabaseEnumerator
Set db = dbIter.Next 'gets the first sheet set database from the sheet set manager
'before changing data...
Call db.LockDb(db)
'now write code to change data ????????????????????
'on completion...
Call db.UnlockDb(db)
End Sub
or
Code:
Private Sub LoopThroughSheets(ByVal compEnum As IAcSmEnumComponent)
Dim comp As IAcSmComponent
Set comp = compEnum.Next()
' loop through till the component is Nothing
Do While Not comp Is Nothing
' if the component is a sheet, then...
If comp.GetTypeName = "AcSmSheet" Then
Dim s As AcSmSheet
Set s = comp
Debug.Print " Sheet: " & s.GetName
ChangeProperties "Expected layout", CurrentFilePath, s
' Debug.Print s.GetLayout.GetFileName
' if the componnet is a subset then ...
ElseIf comp.GetTypeName = "AcSmSubset" Then
Dim sset As AcSmSubset
Set sset = comp
' loop through all the sheets.
Call LoopThroughSheets(sset.GetSheetEnumerator)
End If
' next
Set comp = compEnum.Next()
Loop
End Sub
Except I do not know what to put in for:
ChangeProperties "Expected layout", CurrentFilePath, s
I can test the code on Custom properties easily enough but I cannot find documentation that tells me how to change the "Expected layouts"
Bud