×
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

MACRO FOR REMOVAL TAPS BODY IN A ASSEMBLY

MACRO FOR REMOVAL TAPS BODY IN A ASSEMBLY

MACRO FOR REMOVAL TAPS BODY IN A ASSEMBLY

(OP)
I have a product with a base plate on which I assemble other 4 parts. I want to automate the removal tap body from each part to the main plate with a macro. Is it possible...
Ferdo please give me an tip....
By the way nice pictures. RO este foarte frumoasa....

RE: MACRO FOR REMOVAL TAPS BODY IN A ASSEMBLY

Hi

Yes indeed, is very nice. I have many more pictures, but I need time (and a good connection bigsmile ).
Coming to your question, tap body is the name of a body or ? A sample product would be great (up to r18 in my case) or more details or what you've tried....
The bellow code is deleting empty bodies and is modified previously by peterguy (which by the way I don't know why he is not active anymore here) and I just done conversion for CATScript
Based on this example, it really depends on what does it means "tap body" (if is a body name search for name and follow the example).
Waiting for your feedback...

CODE --> CATScript

Sub CATMain()
 
 'Code modified by peterguy
 Dim selection1 As Selection
Set Document = CATIA.ActiveDocument
Set Bodies = Document.Part.Bodies
Set selection1 = Document.Selection
selection1.Clear

For i = 1 To Bodies.Count

if CheckEmptyBody (Bodies.Item(i)) = true then
selection1.Add Bodies.Item(i)
end if

Next

selection1.Delete
MsgBox "Empty Bodies Deleted "
End Sub

Function CheckEmptyBody(body) as boolean

Set HybridShapes = body.HybridShapes
Set ogs = body.OrderedGeometricalSets
Set Shapes = body.Shapes
Set Sketches = body.Sketches

On Error Resume Next

Count1 = HybridShapes.Count
Count2 = ogs.Count
Count3 = Shapes.Count
Count4 = Sketches.Count

on error goto 0
If Count1 = 0 And Count2 = 0 And Count3 = 0 And Count4 = 0 Then
'~ debug.print body.Name & " is an Empty Body "
CheckEmptyBody = true

Else
'~ debug.print "No Empty Body"
CheckEmptyBody = false
End If

End Function 





Regards
Fernando

https://picasaweb.google.com/102257836106335725208
https://picasaweb.google.com/103462806772634246699...

RE: MACRO FOR REMOVAL TAPS BODY IN A ASSEMBLY

(OP)
Ma poti contacta pe yahoo punct com la dtudor88
Thanks ferdo.

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