Translate a drawing

Translate a drawing

Anonymous
Not applicable
366 Views
3 Replies
Message 1 of 4

Translate a drawing

Anonymous
Not applicable
Hello,

I have a project to create a simple program with a database under Excel.
Under excel i Have two columns. One with text in French and a second with text in English. There is almost 300 lines under excel only.
The objective of the program under Autocad VBA is to replace each attributes and texts in french by the equivalent text in english.
I don't think i will have trouble to communicate with excel but I don't know how to check each attributes and text.
Can you help me ?

Thanks
0 Likes
367 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable
Mfauxock, this will give you a starting point. The code will find all Attributes and text in your drawing and display the text string.

Sub GetAttribValue()
Dim objBlkRef As AcadEntity
Dim objSelSet As AcadSelectionSet
Dim Atts As Variant
Dim iCount As Integer
Dim I As Integer
Dim varData(0) As Variant
Dim intType(0) As Integer

varData(0) = "INSERT,TEXT"
intType(0) = 0


Set objSelSet = ThisDrawing.PickfirstSelectionSet
objSelSet.Select acSelectionSetAll, filtertype:=intType, filterdata:=varData

For Each objBlkRef In objSelSet
'if attribute
If objBlkRef.ObjectName = "AcDbBlockReference" Then
If objBlkRef.HasAttributes Then
Atts = objBlkRef.GetAttributes
iCount = UBound(Atts)
Do While I < iCount + 1
MsgBox Atts(I).TextString '<---- the serch in database will go here
I = I + 1
Loop
End If
End If

'if text
If objBlkRef.ObjectName = "AcDbText" Then
MsgBox objBlkRef.TextString '<---- the serch in database will go here
End If

Next objBlkRef

End Sub
0 Likes
Message 3 of 4

Anonymous
Not applicable
I didn't though I will have so much Thanks a lot It is what I was looking for !!
0 Likes
Message 4 of 4

Anonymous
Not applicable
You are welcome
0 Likes