.NET

.NET

Reply
Active Contributor
adamkalajzich
Posts: 32
Registered: ‎09-20-2009
Message 1 of 14 (485 Views)

Sheet set custom property field "TransmittalSetups"

485 Views, 13 Replies
12-12-2012 05:59 PM

Hello all,

 

Been a while since I asked a question here about sheet set objects, so I would like to ask a realy hard question.

 

The SheetSetObject has an inbuilt custom property called "TransmittalSetups", but the property has a different internal object structure compared to other CustomProperty 

 

Ie: 

[code]

Dim myPropEnum As IAcSmEnumProperty = myCPB.GetPropertyEnumerator

Dim myPropName As String = Nothing
Dim myPropValue As AcSmCustomPropertyValue = Nothing

...

myPropEnum.Next(myPropName, myPropValue)

[/code]

 

myPropName is a string, and in this instance it returns a value of "TransmittalSetups"

myPropValue.GetValue is a string, and it says "System.__ComObject" not a "value".

 

So my question is, how do identify this object, how to interigate it or assign it to its native object type.

I have tried to cast it to different IAcSmEnum types but without success.

 

Thanks.

 

 

 

 

ADN Support Specialist
fenton.webb
Posts: 352
Registered: ‎07-24-2007
Message 2 of 14 (455 Views)

Re: Sheet set custom property field "TransmittalSetups"

12-17-2012 02:48 PM in reply to: adamkalajzich

we don't expose the COM API for the eTransmittal setup object. What do you need to do exactly?





Fenton Webb

Developer Technical Services

Autodesk Developer Network


Active Contributor
adamkalajzich
Posts: 32
Registered: ‎09-20-2009
Message 3 of 14 (438 Views)

Re: Sheet set custom property field "TransmittalSetups"

12-19-2012 04:03 PM in reply to: fenton.webb

I have a routine the "resets" the custom properties in the sheet, I delete the custom properties and I recreate it, I have noticed that this item is not being recreated, and when I "transmit" the sheets I get an internal error

 

here is the code I use:

 

Private Sub DeleteCustomProperties(ByRef myItem As IAcSmPersist, Optional ByVal Lock As Boolean = True)
''Throw New NotImplementedException
Dim myDB As AcSmDatabase = myItem.GetDatabase
Try
Select Case myItem.GetTypeName
Case "AcSmSheetSet"
If True Then
Dim mySheetset As AcSmSheetSet = myItem
mySheetset.GetCustomPropertyBag.Clear()
mySheetset.GetCustomPropertyBag.InitNew(myItem)
End If
Exit Select
Case "AcSmSheet"
If True Then
Dim mySheet As AcSmSheet = myItem
mySheet.GetCustomPropertyBag.Clear()
mySheet.GetCustomPropertyBag.InitNew(myItem)
End If
Exit Select
End Select
Catch ex As Exception
End Try
End Sub

 

I then have routines that add back the custom properties that our office use (approx 140 ish custom properties)

 

This all works, but as statedt this "transmittalSetups" custom properties also gets deleted, It took a while to find this little sucker and am not too sure how to handle it.

 

 

Thanks if you have and help to offer.

 

ADN Support Specialist
fenton.webb
Posts: 352
Registered: ‎07-24-2007
Message 4 of 14 (410 Views)

Re: Sheet set custom property field "TransmittalSetups"

01-03-2013 03:18 PM in reply to: adamkalajzich
To remove transmittal setups (resetting it), if you can find the property called "TransmittalSetups" and delete it, I think you'll be there (Make sure you do it before you blow away the Properties).
 
Lucikly, if no TransmittalSetups are found it automatically gets recreated.
 
I hope this helps.




Fenton Webb

Developer Technical Services

Autodesk Developer Network


Active Contributor
adamkalajzich
Posts: 32
Registered: ‎09-20-2009
Message 5 of 14 (385 Views)

Re: Sheet set custom property field "TransmittalSetups"

01-14-2013 02:26 PM in reply to: fenton.webb

Fenton,

 

Thanks for the information. I have not experianced this recreation of the "transmittalsetups", if not present. Do I need to delete the whole "custom property bag" and recreate it for it to be automaticaly recreated inside this contrainer. 

 

My code (shown above) resets (clears) the "custom property bag" container, it does not delete it.

 

Is there a method to delete the custom property bag it, and recreate it? and more importantly if true, how?

 

Again thanks for any help you or others more proficient in this can offer.

 

Adam Kalajzich.

 

 

ADN Support Specialist
Balaji_Ram
Posts: 693
Registered: ‎03-21-2011
Message 6 of 14 (364 Views)

Re: Sheet set custom property field "TransmittalSetups"

01-22-2013 10:31 AM in reply to: adamkalajzich

Hi Adam,

 

I have tried clearing the custom properties of the sheetset but it does not seem to be removing the transmittal setup.

 

I have attached the dropbox link to the recording that shows the steps that I am following. Can you see if there is anything different from what you are trying ?

https://www.dropbox.com/sh/40lbj5vv1nl8ri5/2Jb7I7SZcv

 

