[Macro CATIA] change cut view text
[Macro CATIA] change cut view text
(OP)
Hi,
I'm currently working with CATIA V5, and i want to use Macros (VBA), but i have some problems!
My question is: how to change the text of a cut view? (see the picture)
http://www.hostingpics.net/viewer.php?id=65419615c...
i tried to use : myView.Texts.item(1) to access to this "text" but i think that CATIA dont consider it as text...
Thanks for your help,
I'm currently working with CATIA V5, and i want to use Macros (VBA), but i have some problems!
My question is: how to change the text of a cut view? (see the picture)
http://www.hostingpics.net/viewer.php?id=65419615c...
i tried to use : myView.Texts.item(1) to access to this "text" but i think that CATIA dont consider it as text...
Thanks for your help,





RE: [Macro CATIA] change cut view text
CODE -->
Sub Change_NameID() Dim oDrawing As DrawingDocument Set oDrawing = CATIA.ActiveDocument Dim oSheets As DrawingSheets Set oSheets = oDrawing.Sheets Dim oSheet As DrawingSheet Set oSheet = oSheets.Item(1) Dim oView As DrawingView Set oView = oSheet.Views.Item(4) 'Put The Section view item number oView.Activate oView.SetViewName "Section view ", "B", "" End SubRE: [Macro CATIA] change cut view text
thanks for your answer, but i need to change the value of text which indicates the source of cut view ( you can see the picture ... )
RE: [Macro CATIA] change cut view text
Regards
Fernando
https://picasaweb.google.com/102257836106335725208
https://picasaweb.google.com/103462806772634246699...
RE: [Macro CATIA] change cut view text
CODE -->
RE: [Macro CATIA] change cut view text
but if i double clic on this text i can change it without affecting the cut view name ... and i want to do that with a macro ... i hope that you understand what i mean...
RE: [Macro CATIA] change cut view text
RE: [Macro CATIA] change cut view text
Technically speaking, that text and name of the view should be connected (you know, paper can support anything...). If you will modify only the text it will be linked to what (suppose you want to change A with B for example) ? Who will see the drawing will look to what view (B-B if existing) ? Or is something bit more specific ?
Still, if you want to do it in macro, your mark-up is a text, you can tell to user to select the text and in macro, in selection, you can replace old text with new one.
Regards
Fernando
https://picasaweb.google.com/102257836106335725208
https://picasaweb.google.com/103462806772634246699...
RE: [Macro CATIA] change cut view text
i dont believe that we can't make this simple task with CATIA VBA ... it's sad ...
RE: [Macro CATIA] change cut view text
First select the text like in your mark-up, then run this CATScript
CODE --> CATScript
Language="VBSCRIPT" Sub CATMain() Dim myString 'As Double myString = "ENTER TEXT" myString = InputBox ("Please enter the text", myString, "What ever you want") Set drawingDocument1 = CATIA.ActiveDocument Set selection1 = drawingDocument1.Selection selection1.Item(1).Value.Text = myString End SubRegards
Fernando
https://picasaweb.google.com/102257836106335725208
https://picasaweb.google.com/103462806772634246699...
RE: [Macro CATIA] change cut view text
I can change this text with this method, but my objectif is to do that without the intervention of the user ... i dont know why catia dont consider it as text, so i can access to it with texts collection ...
anyone can help me ?
RE: [Macro CATIA] change cut view text
CODE -->
why the result is 0? it's confusing
RE: [Macro CATIA] change cut view text
That is not a component (unless you are inserting one from a catalog...), that's why you have 0 (at least in your screenshot we cannot see if is a component/ditto or something else).
Regards
Fernando
https://picasaweb.google.com/102257836106335725208
https://picasaweb.google.com/103462806772634246699...
RE: [Macro CATIA] change cut view text
i created this "text" by creating a cut view ... we can't know the type of this object ?
RE: [Macro CATIA] change cut view text
You have two pictures attached, both of them is showing same thing, that letter A is a text. First picture a used a macro to determine what is the selected element and second is by searching in CATIA text string case sensitive A .
Regards
Fernando
https://picasaweb.google.com/102257836106335725208
https://picasaweb.google.com/103462806772634246699...
RE: [Macro CATIA] change cut view text
Regards
Fernando
https://picasaweb.google.com/102257836106335725208
https://picasaweb.google.com/103462806772634246699...
RE: [Macro CATIA] change cut view text
RE: [Macro CATIA] change cut view text
RE: [Macro CATIA] change cut view text
I saw your question on stackoverflow, ...if you want an answer, you have to explain very clear the whole scenario, put your code here (as much as you can, to understand what you want to do) and only after that we can help you more.
Anyway, definitely that letter A is a drawing text, as is shown in second attachment picture, the query was search a drafting text string (letter A). If you want to change without user intervention, you have to find a method to replace that string with another one defined in code by you (eventually using search function).
Regards
Fernando
https://picasaweb.google.com/102257836106335725208
https://picasaweb.google.com/103462806772634246699...
RE: [Macro CATIA] change cut view text
indocti discant et ament meminisse periti
RE: [Macro CATIA] change cut view text
my question is clear ... if it is a drawing text, why can't find it in the texts collection? this is my code:
CODE -->
that return 0, so the texts collection is empty ... if it's a drawing text , the collection shouldn't be empty, i should find it in this collection.
thank you!
RE: [Macro CATIA] change cut view text
Bellow is a code which is searching texts in all your drawing, see what you can get.
CODE --> CATScript
Regards
Fernando
https://picasaweb.google.com/102257836106335725208
https://picasaweb.google.com/103462806772634246699...
RE: [Macro CATIA] change cut view text
indocti discant et ament meminisse periti
RE: [Macro CATIA] change cut view text
selection1.Search "CATDrwSearch.DrwText,all"
will search in all the drawing document so it will consum lot of memory ... can i search just in the active view ? how can i do that?
RE: [Macro CATIA] change cut view text
selection1.Search "CATDrwSearch.DrwText,all"
you can use
selection1.Search "CATDrwSearch.DrwText,sel"
or you can use the name of the view (if is a constant) then use same technique. The idea is to make first the selection...
Here is something which you can use also.
Regards
Fernando
https://picasaweb.google.com/102257836106335725208
https://picasaweb.google.com/103462806772634246699...
RE: [Macro CATIA] change cut view text