.NET
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Sheet Set: Access Sheet Properties
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
I am able to access(list & modify) custom sheet properties within a sheet set via .GetCustomPropertyBag. How are the OOTB sheet properties accessed? Could someone point me in the right direction?
Thanks.
Chris
Re: Sheet Set: Access Sheet Properties
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Hi Chris,
Do you mean adding the custom properties to a sheet instead of a sheetset ?
If that is the case, it is very similar to the way the custom properties were added to the sheetset.
Here is a sample code :
Private Sub SetSheetCustomProp()
Dim doc As Document
doc = Application.DocumentManager.MdiActiveDocument
Dim ed As Autodesk.AutoCAD.EditorInput.Editor
ed = doc.Editor
sheetSetMgr = New AcSmSheetSetMgr
Dim iterDb As IAcSmEnumDatabase
iterDb = sheetSetMgr.GetDatabaseEnumerator
Dim ItemDb As IAcSmPersist
ItemDb = iterDb.Next
sheetdb = ItemDb
LockDatabase()
Dim sheetsetEnum As IAcSmEnumComponent
sheetsetEnum = sheetdb.GetSheetSet().GetSheetEnumerator()
Dim sheetsetItem As IAcSmComponent
sheetsetItem = sheetsetEnum.Next()
Dim iterator As IAcSmEnumPersist
iterator = sheetdb.GetEnumerator()
Dim item As IAcSmPersist
item = iterator.Next()
While item IsNot Nothing
Dim type As String
type = item.GetTypeName()
Select Case type
Case "AcSmSheet"
'List the sheet
Dim sheet As IAcSmSheet = TryCast(item, IAcSmSheet)
Dim i As Integer
i = 0
Do While i < 5
Dim cBag As IAcSmCustomPropertyBag
Dim cBagVal As New AcSmCustomPropertyValue
cBag = sheet.GetCustomPropertyBag
cBagVal.InitNew(cBag)
cBagVal.SetFlags(PropertyFlags.CUSTOM_SHEET_PROP)
cBagVal.SetValue("Test" + i.ToString())
cBag.SetProperty("Test" + i.ToString(), cBagVal)
cBagVal = Nothing
i = i + 1
Loop
Case Else
ed.WriteMessage("vbCrLfType :" + type)
End Select
item = iterator.Next()
End While
UnlockDatabase()
End Sub
Balaji
Developer Technical Services
Autodesk Developer Network
Re: Sheet Set: Access Sheet Properties
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Hi,
Thanks for the response and code. I was hoping to access the non-custom properties of a sheet like:
Sheet title, Sheet number, Revision number, Revision date, Purpose, Category, Description & Include for publish
I know I can do this through SSM but can I access progrmatically?
Thanks.
Chris
Re: Sheet Set: Access Sheet Properties
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Hi Chris,
Here is a blog post on accessing these properties :
Balaji
Developer Technical Services
Autodesk Developer Network
Re: Sheet Set: Access Sheet Properties
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Thanks! I now see how I can loop through sheets and get the current values. I would now like to modify these values, I noticed the following methods: .SetRevisionNumber, .SetRevisionDate, .SetIssuePurpose and .SetCategory. I tried to update using these methods ( example: mySheet2.SetRevisionNumber("2") ) but got an error. How are these values modified? Thanks again.
Chris
Re: Sheet Set: Access Sheet Properties
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Hi Chris,
What is the error message that you get ? Maybe you havent locked the sheetset database before setting the revision number ?
Here is a sample code to set the revision number for all the sheets in a sheetset :
<CommandMethod("SetRevision")> _
Public Sub SetRevisionMethod()
Dim dstFile As String
dstFile = "C:\Temp\MySheetSet\MySheetSet.dst"
Dim mgr As AcSmSheetSetMgr = New AcSmSheetSetMgr()
Dim db As AcSmDatabase = New AcSmDatabase()
db = mgr.OpenDatabase(dstFile, False)
Dim lockStatus As AcSmLockStatus
lockStatus = db.GetLockStatus
If lockStatus = 0 Then
db.LockDb(db)
End If
Dim ss As AcSmSheetSet = db.GetSheetSet()
Dim EnumSheets As IAcSmEnumComponent = ss.GetSheetEnumerator()
Dim smComponent As IAcSmComponent
Dim sheet As IAcSmSheet
Dim sheet2 As IAcSmSheet2
smComponent = EnumSheets.Next()
While True
If smComponent Is Nothing Then
Exit While
End If
sheet = TryCast(smComponent, IAcSmSheet)
' To access the revision number,
' Revision date, Purpose and Category,
' cast it as IAcSmSheet2
sheet2 = TryCast(smComponent, IAcSmSheet2)
If sheet2 IsNot Nothing Then
sheet2.SetRevisionNumber("111")
End If
smComponent = EnumSheets.Next()
End While
db.UnlockDb(db)
mgr.Close(db)
End Sub
Balaji
Developer Technical Services
Autodesk Developer Network
Re: Sheet Set: Access Sheet Properties
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Thanks, I'll give that a try.
