AcSmComponents17 1.0 library missing/Code Help
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'm not a programmer so my question may seem obvious. I'm trying to run this code and it gives me a library missing error. I changed the reference from 17 to the AcSmComponents18 library. Now it gives me a runtime error "can't create object." [at the Set sheetSetMgr = New AcSmSheetSetMgr line]
Does anyone know how I can get this code to run in ACAD 2010...thx
' Written by Lee Ambrosius ' Date: 3/24/04
' Program is provided AS-IS with no expressed written warranty
' This example demonstrates a couple of the new SheetSet API and some of its
' many properties and methods
Option Explicit
Dim sheetSetMgr As IAcSmSheetSetMgr
Dim sheetdb As IAcSmDatabase
' Lets count up Sheets and iterate through all open SheetSets
Public Sub SetSheetCount()
Dim sheetCount As Integer
Dim iterDb As IAcSmEnumDatabase
Dim ItemDb As IAcSmPersist
Set sheetSetMgr = New AcSmSheetSetMgr
Set iterDb = sheetSetMgr.GetDatabaseEnumerator
Set ItemDb = iterDb.Next
Do While Not ItemDb Is Nothing
Set sheetdb = ItemDb
' Lock Database
LockDatabase
On Error Resume Next
Dim sheet As IAcSmSheet
Dim iter As IAcSmEnumPersist
Dim Item As IAcSmPersist
Set iter = sheetdb.GetEnumerator
Set Item = iter.Next
Do While Not Item Is Nothing
Set sheet = Item
If Item.GetTypeName = "AcSmSheet" Then
sheetCount = sheetCount + 1
End If
Set Item = iter.Next
Loop
' Apply the Sheet Count as a custom property
Dim cBag As IAcSmCustomPropertyBag
Dim cBagVal As New AcSmCustomPropertyValue
Set cBag = sheetdb.GetSheetSet().GetCustomPropertyBag
cBagVal.InitNew cBag
cBagVal.SetFlags CUSTOM_SHEETSET_PROP
cBagVal.SetValue CStr(sheetCount)
cBag.SetProperty "Total Sheets", cBagVal
Set cBagVal = Nothing
' Unlock the database
UnlockDatabase
' Clear and check for next SheetSet that is open
sheetCount = 0
Set ItemDb = iterDb.Next
Loop
End Sub
' Used to Lock the database back up (SheetSet)
Private Sub LockDatabase()
On Error Resume Next
Dim lockStatus As AcSmLockStatus
Let lockStatus = sheetdb.GetLockStatus
If lockStatus = AcSmLockStatus_UnLocked Then
sheetdb.LockDb sheetdb
End If
End Sub
' Used to Unlock the database back up (SheetSet)
Private Sub UnlockDatabase()
On Error Resume Next
Dim lockStatus As AcSmLockStatus
If lockStatus = AcSmLockStatus_Locked_Local Or AcSmLockStatus_Locked_Remote Then
sheetdb.UnlockDb sheetdb
End If
End Sub