×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Macro to search text from Drawing Table & Ditto

Macro to search text from Drawing Table & Ditto

Macro to search text from Drawing Table & Ditto

(OP)
I am looking for macro which can search text from Drawing Table & Drawing Dittos ( Instantiate 2D Component ).

I have macro to search whole Table & Ditto but unable to extract word from that.

My requirement is:
1)To extract only Text from Table & Dittos in drawing sheet.
2)After extracting word it should be disassemble ( Sentence should be disassembled into individual word ) .

Thanks in advance.

RE: Macro to search text from Drawing Table & Ditto

Don't want to be rude but you might have more chance to get help creating the script , than getting free work.

you said you can find drawing text but can't get word from it?

did you look the online doc? the answer is there in plain text

to split string with space you can use the split() function again in doc.

share you code or at least what you can from it and you'll find help

Eric N.
indocti discant et ament meminisse periti

RE: Macro to search text from Drawing Table & Ditto

(OP)
Hello Eric,

Thanks for the reply.

I have made below code to search all dittos (Instantiate 2D Component).

Sub CATMain()

Dim drawingDocument1 As DrawingDocument
Set drawingDocument1 = CATIA.ActiveDocument

Dim selection1 As Selection
Set selection1 = drawingDocument1.Selection

selection1.Search "CATDrwSearch.DrwDitto,all"

End Sub.


But i don't know how to extract word from this dittos.

I want to extract only words but this program select all item within dittos, like: Line , point, word , image...

Please help me to execute the program .

Thanks in advance.

RE: Macro to search text from Drawing Table & Ditto

(OP)
Hello Ferdo,

I have searched but couldn't fount suitable for my requirement.

Below is latest script from me to search all text from drawing including Table , Ditto & Text.
Now only thing need to do is extracting of all text from Table & Ditto .

Sub CatMain()

Dim drawingDocument1 As DrawingDocument
Set drawingDocument1 = CATIA.ActiveDocument

Dim selection1 As Selection
Set selection1 = drawingDocument1.Selection

selection1.Search "((CATDrwSearch.DrwDitto + CATDrwSearch.DrwText + CATDrwSearch.DrwTable)),all"

End Sub


I have very basic knowledge of Macro so please help me in this regards .

Thanks..

RE: Macro to search text from Drawing Table & Ditto

(OP)
Hi,

Please help me to correct the code, i have red marked to problem area :

Sub CATMain()

Dim drawingDocument1 As DrawingDocument
Set drawingDocument1 = CATIA.ActiveDocument

Dim selection1 As Selection
Set selection1 = drawingDocument1.Selection

selection1.Search "((CATDrwSearch.DrwDitto + CATDrwSearch.DrwText + CATDrwSearch.DrwTable)),all"

' Retrieve the modifiable text of the ditto
Dim oText As DrawingText
Set oText = o2DComponent.GetModifiableObject(1)

' Modify the modifiable text value
Dim ReturnValue As String
ReturnValue = InputBox("Enter a value", "", "New Value For Text")
oText.Text = ReturnValue

End Sub


Thanks....

RE: Macro to search text from Drawing Table & Ditto

you do selection1.Search but then you don't use it.

then you bring from nowhere the o2DComponent.

you could check in your view the Components collection. I always prefer to get the object from the data structure than using search or selection.

oDrawingDoc
|- Views
|- ActiveView
|- Components
|- item(1)
|- item(2)

Also you will find

oDrawingDoc
|- Views
|- ActiveView
|- Texts
|- item(1)
|- item(2)

This is the basic of CATIA data structure, please read your V5Automation.chm file

Eric N.
indocti discant et ament meminisse periti

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources