Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

VBA. How to add point to circle centre

Status
Not open for further replies.

adamrbts

Aerospace
Aug 1, 2008
4
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
 
Replies continue below

Recommended for you

Hi,

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



Regards
Fernando
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor