text in drawing to part
text in drawing to part
(OP)
i have a macro that inserts text from a drawing to part.Thanx Ferdo for that macro it's from your portable script.
what i want is to insert text in a active part.this macro opens a new part and inserts text in there.
macro attached.
any help will be appreciated.
what i want is to insert text in a active part.this macro opens a new part and inserts text in there.
macro attached.
any help will be appreciated.





RE: text in drawing to part
CODE --> CATScript
Language="VBSCRIPT" Sub CATMain() Dim drawingDocument1 As Document Set drawingDocument1 = CATIA.ActiveDocument Dim selection1 As Selection Set selection1 = drawingDocument1.Selection selection1.Clear Dim drawingSheets1 As DrawingSheets Set drawingSheets1 = drawingDocument1.Sheets Dim drawingSheet1 As DrawingSheet Set drawingSheet1 = drawingSheets1.Item("Model") Set drawingDocument1 = CATIA.ActiveDocument Set selection1 = drawingDocument1.Selection selection1.Search "Name=*Main' 'View*,all" selection1.Copy ''''''''''''''''''''''''' Rem--------------------------- Rem User selection of the CATIA window Rem-------------------------- Dim Windows1 As Windows Dim SpecsAndGeomWindow1 As Window Dim sArray As Array Set Windows1 = Catia.Windows DUMMY = "" ii = 1 For i = 1 To Windows1.count WindowName = Windows1.Item( i ).Name DUMMY = DUMMY & ii & ".) " & WindowName & Chrw( 10 ) ii = ii + 1 Next DUMMY = "Enter your Number, for example 1 or 2 " & Chrw( 10 ) & Chrw( 10 )& DUMMY & Chrw( 10 ) & Chrw( 10 ) USERCHOICE = InputBox( DUMMY, "Enter Number of Window which will be activated:" ) If USERCHOICE = "" Then Exit Sub End If If IsNumeric( USERCHOICE ) Then iSelect = CInt(USERCHOICE) WindowName = Windows1.Item(iSelect).Name Windows1.Item(iSelect).Activate End If '''''''''''''''''''''''''' Set specsAndGeomWindow1 = CATIA.ActiveWindow Dim viewer3D1 As Viewer Set viewer3D1 = specsAndGeomWindow1.ActiveViewer Dim viewpoint3D1 As Viewpoint3D Set viewpoint3D1 = viewer3D1.Viewpoint3D Dim partDocument1 As Document Set partDocument1 = CATIA.ActiveDocument Dim selection2 As Selection Set selection2 = partDocument1.Selection selection2.Clear Dim part1 As Part Set part1 = partDocument1.Part Dim bodies1 As Bodies Set bodies1 = part1.Bodies Dim body1 As Body Set body1 = bodies1.Item("PartBody") selection2.Add body1 selection2.Paste End SubRegards
Fernando
https://picasaweb.google.com/102257836106335725208
https://picasaweb.google.com/103462806772634246699...
RE: text in drawing to part
RE: text in drawing to part
Regards
Fernando
https://picasaweb.google.com/102257836106335725208
https://picasaweb.google.com/103462806772634246699...