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.
we don't expose the COM API for the eTransmittal setup object. What do you need to do exactly?
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.
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.
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,
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.
Hi Adam,
Not a problem.
Please feel free to test it when convenient.
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.
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.
Hi Adam,
Can you please let me know the steps to reproduce the problem.
I can run the command and the custom properties are all added to the sheet.
But beyond that I have no idea how to get to the missing transmittal setup problem that you are having.
Maybe some step-by-step screenshots or a recording of the steps will help.
A good day to all of you.
I would like to continue this thread and seek for a solution, as I am also encountering an error within AutoCAD but it also crashes AutoCAD.
This is attained when I activate our program that edits the property values in a sheet or a sheet set.
Here is the procedure:
1.) Load a sheet set file that does not contain the "TransmittalSetups" custom property.
2.) Run the e-Transmit command by right-clicking the sheet set name at the tree view of the sheet set manager and selecting "e-Transmit".
3.) Cancel the dialog that will appear.
4.) Load the program that edits the property values in the sheet set/sheet. Make sure even one of the property values is changed.
5.) Try to run e-Transmit as 2.) again, and this will cause an error and eventually crash AutoCAD.
By the way, we are using AutoCAD 2012.
Hope we can get an answer.
Thank you!
Hi looks like you can change TransmittalSetups by just adding the corrects bytes to file or to make much life much easier just use a simple subsitution cipher to decode it to a xml file.
Here is part of the sheet set file that comes with autocad samples you will see transmittal setups at bottom.
I will post code for converting soon but pretty easy figure out mapping since you modify the sheet set file see results.
Here is a start
http://www.theswamp.org/index.php?topic=46497.0
<?xmlversion="1.0"encoding="UTF-8"?>
<AcSmDatabaseclsid="g2162C6B6-0CE4-40E8-912B-46F59DFDF826"ID="gA9DFEA28-A450-4076-8C0F-6ABA0418E5FF">
<AcSmProppropname="DbFingerPrint"vt="8">g89B8180B-4DB0-4C97-974E-01F9483859B8</AcSmProp>
<AcSmProppropname="DbVersion"vt="8">1.1</AcSmProp>
<AcSmProppropname="FileRevision"vt="3">36</AcSmProp>
<AcSmSheetSetclsid="gB20534F2-0978-418C-8D14-2E6928A077ED"ID="g50786B62-0394-4DC2-B91D-3790BAB7A345"propname="SheetSet"vt="13">
<AcSmFileReferenceclsid="g6BF87AE7-1BEC-4BDB-98BB-5B91F7772793"ID="gC9C96A82-979D-4EA0-B827-97B8D27C0B06"propname="AltPageSetups"vt="13">
<AcSmProppropname="Environ_FileName"vt="8">%ProgramFiles%\AutoCAD 2006\Sample\Sheet Sets\Architectural\IRD.dwt</AcSmProp>
<AcSmProppropname="FileName"vt="8">C:\Program Files\AutoCAD 2006\Sample\Sheet Sets\Architectural\IRD.dwt</AcSmProp>
<AcSmProppropname="Relative_FileName"vt="8">.\IRD.dwt</AcSmProp>
<AcSmProppropname="SpecialFolder_FileName"vt="8">$(CSIDL_PROGRAM_FILES)\AutoCAD 2006\Sample\Sheet Sets\Architectural\IRD.dwt</AcSmProp>
</AcSmFileReference>
<AcSmCalloutBlocksclsid="g203EAB46-483B-4E6B-A10B-15E9A4B210FF"ID="g3D8FB2D2-42BE-408B-9DC8-59C4B2DF4142"propname="CalloutBlocks"vt="13">
<AcSmAcDbBlockRecordReferenceclsid="g11782523-474B-4C83-9646-57C052847FBB"ID="g82BD5C32-9E78-4A1D-A4D4-8F5AE4FAC610">
<AcSmProppropname="AcDbHandle"vt="8">25C04</AcSmProp>
<AcSmProppropname="Environ_FileName"vt="8">%ProgramFiles%\AutoCAD 2006\Sample\Sheet Sets\Architectural\IRD.dwt</AcSmProp>
<AcSmProppropname="FileName"vt="8">C:\Program Files\AutoCAD 2006\Sample\Sheet Sets\Architectural\IRD.dwt</AcSmProp>
<AcSmProppropname="Name"vt="8">Callout Bubble</AcSmProp>
<AcSmProppropname="Relative_FileName"vt="8">.\IRD.dwt</AcSmProp>
<AcSmProppropname="SpecialFolder_FileName"vt="8">$(CSIDL_PROGRAM_FILES)\AutoCAD 2006\Sample\Sheet Sets\Architectural\IRD.dwt</AcSmProp>
</AcSmAcDbBlockRecordReference>
.......
...........
<AcSmCustomPropertyValueclsid="g8D22A2A4-1777-4D78-84CC-69EF741FE954"ID="gE16F3C7B-AA0F-4BDB-B7DB-FD7655411FDC"propname="TransmittalSetups"vt="13">
<SSTransmittalSetups.16clsid="g087CF7BD-9343-4946-8BEE-44578710527E"ID="gCA88A6E5-F97C-41CC-8450-76CCA4B03351"propname="Value"vt="13">
<SSTransmittalSetup.16clsid="gFEBD61A0-4DCA-4CC1-A461-6801ED213209"ID="gD3E48FF3-5A43-49A5-BE47-F8CB680AB2F3">
<AcSmProppropname="IncludeDataLinkFile"vt="3">1</AcSmProp>
<AcSmProppropname="IncludeMaterialTextures"vt="3">1</AcSmProp>
<AcSmProppropname="IncludePhotometricWebFile"vt="3">1</AcSmProp>
<AcSmProppropname="IncludeSSFiles"vt="3">1</AcSmProp>
<AcSmProppropname="SetupName"vt="8">Standard</AcSmProp>
<AcSmProppropname="VisualFidelity"vt="3">1</AcSmProp>
</SSTransmittalSetup.16>
<SSTransmittalSetup.16clsid="gFEBD61A0-4DCA-4CC1-A461-6801ED213209"ID="g0B4A5B1A-F80D-4DB3-8FCE-FF3721CEB693">
<AcSmProppropname="IncludeDataLinkFile"vt="3">1</AcSmProp>
<AcSmProppropname="IncludeMaterialTextures"vt="3">1</AcSmProp>
<AcSmProppropname="IncludePhotometricWebFile"vt="3">1</AcSmProp>
<AcSmProppropname="IncludeSSFiles"vt="3">1</AcSmProp>
<AcSmProppropname="IncludeUnloadedReferences"vt="3">1</AcSmProp>
<AcSmProppropname="SetupName"vt="8">ArchiveStandard</AcSmProp>
<AcSmProppropname="VisualFidelity"vt="3">1</AcSmProp>
</SSTransmittalSetup.16>
</SSTransmittalSetups.16>
</AcSmCustomPropertyValue>
</AcSmCustomPropertyBag>
Can't find what you're looking for? Ask the community or share your knowledge.