Catiaer
Mechanical
- Nov 9, 2019
- 13
Hello all,
Here is an example of CATIA.Startcommand that I found on the internet.
I tested in the part design workbench then it sometimes(?) works.
I mean that after I reopen a catia instance, it works.
But when I use it 2 or more, it doesn't work any more..
And in assembly work bench I could have never seen that it works.
I tried to use with sendkeys that I type "Center Graph" as command and press enter key.
Before I did it, I tested manually to type "Center Graph" and entered, it didn't work also.
But when I use center graph in the command list, it works gut very well in the both workbench.
And the other function seems to work well, ex) reframe on, hide and show, etc
Is there another way to use center graph?
Here is an example of CATIA.Startcommand that I found on the internet.
I tested in the part design workbench then it sometimes(?) works.
I mean that after I reopen a catia instance, it works.
But when I use it 2 or more, it doesn't work any more..
And in assembly work bench I could have never seen that it works.
I tried to use with sendkeys that I type "Center Graph" as command and press enter key.
Before I did it, I tested manually to type "Center Graph" and entered, it didn't work also.
But when I use center graph in the command list, it works gut very well in the both workbench.
And the other function seems to work well, ex) reframe on, hide and show, etc
Is there another way to use center graph?
Code:
Sub CATMain()
Dim oSel As Selection
Set oSel = CATIA.ActiveDocument.Selection
Dim Name As String
Name = InputBox("Please enter name of geometry to search for.")
'In next line selection will search for name from inputbox inside all parts or products.
oSel.Search ("Name=" & Name & "*,all")
'When we made selection now we can use it
iCount = oSel.Count
MsgBox ("Number of shapes found: " & iCount)
For I = 1 To iCount
' CATIA.StartCommand ("Collapse All")
CATIA.StartCommand ("Center Graph")
' CATIA.StartCommand "Center Graph"
Next
End Sub
'You can run this macro in part and product!!