0

enter image description here

I am not expert in Catia macros but I wrote one simple code and it works on my Catia but on other other computer it doesn't work. The macro is about deleting deactivated bodies from the tree. PLEASE HELP. Here is the code:

Sub CATMain()

Set partDocument1 = CATIA.ActiveDocument

Set part1 = partDocument1.Part

'If Err.Number=0 Then

Dim selection1 'As Selection
Set selection1 = partDocument1.Selection

selection1.Search "CATPrtSearch.PartDesign Feature.Activity=FALSE"

'if no deactivated components then end program
If selection1.Count = 0 Then
MsgBox "No deactivated features."
Exit Sub
Else

'delete all deactivated components then update the part
selection1.Delete
part1.Update
End If

'error handling
'Else
' Msgbox "Not a part document! Open a single part document."
'End If
End Sub
David Buck
  • 3,752
  • 35
  • 31
  • 35
  • Do you get an error message and at what line? Can you post a screenshot of your parr’s tree? – GisMofx Feb 22 '20 at 23:34
  • Hi there is no error in the code it's just on another computer i ha locked Hybrid bodies in part infrastructure and i think that is cousin me the problem. and I don;t know how to solve it. There was similar question here and it was solved like this on this link. but I don't know how to use it in my code. https://stackoverflow.com/questions/40632325/vba-macros-for-catia-works-on-one-computer-and-doesnt-work-on-another – Aleksandra Dobrosavljevic Feb 24 '20 at 20:57
  • Ah, I see. Do both machines have the same licenses available? – GisMofx Feb 24 '20 at 21:05
  • Yes. I an using HD2 on both computers – Aleksandra Dobrosavljevic Feb 25 '20 at 16:13

0 Answers0