×
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

text in drawing to part

text in drawing to part

RE: text in drawing to part

With the dwg file active in CATIA and an already opened CATPart (the code bellow is a quick and dirty mix of a recorded macro and some other old code).

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 Sub 

Regards
Fernando

https://picasaweb.google.com/102257836106335725208
https://picasaweb.google.com/103462806772634246699...

RE: text in drawing to part

(OP)
thanx. i did some changes to macro and it works very well. i liked choosing windows where to put dxf/dwg. is there any way to set catia to export/import dxf files with mostly arcs and lines?

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