Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

View Names at Top of Views

Status
Not open for further replies.

harishn2

Mechanical
Feb 10, 2006
2
IN
Hi Friends,
I would like to place the view names of all views at the top of corresponding views using catvba. Kindly give me a hint for it and not the entire macro.

Regards,
Harry
 
Replies continue below

Recommended for you

Hi,

You can play with the code bellow

Code:
Sub CatMain()
    
    Dim MyDoc As Document
    Set MyDoc = CATIA.ActiveDocument
    
    Dim MyDrawingDoc 'As DrawingDocument
    Set MyDrawingDoc = MyDoc
    
    Dim MySelection 'As Selection
    Set MySelection = MyDrawingDoc.Selection
    
    Dim Status As String
    Dim vFilter(0)
    
    vFilter(0) = "DrawingView"    
    MySelection.Clear
    Status = MySelection.SelectElement2(vFilter, "Select Drawing View", True)    
    
    Dim MyDrawingView As DrawingView
    Set MyDrawingView = MySelection.Item(1).Value
    
    MyDrawingView.Activate
    
    Dim MyDrawingSheet As DrawingSheet
    Set MyDrawingSheet = MyDrawingView.Parent
    
    Dim TextLocation(1)    
    Status = MyDrawingDoc.Indicate2D("Indicate Text Location", TextLocation)    
    
    Dim MyText As DrawingText
    Set MyText = MyDrawingView.Texts.Add(vbCrLf + "Scale", TextLocation(0), TextLocation(1))    
    Dim ParameterName As String
    ParameterName = "Drawing\" + MyDrawingSheet.Name + "\" + MyDrawingView.Name + "\Name"    
    MsgBox ParameterName
    Call MyDrawingView.InsertViewScale(1 + Len(MyText.Text), MyText)
    Call MyText.InsertVariable(1, 0, MyDrawingDoc.Parameters.GetItem(ParameterName))
    
End Sub

Regards
Fernando

 
for each view I would check all text to see if one match the view name, if not I would create text with view name.

I would put the view name text in noshow and check the frame size, then bring the view name text in show and position it according to frame size.

Eric N.
indocti discant et ament meminisse periti
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Top