Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations KootK on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Spell Check Macro?

Status
Not open for further replies.

Meghanath

Aerospace
May 8, 2013
9
I was trying to build a spell checker in CATIA V5. I want the macro to check every word in a drawing file with an Excel sheet which has all the words predefined. How do I start this.

Thanks!
 
Replies continue below

Recommended for you

learn about:
operations on strings (extracting single word from string, compare two words)
how get all DrawingTexts (If You only consider drawingtexts)
how collaborate with Excel spreadsheet through CatScript / CATVBA


LukaszSz. Poland, Warsaw University of Technology, Faculty of Power and Aeronautical Engineering : MEchanical Engineering. BsC - 2013
 
search for all texts in drawing:
Code:
Language="VBSCRIPT"

Sub CATMain()

Set drawingDocument1 = CATIA.ActiveDocument

Set selection1 = drawingDocument1.Selection

selection1.Search "CATDrwSearch.DrwText,in"

for i=1 to selection1.count
msgbox selection1.item(i).value.text
next

End Sub

disassembly text into single word - split string by " " (SPACE)
Code:
Sub disassemblyText(oString)
SplittingChar=" "
ArrayOfSingleWords = split(oString,SplittingChar)   
for j=LBound(ArrayOfSingleWords) to UBound(ArrayOfSingleWords)
msgbox ArrayOfSingleWords(j)
next
End Sub

LCase() and UCase() will replace all letters into lower cases / upper cases


two steps almost done, I hope, You'll post Yours version soon, anyway, it seems to be very interesting case, so if I get some free time, I will prepare my own version of SpellChecker for CATIA's drawing texts

IMO the biggest problem is to determine, how script should work, when script will found word from outside the WordList
The best option IMO is to do it in VBA, create table of all words and founded highlit on green, those, which are outside the wordlist on red and let user to do those changes manually by double-click on this word

LukaszSz. Poland, Warsaw University of Technology, Faculty of Power and Aeronautical Engineering : MEchanical Engineering. BsC - 2013
 
I was just going through the excel forums and found the following code which checks the spelling of all the cells. What I though is to first capture all the words from CATIA into an excel and then use the excel spell checker to check the spellings. But I have a doubt w.r.t the word (sentence) indexing i.e., the way catia names different words. I hope it is based on how I create the text right? Say, if I create "ABCD XYZ" in one go, that would be identified as single text in CATIA right. Please clarify

Option Explicit
Sub CheckSpekk()


With Application.SpellingOptions
.SuggestMainOnly = True
.IgnoreCaps = True
End With

' Run a spell check.
Cells.CheckSpelling

End Sub

 
Hello, I've got good news for You, following by Ferdo's suggestions, I've created catia's macro that collaborate with MS Word dictionaries

To compile this Macro You need to add MS Word Library
From menu Tools-References Check Microsoft Word XX Library

Here is the whole macro

I'm looking for Your feedback!




LukaszSz. Poland, Warsaw University of Technology, Faculty of Power and Aeronautical Engineering : MEchanical Engineering. BsC - 2013
 
Lukaszsz,
Works Great!
Thanks for developing.

I am running it on V5R18SP4 64-bit windows 7.
Every other time I run it, I get a "Run-time error '462': The remote server machine does not exist or is unavailable"
If I select End it works fine the next time.
IF I select Debug it goes to the the editior and highlights this line "WordApp.Visible = False"

I have not tried it on later Catai versions.


Thanks,
Rick
 
Same error on my configuration (V5r21 Win7x32), I haven't 'marked' it as urgent mistake, I'm still working on it and still haven't found suitable solution :)

LukaszSz. Poland, Warsaw University of Technology, Faculty of Power and Aeronautical Engineering : MEchanical Engineering. BsC - 2013
 
Thank you very much for developing the macro LukaszSz!

I did not get any errors when I compiled it, but it works only with one text. When there are multiple texts, it detects them but doesn't give any spelling suggestions.

 
Meghanath, Try to download the latest version. Previous ver contains some bugs, e.g. looping on first drawing text only instead all texts. Link is the same, I've uploaded the new one (240 kb) few days ago.
Also I've fixed multilanguage supporting. Previous version was using suggested words not from specified language library, but from same language as system's language

LukaszSz. Poland, Warsaw University of Technology, Faculty of Power and Aeronautical Engineering : MEchanical Engineering. BsC - 2013
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor