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!

Select children of a selected item/hole ( macro )

Status
Not open for further replies.

Olivia86

Automotive
Sep 23, 2016
29
IT
Let's assume i have a hole , and a macro that i'ts painting this hole the color i want ( i allready made this ) , now i want to propagate the same color at all the matrix, and function linked to this hole.
Can this be done?

Hole.1
Matrix.1

Macro-color-holes.catscript ( i allready have this )

Read hole dimension.
Assign the hole a color related to the dimension.
Look for matrix (children) of this hole.
Assign the same color of the hole.

How can i implement this routine to this code?


Dim sel As Selection
Set sel = productDocument1.Selection
sel.Search "CATPrtSearch.Thread,all"
Set visPropertySet = sel.VisProperties
visPropertySet.SetRealColor 255,255,0,0
sel.Clear


Dim sel As Selection
Set sel = productDocument1.Selection
sel.Search "CATPrtSearch.Thread,all"
Set visPropertySet = sel.VisProperties
visPropertySet.SetRealColor 255,255,0,0
>> SELECT MATRIX OF THIS HOLE AND ASSIGN SAME COLOR.
selection.Clear


Thanks
 
Replies continue below

Recommended for you

Hi,

Vector86 said:
Look for matrix (children) of this hole.

I'm not a native English speaker, so excuse my question.

In the image bellow you have the Parent/Children of a hole. What does it mean for you matrix? Are you looking to color all holes in a part with same diameter with the same color? Can you give more details?

Capture_pbacah.jpg


Regards
Fernando

- Romania
- EU
 
what do you call Matrix.1 a Pattern? If you can get active body, check all shape until you find a pattern and check patternObject.ItemToCopy if it return your Hole...

BTW You're talking about a Hole, but you search for Threads... not same object in CATIA,and your search won't find hole with thread definition included, but will find thread operation applied to Hole, but not the one in the pattern.

When you do Hole with thread definition and Pattern it will also pattern the threads.

When you do Hole (no thread) or Pocket, then Thread it, make sure you select both the Hole and the Thread for Pattern.

now that you have either threaded Hole or Hole/Pocket + Thread, you get the active body and loop all shape and check thepattern.ItemToCopy.

As I am looking into it as I'm coding right now, I can see limitation here as ItemToCopy will return only the first selected object, so in case of Hole/Pocket + Thread, it will not work for you.

So Methodology would be to use only Threaded Hole and not Hole or Pocket + Thread...

Not sure if ThreadAnalysis API i available, or maybe Parent/Children API...

Good luck


Eric N.
indocti discant et ament meminisse periti
 
ok it will work only if you select the Thread first then the pocket/hole when you do the Pattern... which would be a weird way but not impossible.

Eric N.
indocti discant et ament meminisse periti
 
Thanks but probably i'v been misunderstood. The code i pasted is just a parte of a code that is rolling and looking for holes/threads/diameters etc..
So i really don't need this kind of "differentiation" the software will make this for me , i would just like to know if there is a command to call for children.

Once i have the desired hole selected. I need a comand to select it's linked matrix, like the screen i'v posted.

download.aspx
 
easiest way would be like I said, scan all feature in solid until you find Pattern, then look at .ItemToCopy remember the limitation that it will work only if the selected object is the first on the list.

Eric N.
indocti discant et ament meminisse periti
 
If .ItemToCopy racall the hole it's fine for me, i will make a try.
 
Having the matrix selected and launching the comand .ItemToCopy in the macro i'm not giving me the hole. Wich is the syntax exactly?

UPDATE.

I managed to make this work but further consideration i strictly need something from "holes" to they'r "matrix" is there no command for that?
Like there is for products? ( children )
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top