1> We get Block title attributes properly of dwg file in windows application form using the getattribute function().
2> We get Block title Attributes properly in that way:-We take a class library where we take a class.in this class we use getattribute function().Then We access the particular class from another project
But when we use the same class(Keep same structure) in client server socket program.Then it gives an exception.i.e ,"Spaicfied cast is not valid"I am Not getting any reply form teghax developer..I attached exception screen sort.Give me Suggestion How to solve this Exception
Code given Bellow :
Public Function Get_DwgFileAttribute(ByVal Sender As ClsTcpConnection, ByVal msgTag As Byte, ByVal message As String) As String
Dictionary = GetHashtable(message)
Dim varfilepath As String = CStr(Dictionary.Item("filePath"))
Dim varFileBlockName As String = CStr(Dictionary.Item("fileBlockName"))
Dim hashList As New Hashtable
If varfilepath.ToUpper.EndsWith(".DWG") Then
odaHost = New TeighaX.OdaHostApp
acadApp = odaHost.Application
acadDoc = acadApp.Documents.Open(varfilepath)
'Dim clsObj = New Update_Attribute.Class1()
' Dim test As String
' test = clsObj.GetAttributes(varFileBlockName, varfilepath)
For i = 0 To acadDoc.Database.Blocks.Count - 1
If TypeOf acadDoc.Database.Blocks.Item(i) Is TeighaX.IAcadBlock Then
curBlock = acadDoc.Database.Blocks.Item(i)
If curBlock.IsLayout Then
If curBlock.Layout.Name = "Model" Then
For A = 0 To acadDoc.Database.Blocks.Item(i).Count - 1
If TypeOf acadDoc.Database.Blocks.Item(i).Item(A) Is TeighaX.IAcadBlockReference Then
If acadDoc.Database.Blocks.Item(i).Item(A).name = varFileBlockName Then
blockRef = CType(acadDoc.Database.Blocks.Item(i).Item(A), IAcadBlockReference)
If blockRef.HasAttributes Then
Try
For Each Attrib In blockRef.GetAttributes
hashList.Add(CStr(Attrib.TagString), CStr(Attrib.TextString))
Next
Catch ex As Exception
End Try
End If
End If
End If
Next
End If
End If
End If
Next
End If
Return "Request Dwg Block Attribute ..."
End Function
Suggest me how to solve this Exception...........
This post has been edited by BobRodes: 14 June 2012 - 11:36 AM

New Topic/Question
This topic is locked



MultiQuote



|