Gilgamesh99
Automotive
- Jun 11, 2013
- 45
Hi:
Since this is very complicated, at least for me, I decide to make a new thread for this issue. The problem is:
Given a tube, create the centerpoint in the edges with a macro and assign them to a geometrical set. See image for better understanding.
The condition is that only the outer edges are recognized (in order to avoid duplicated points due to concentricity). "I created" the following code and it's almost complete, unfortunately is recognizing EVERY edge, even if its not a circle!
Thank you in advance for your time and efforts!!!
Since this is very complicated, at least for me, I decide to make a new thread for this issue. The problem is:
Given a tube, create the centerpoint in the edges with a macro and assign them to a geometrical set. See image for better understanding.
The condition is that only the outer edges are recognized (in order to avoid duplicated points due to concentricity). "I created" the following code and it's almost complete, unfortunately is recognizing EVERY edge, even if its not a circle!
Code:
Sub CATMain()
Dim productDocument1
Set productDocument1 = CATIA.ActiveDocument
Dim documents1 As Documents
Set documents1 = CATIA.Documents
Dim partDocument1
Set partDocument1 = documents1.Item(1)
Dim part1 As Part
Set oPart = CATIA.ActiveDocument.Part
Dim reference1 As Reference
Set oHSF = oPart.HybridShapeFactory
'===========================================================
Dim objSel As Selection
Set objSel = CATIA.ActiveDocument.Selection
objSel.Search ("Type=Edge,all")
objcount = objSel.Count
'MsgBox objcount
Dim oCentre
Set oCentre = CATIA.ActiveDocument.Selection
Set oHB = oPart.HybridBodies.Add()
Dim j As Integer
For j = 1 To objSel.Count
Set otemp = oCentre.Item(j)
Set oRef = otemp.Reference
Set oPoint = oHSF.AddNewPointCenter(oRef)
'Set oHB = oPart.HybridBodies.Add()
oPoint.Compute
oHB.AppendHybridShape oPoint
Next j
End Sub
Thank you in advance for your time and efforts!!!