Message 1 of 10

Not applicable
09-05-2011
05:26 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
We have a program to update our titleblocks, the following code has worked without problems in Inventor 2010.
But in Inventor 2012, it doesn't work every time. When I insert the titleblock for the first time I can fill the attributes,
but when I want to update the titleblock, I see no change, although it has changed the values, which I can see if I manually do an edit attributes (see screenshot).
Any ideas?
Thanks,
Michael
Public Shared Function SaveAutocadAttributes(ByVal intDocID As Integer, ByRef invApp As Inventor.Application) As Boolean Dim ht As Hashtable = AcadAttributesMapping(intDocID, invApp) Dim i As Integer Dim invDoc As DrawingDocument Dim acadDoc As AcadDatabase Dim objBlock As AcadBlock = Nothing Dim objAcadEntity As AcadEntity = Nothing Dim objAcadBlockReference As AcadBlockReference = Nothing Dim obj() As Object = Nothing Dim objAcadObject As AcadObject = Nothing invDoc = invApp.ActiveDocument acadDoc = invDoc.ContainingDWGDocument For Each objBlock In acadDoc.Blocks For Each objAcadEntity In objBlock If objAcadEntity.ObjectName.ToLower = "AcDbBlockReference".ToLower Then objAcadBlockReference = CType(objAcadEntity, AcadBlockReference) If objAcadBlockReference.HasAttributes Then Select Case objAcadBlockReference.Name Case "A0", "A1", "A2", "A3", "A3D", "A4", "P0", "P1", "P2", "P3", "P4" obj = DirectCast(objAcadBlockReference.GetAttributes, Object()) For i = LBound(obj) To UBound(obj) If ht.ContainsKey(obj(i).TagString) = True Then obj(i).TextString = ht.Item(obj(i).TagString) End If Next i End Select End If End If Next Next invDoc.Update() End Function
Solved! Go to Solution.