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!

VBA. How to add point to circle centre

Status
Not open for further replies.

adamrbts

Aerospace
Joined
Aug 1, 2008
Messages
4
Location
GB
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
 
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

Back
Top