×
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

VBA. How to add point to circle centre

VBA. How to add point to circle centre

VBA. How to add point to circle centre

(OP)
Hi all, I'm having difficulty adding a point to a circle centre using the following script:

Sub CATMain()
Dim productDocument1 As ProductDocument
Set productDocument1 = CATIA.ActiveDocument
Dim documents1 As Documents
Set documents1 = CATIA.Documents
Dim partDocument1 As PartDocument
Set partDocument1 = documents1.Item(2)
Dim part1 As Part
Set oPart = partDocument1.Part
Dim reference1 As Reference
Set oHSF = oPart.HybridShapeFactory
Dim InputObject(0)
InputObject(0) = "Edge"
Set oCentre = CATIA.ActiveDocument.Selection
Status = oCentre.SelectElement2(InputObject, "Select Circle", False)
Set oTemp = oCentre.Item(1)
Set oRef = oTemp.Reference
Set oPoint = oHSF.AddNewPointCenter(oRef)
Set oHB = oPart.HybridBodies.Add()
oPoint.Compute
oHB.AppendHybridShape oPoint

End Sub

This works great with a V5 part but I need to use it on a part that has been converted from V4 where the code falls down as it doesn't recognise the selected reference.

Does anyone have any clues on how to get around this?

Thanks

RE: VBA. How to add point to circle centre

Hi,

Your part is converted with "history" ? I suppose not. If its so, maybe you can try first to migrate with history.....

 

Regards
Fernando

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