Need to know how to select a Line with VBA Macro
Need to know how to select a Line with VBA Macro
(OP)
Hello, I am trying to create a VBA macro which automatically create tracks in the DMU Fitting module.
For doing that, I need a shuttle, which represents the part I want to move and a line, which represents the track (path of the part in a dissasembly, for example). Then I select the "Generate Track" command in VBA and the shuttle which I wanna move, so CATIA opens a window in which I have to select the track.
The problem is that I can't select the line from the tree as you can see in the attached picture (it could have been done with the search command), I have to select it clicking directly with the mouse on the line, and I do not know if there is a function that allows me to do that in VBA.
If you need more information please, contact me, it's hard to explain
Thank you in advance
For doing that, I need a shuttle, which represents the part I want to move and a line, which represents the track (path of the part in a dissasembly, for example). Then I select the "Generate Track" command in VBA and the shuttle which I wanna move, so CATIA opens a window in which I have to select the track.
The problem is that I can't select the line from the tree as you can see in the attached picture (it could have been done with the search command), I have to select it clicking directly with the mouse on the line, and I do not know if there is a function that allows me to do that in VBA.
If you need more information please, contact me, it's hard to explain

Thank you in advance





RE: Need to know how to select a Line with VBA Macro
indocti discant et ament meminisse periti
RE: Need to know how to select a Line with VBA Macro
RE: Need to know how to select a Line with VBA Macro
You have to use in your code something like below (that is code for forcing user to be able to select only Geometrical Sets, you need to change for what you want). Search also forum for examples.
Dim InputType(0), Status As String
InputType(0) = "HybridBodies"
Status = MySelection.SelectElement2(InputType, "Select a Geometrical Set", False)
If (Status = "Cancel") Then Exit Sub
Regards
Fernando
https://picasaweb.google.com/102257836106335725208 - Romania
https://picasaweb.google.com/103462806772634246699... - EU
RE: Need to know how to select a Line with VBA Macro
First of all, thank you for your post.
I know what you mean, but my idea is that the macro could automatically select this edges, not the user. I mean, I know exactly which edge correspond to each shuttle, so it is better to do it in the macro.
Thank you again for you responses.
Hope that you can understand what I mean.
Regards
RE: Need to know how to select a Line with VBA Macro
Regards
Fernando
https://picasaweb.google.com/102257836106335725208 - Romania
https://picasaweb.google.com/103462806772634246699... - EU
RE: Need to know how to select a Line with VBA Macro
RE: Need to know how to select a Line with VBA Macro
I have tried with the function search and I can find all the edges of the model, but I do not know how to select the edge that I want. I am sure that it must exist a better way to do it, and I hope you can help me.
Thank you in advance.
RE: Need to know how to select a Line with VBA Macro
First of all, I need to select the line which corresponds with the edge I want, then I search the edge of this line in my previous selection. Here is the code.
Dim objSel As Selection, oSel As Selection
Set objSel = CATIA.ActiveDocument.Selection
objSel.Search ("Name=Shuttle.1,all")
Set oSel = CATIA.ActiveDocument.Selection
oSel.Search ("Name=Line.1,all")
objSel.Search ("Topology.CGMEdge,sel")
Thank you very much for the replies to my post. Hope I can help someone else with this.