Here is the sample code that I am using to clear the custom properties

    <CommandMethod("ClearCP")> _
    Public Sub ClearCustomProps()
        Dim iterDb As IAcSmEnumDatabase
        Dim ItemDb As IAcSmPersist

        sheetSetMgr = New AcSmSheetSetMgr

        iterDb = sheetSetMgr.GetDatabaseEnumerator
        ItemDb = iterDb.Next

        sheetdb = ItemDb

        LockDatabase()

        Dim cBag1 As IAcSmCustomPropertyBag
        cBag1 = sheetdb.GetSheetSet().GetCustomPropertyBag
        cBag1.Clear()

        Dim Item1 As IAcSmPersist

        Dim iter1 As IAcSmEnumPersist
        iter1 = sheetdb.GetEnumerator
        Item1 = iter1.Next
        cBag1.InitNew(Item1)

        UnlockDatabase()
    End Sub

 



Balaji
Developer Technical Services
Autodesk Developer Network

Active Contributor
adamkalajzich
Posts: 32
Registered: ‎09-20-2009
Message 7 of 14 (352 Views)

Re: Sheet set custom property field "TransmittalSetups"

01-22-2013 06:48 PM in reply to: Balaji_Ram

Balaji,

 

Thanks for taking the time to demonstrate and show example code. I will experiment with my code base to see if this solution also fits.

 

From what I can see, your assigning a veriable to the CPB, and processing that object directly, instead of the objects parent (if im explaining it properly???)

 

ie: my code needs to change to this:

Private Sub DeleteCustomProperties(ByRef myItem As IAcSmPersist, Optional ByVal Lock As Boolean = True)
    ''Throw New NotImplementedException
    Dim myDB As AcSmDatabase = myItem.GetDatabase
    Try
        Select Case myItem.GetTypeName
        Case "AcSmSheetSet"
            If True Then
                Dim mySheetset As AcSmSheetSet = myItem
                Dim myCPB As IAcSmCustomPropertyBag '' new
                myCPB = mySheetset.GetCustomPropertyBag '' new
                myCPB.Clear() '' new
                '' mySheetset.GetCustomPropertyBag.Clear() '' old
                '' mySheetset.GetCustomPropertyBag.InitNew(myItem) '' old
                myCPB.InitNew(myItem) '' new
            End If
            Exit Select
        Case "AcSmSheet"
            If True Then
                Dim mySheet As AcSmSheet = myItem
                Dim myCPB As IAcSmCustomPropertyBag '' new
                myCPB = mySheetset.GetCustomPropertyBag '' new
                myCPB.Clear() '' new

                '' mySheet.GetCustomPropertyBag.Clear() '' old
                ''mySheet.GetCustomPropertyBag.InitNew(myItem) '' old

                myCPB.InitNew(myItem) '' new
            End If
            Exit Select
        End Select
    Catch ex As Exception
    End Try
End Sub

 

Im a bit busy doing engineering at the moment, but I should be able to test and confirm this this week. If you belive this will not work, please let me know.

 

Again, thanks for your help.

 

Adam.

 

ADN Support Specialist
Balaji_Ram
Posts: 693
Registered: ‎03-21-2011
Message 8 of 14 (346 Views)

Re: Sheet set custom property field "TransmittalSetups"

01-22-2013 09:00 PM in reply to: adamkalajzich

Hi Adam,

 

Not a problem.

Please feel free to test it when convenient.

 

 

 



Balaji
Developer Technical Services
Autodesk Developer Network

Active Contributor
adamkalajzich
Posts: 32
Registered: ‎09-20-2009
Message 9 of 14 (336 Views)

Re: Sheet set custom property field "TransmittalSetups"

01-23-2013 03:17 PM in reply to: Balaji_Ram

Balaji,

 

I have attempted to incorporate your code example into my code (as shown above) but for some reason it is not working.

 

I have to iterate though all sheets, and clear the custom properties and recreate them (recreating the custom properties is being handled by another routine). I am passing the "myItem" object as an IAcSmPersist object (based on other code examples for iterating and analysing such objects), so the objects should work, but I cannot seem to work it out.

 

Your example works on the sheetset, but does not work on the sheets themselves, which shows that the CPB is being recreated, on the parent, but it is not processing the individual sheets.

 

Please if you can assist me I would really appreciate it.

 

ADN Support Specialist
Balaji_Ram
Posts: 693
Registered: ‎03-21-2011
Message 10 of 14 (326 Views)

Re: Sheet set custom property field "TransmittalSetups"

01-24-2013 10:00 AM in reply to: adamkalajzich

Hi Adam,

 

Sorry, I still could not reproduce the problem.

 

Here is the sample code that I am using to clear the custom properties for a sheet and the dropbox link to the recording.

https://www.dropbox.com/sh/40lbj5vv1nl8ri5/2Jb7I7SZcv

 

    <CommandMethod("ClearSheetCP")> _
    Public Sub ClearSheetCustomProps()
        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"
                    Dim sheet As IAcSmSheet = TryCast(item, IAcSmSheet)

                    Dim cBag1 As IAcSmCustomPropertyBag
                    cBag1 = sheet.GetCustomPropertyBag
                    cBag1.Clear()

                    Dim Item1 As IAcSmPersist

                    Dim iter1 As IAcSmEnumPersist
                    iter1 = sheetdb.GetEnumerator
                    Item1 = iter1.Next
                    cBag1.InitNew(Item1)

                Case Else
                    ed.WriteMessage("vbCrLfType :" + type)

            End Select
            item = iterator.Next()
        End While

        UnlockDatabase()
    End Sub

 

Can you please provide the steps and a buildable sample project to reproduce the issue ?

Please do not send any information that you consider confidential.

 

 



Balaji
Developer Technical Services
Autodesk Developer Network

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.