Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

CATIA V5 Macro for get parent 2

Status
Not open for further replies.

Kikoupe

Mechanical
Jul 7, 2021
17
FR
Hi guys,

I would like have a macro which will get a parent from a product or a part selected.
I have a product (catproduct) with many many part (catpart) and the problem is : When i would like to copy a part from the product and past it in the same product i need to scroll up during 1000 years --".

So my questions are :
- did catia V5 have a shortcut for it ? if yes which one, cause i looking for it for long time but find nothing...
- If not, do you have a macro to get a parent from the selected part in the tree and center graph the parent ?

Thanks guys for your support !

 
Replies continue below

Recommended for you

Hi, you don't need a macro for this...right click on your part/product and choose "Open Sub-Tree". This command opens up a window with that part of the loooooong tree.

regards,
LWolf
 
Hi LWolf,

Thanks for your reply but actually I don't want to see the sub tree i want to have the level upper...
To illustrate it :

Product1///
- Product2///
--Part1
--Part2
--Part3
--Part4
.
.
.
.
.
--Part11111
--Part11112

I want to copy/paste Part11111 and Part11112 into Product2 without scroll up during long time...
Please see picture :
Caption1_zwhpzm.png
 
yes, so right click on the product2 and open it with the aforemetionen function "Open-Sub Tree". Copy then the two parts, Ctrl-C, high-light product2 in the separate little window just opened and paste into it.
pls. try

regards,
LWolf
 
WOW !!!!!
Ok no need macro then !!!
Thx a lot !
 
Hey guys,

I need you again on this.
Now i have a lot (like a lot) of .catpart under a .catproduct and i really need to get the parent by maacro...
So what I need is : i left clic on a .catpart then macro that "center graph" the .catproduct

Pls help... ?
 
Code:
Sub CATMain()
  Dim sel: set sel = CATIA.ActiveDocument.Selection
  Dim prd: set prd = sel.Item(1).LeafProduct
  sel.Clear
  sel.Add prd.Parent.Parent
  CATIA.StartCommand "CATCafCenterGraphHdr"
End Sub
 
Thanks a lot Little Cthulhu !!! It's work very well !
 
Guys,

To push a little bit more my request
Do you think it's possible to use button (UP, DOWN, RIGHT, LEFT) keyboard's to navigate in the tree ?

like from the selected element if I press :

Up button : I get the part above
Down button : I get the part below
Right button : I get the first children
Left button : I get the parent

Thx for your help :)
 
you can activate the tree structure by clicking on the small white axis at the bottom right of catia screen then select any part in the assembly and use up down left right to move in assembly...

Eric N.
indocti discant et ament meminisse periti
 
Hey itmyjob, thx for your reply!

I kewn this tips before but actually, i never use it cause we need to activate the tree structure ! (yeah i'm boring, iknow...) But the main cause is the righ button go on design mode and as I said i have a looooot of different components... and if I go on design mode it took long (long long) time... the same issue to "get parent" (part above). The macro above is "fast" i'm looking for something "ergonomic"...

Thanks :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top