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 cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Print Annotations macro

Status
Not open for further replies.

ntweisen

Mechanical
Joined
Jul 12, 2010
Messages
94
Location
US
Hello. I created a macro that exports all 3d annotation data to a Power Point. This macro only runs when working from a single CATPart. I am trying to modify my code to allow the user to have a CATProduct open, select the part to get the data, then it will run as usual and export the annotation data for that selected part.


Sub CATMain()
Dim productDocument1 As Document
Dim product1 As Product
Dim products1 As Products

Set productDocument1 = CATIA.ActiveDocument
Set product1 = productDocument1.Product
Set products1 = product1.Products

Dim sStatus As String

Set Selection = productDocument1.Selection

ReDim sFilter(0)

Msgbox "Please select a part."

sFilter(0) = "Part"
sStatus = Selection.SelectElement2(sFilter, "Select a part", False)


Dim partDoc1 As PartDocument
Set partDoc1=selection.Item(1).value

namebody=partDoc1.name

Dim part1 as Part
set part1 = partDoc1

Dim myProduct As Product
Set myProduct = productDocument1.GetItem(part1.Name)

Dim partName, RealPartNumber,Defy As String

partName=myProduct.name

'====================================
Dim oAnnotationSets As AnnotationSets
Set oAnnotationSets= partDocument1.Product.GetTechnologicalObject("CATAnnotationSets")

The program stops working at this last line. Any ideas why?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top