×
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

Import annotations into Product structure using VBA

Import annotations into Product structure using VBA

Import annotations into Product structure using VBA

(OP)
Hello,

this is my situation. I work mainly with electric workbench . I design harnesses that include the cable and connectors etc. When the harness is fully done i put 3D annotation on the product on the connectores parts to identify their identification number.

I need to be able to insert annotation automaticly. I am able to add this annotation through VBA in a part but not in the product.

If you imagine a cable with 2 connetors on each side that have the same file name i have to have a way to distinguish both when inserting the annotations, one of my ideas it was or using the instance name or even better the reference designator name, but till know i was not able to do it.

Another way i was thinking of doing this it was the VBA create a new part, make new poinst in the new part that correspond to the origin of the parts and then i put all annotation is that new part in those points.

Do not know if i am thinking clearlly but bottomend i just want to be able to put annotation is product strucure and be able to associate the annotation with the part instante name or better the reference designator name.

This is just an example to add anotation in a part, know i insert the annotation stext in the code but futurlly i coud easilly change to import from an excel:

Sub Catstart()

Dim partDocument1 As PartDocument
Set partDocument1 = CATIA.ActiveDocument

Dim part1 As Part
Set part1 = partDocument1.Part

Dim annotationSets1 As AnnotationSets
Set annotationSets1 = part1.AnnotationSets

Dim annotationSet1 As AnnotationSet
Set annotationSet1 = annotationSets1.Add("VW3D")

Dim annFact As AnnotationFactory
Set annFact = annotationSet1.AnnotationFactory

Dim hb As HybridBody
Set hb = part1.HybridBodies.Item(1)
Dim hbsf As HybridShapeFactory
Set hbsf = part1.HybridShapeFactory

Dim NewPoint As Point
Set NewPoint = hbsf.AddNewPointCoord(0, 0, 0)
NewPoint.Compute
hb.AppendHybridShape NewPoint

Dim sel As Selection
Set sel = CATIA.ActiveDocument.Selection

Dim iX As Double
Dim iY As Double
Dim iZ As Double

iX = 0
iY = 0
iZ = 0

Dim userSurfaces1 As UserSurfaces
Set userSurfaces1 = part1.UserSurfaces

Dim userSurfaceA As UserSurface
Set userSurfaceA = userSurfaces1.Generate(NewPoint)

Dim txt As Text

Dim annot As Annotation
Set annot = annFact.CreateEvoluateText(userSurfaceA, iX, iY, iZ, True)
Set txt = annot.Text
txt.Text = "IDENT:CAS SEAT" & vbCrLf & "FIN: 303NGXX"







part1.Update



End Sub

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