×
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

Place points in a tube macro

Place points in a tube macro

Place points in a tube macro

(OP)
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!

CODE --> Script

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!!!

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