Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

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

wrong placement of dimension in drawing after update links of part

Status
Not open for further replies.

psychanalyst

Computer
Joined
Jan 29, 2014
Messages
3
Location
TN
hi,
I am trying to make a macro to update links between CATDrawing and CATPart. After execution of the macro, there are losses colored red annotations.
Here is my code:
Sub CATMain()

partFile = CATIA.ActiveDocument.FullName

Set partDoc = CATIA.Documents.Read(partFile)

Set myPart = partDoc.Part

drwFile = Replace(partFile, "Part", "Drawing")

Set drwDoc = CATIA.Documents.Open(drwFile)

Set mySheet = CATIA.ActiveDocument.Sheets.Item("Sheet.1")

For i = 1 To mySheet.Views.Count
Set myView = mySheet.Views.Item(i)
Set vLinks = myView.GenerativeLinks
vLinks.RemoveAllLinks

If InStr(myView.Name, "Main") < 1 Then
If InStr(myView.Name, "Background" ) < 1 Then
vLinks.AddLink myPart
End If
End If


Next

mySheet.ForceUpdate

'CATIA.ActiveDocument.Save

End Sub
 
I know that catia will keep dimensions linked when you use the proper way... I am not sure it will keep links when replaced with a script.

Eric N.
indocti discant et ament meminisse periti
 
here is my drawing before running the code
viewer.php

this is how it looks as a result
viewer.php
 
When creating dimensions to holes, do not select the center line. Tag the hole itself when dimensioning.
If you have not already done this, try it. Then run the code and see if they fail.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top