Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

From User Proprieties to Title blocks macro catia

Status
Not open for further replies.

Olivia86

Automotive
Sep 23, 2016
29
0
0
IT
What i'm tryng to achieve is a macro that read the String.1 USER PROPRIETIES of the current part used in the sheet, then finds the related title block "TitleBlock_Text_PlyName" for example, and then copy the value of String.1 in the relative text box.

If you can provide any peace of codes or other helpful stuff i will try to make and share the macro with you.
Screenshot_2019-04-20_09.43.08_e8qzi0.png



thanks in advice
 
Replies continue below

Recommended for you

I tought that this peace of code found in the catia examples would eventualy help me, but this code seems to not work at all, it's not even giving error.

If i get this right this is taking the part number name and it's filling TitleBlock_Text_Number_1 with the PartNumber, this would be the solution to for my macro, but it's not working.

Code:
Sub CATLinks()
  '-------------------------------------------------------------------------------
  'How to fill in texts with data of the part/product linked with current sheet
  '-------------------------------------------------------------------------------
  On Error Resume Next
    Dim ProductDrawn As ProductDocument
    Set ProductDrawn = DrwSheet.Views.Item("Front view").GenerativeBehavior.Document
  If Err.Number = 0 Then
    DrwTexts.GetItem("TitleBlock_Text_Number_1").Text = ProductDrawn.PartNumber
    'DrwTexts.GetItem("TitleBlock_Text_Title").Text  = ProductDrawn.Definition
    Dim ProductAnalysis As Analyze
    Set ProductAnalysis = ProductDrawn.Analyze
    DrwTexts.GetItem("TitleBlock_Text_Weight_1").Text = FormatNumber(ProductAnalysis.Mass,2)
  End If

End Sub
 
I had found a problem, i have to change a text that is inside a ditto. But the ditto could not be exploded, how could i find the text in that case?
 
Let's change the approach... if i have this "path" that is generated by a detail Modifiable in instance that was created with instantiate 2d component. How can i edit the text inside? Since the search query is not finding the instantiated items i cannot use the

selection3.Item(1).Value.Text = "Text2"

Any suggestion?

I would expect something like

Text.2/2D Component[2]/Background View = "some other text"

editable_h8clxf.png
 
Search the V5Automation.chm Help file in your CATIA Installation path for DrawingComponent. It has a method called GetModifiableObject() the will retrieve the Modifiable objects in the 2dComponent.

 
Status
Not open for further replies.
Back
Top