Hi,
folgendes Macro habe ich geschrieben
Sub CATMain()
Window
'///////////////////////////////////// selection Loop /////////////////////////////////////////////////////////////
Dim Ref1(0)
Ref1(0)= "AnyObject"
Do
Dim E1,A As CATBSTR
Dim UserSel1 As Selection
Set UserSel1=CATIA.ActiveDocument.Selection
UserSel1.clear
E1 = UserSel1.SelectElement2(Ref1,"Select Body",true)
A = typename(UserSel1.Item(1).Value)
Msgbox typename(UserSel1.Item(1).Value)
Loop Until (A="Body")
MsgBox ("selection succesfull")
'//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Dim partDocument1 As Document
Set partDocument1 = CATIA.ActiveDocument
Dim selection1 As Selection
Set selection1 = partDocument1.Selection
Dim body1 As Body
Set body1 = UserSel1.Item(1).Value
selection1.Add body1
selection1.Copy
End Sub
Sub Window()
Dim Ref(0)
Ref(0)= "AnyObject"
Dim E As CATBSTR
Dim UserSel As Selection
Set UserSel=CATIA.ActiveDocument.Selection
E = UserSel.SelectElement2(Ref,"change window",fasle)
UserSel.clear
MsgBox("select Body to import")
End Sub
Ziel ist es das Window manuell wechseln zu können und dann ein Body auszuwählen der dann kopiert wird. Das Problem ist, wenn ich das Fenster anklicke zählt das auch als Selektion. Damit kommt mein Macro nicht klar. Hat jemand eine Idee
Eine Antwort auf diesen Beitrag verfassen (mit Zitat/Zitat des Beitrags) IP