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!

3DX , EKL - How to obtain a ProductOccurrence from a PartFeature?

Status
Not open for further replies.

solid7

Mechanical
Jun 7, 2005
1,403
US
I am trying to work backwards from a geometric Feature inside of a part, and obtain its Product Occurrence, in the assembly context. I'm not quite sure how to arrive at this.

I am able to obtain an instance from 'GetPLMOwner', but even this isn't helpful, if we have multiple instances of the same name, in different instantiated products.

 
Replies continue below

Recommended for you

Fundamentally not possibe unless you initially access feature with some sort of selection agent in assembly context. In this case you have so called "path" to a feature that consists of product instances, not just part reference.
As you mentioned there're multiple instances of the same part within an assembly, so product modeler itself considers same feature within different instances as single object.
 
I'm passing the feature in as an argument.
.
If that doesn't work, then I'm trying to figure out if I can work backwards to the desired result, by first gathering a list of occurrences, and then seeing if my particular selection is inside a particular one of them. Although I'm not quite clear on how a distinction would be made between one instance of the feature, and another...
.
I'm not sure if I'm understanding the "IsContaining" method, but going to give this a try. (comparing my input to a list of occurrences)

 
"IsContaining" fails for every feature that I pass in. I can get the name of the feature to Notify out, but when I pass it into the "IsContaining" function, I get absolute zero. Unset with everything that I pass in, published or no.

Do you know why this would be?

 
I have the feeling that, as the Geometric Feature belongs to a RepRef, you won't be able to go up to the ProductOccurrence, unless you have only one!

But starting from the RootOccurrence, you can search all occurrences in which a search of your GeomFeature exist. then you do some magic to find which occurrence is the one you want.

I could not yet find a way to go up to find an occurrence, I always start from the root to find the one I want.

Or maybe you can use selection and CATIA.StatusBar but that is not within EKL domain, but a small vbs code could return the CATIA.StatusBar as a string and clear the selection...

Code:
...
AddToSelection(myGeoFeature, True)
ExecuteVBResource (...)
...

Eric N.
indocti discant et ament meminisse periti
 
But starting from the RootOccurrence, you can search all occurrences in which a search of your GeomFeature exist. then you do some magic to find which occurrence is the one you want.

Eric,

That's the approach that I tried to take in the post just above yours... But either the "IsContaining" method doesn't work, or else I don't understand it properly.

What I tried to do:

1) Pass in a feature
2) Return a list of all occurrences
3) Loop through occurrences, and list the passed in feature as the "IsContaining" reference

"IsContaining" returns NULL on every single thing that I pass in, no matter what. Even if the feature returns its attributes. (thus proving that it's not unset)

I'll have to dust off my VB and see if I can make something work. Not gonna lie, though... I'd prefer a pure EKL solution.

Thanks for your reply.

 
try something like (not sure about the syntax) :

Code:
for myOcc in myOccList {

[indent]if myOcc.Reference.Query("GeometricFeature", "x.Name ==\" bingo\" " ).Size()>0
[indent]myListOfGoodOcc.Append(myOcc)
[/indent]
[/indent]

}

You might have a one line with myOccList.Query("ProductOccurrence", "x.Rerefence.Query(...).Size()>0" ) but sometimes it's more readable with multi lines

This should provide a list with all Occ containing a GeometricFeature named "Bingo". You still have to find which Occ you want to work with...

using 2020X I do not see any "IsContaining" ... So I Query the Reference of the Occurrence to see if it exists...

the call to a VBS might not be a bad solution as you just have to return the CATIA.Statusbar and then parse the string in EKL



Eric N.
indocti discant et ament meminisse periti
 
But if I'm understanding that right, it's not going to give me what I need, because I may have 3 occurrences with that same named feature - in which case I get them all.

Here's the functionality, as referenced in the 2020x documentation: (I had mistakenly stated in a previously edited post that it was deprecated - but I was looking at the wrong method)

ProductOccurrence.IsContaining()
This method checks whether the given geometry intersects the space.

Signature
ProductOccurrence.IsContaining(Feature : Feature, Status : String) : Boolean
Arguments
Name Input/Output Required? Type Comment
Feature In Yes Feature The geometry to check if it intersects the input SpaceReference.
Status Out Yes String Describes whether the geometry intersects the given SpaceReference fully, partially or not at all.
ReturnType
Boolean
TRUE if the geometry intersects fully or partially the given SpaceReference, FALSE if it does not intersects it at all.

Example
/* SpaceOccurrence is the ProductOccurrence of a space object, feature is Feature object */

let result(boolean)
let Status(String)

result=SpaceOccurrence.IsContaining(feature, Status)
if(result)
Message("Intersection Status: ", Status)
 
so if you have 3 Occ, how can you tell one is good and the other wrong?

Eric N.
indocti discant et ament meminisse periti
 
Eric said:
so if you have 3 Occ, how can you tell one is good and the other wrong?

Thank you, that's exactly what I meant when I wrote "fundamentally not possibe". Feature "is contained" in all of the occurences as it has no assembly-level context itself by design.

Again:
Little Cthulhu said:
unless you initially access feature with some sort of selection agent in assembly context
which means you must select feature with CAA code or retrieve selected feature with VBScript where it's possible to obtain currently selected product occurence in the first place.

solid7, why would want to retrieve product occurence from a feature in the first place? There may be another way to your actual goal.
 
so if you have 3 Occ, how can you tell one is good and the other wrong?

That's a fair question. To be honest, I only look at occurrences, because I don't seem to have a pathway (methods or properties) on Instances. But I could be wrong...

I'd still need to find an instance inside the occurrence, and return its position matrix, to determine which occurrence is valid.

solid7, why would want to retrieve product occurence from a feature in the first place? There may be another way to your actual goal.

I'm just trying to get everything in a model back to absolute space. I want to return position matrices on axis systems, relative to each other, relative to absolute. I've already developed the functionality, and it works in a part model. But I need it to work in an assembly.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top