Inventor Engineer-To-Order (Read-Only)
Welcome to Autodesk’s Inventor ETO Forums. Share your knowledge, ask questions, and explore popular Inventor ETO topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to get list of the designs which have a certain parent?

9 REPLIES 9
Reply
Message 1 of 10
bsee1
700 Views, 9 Replies

How to get list of the designs which have a certain parent?

I'm trying to filter the list of elements available when adding a child.  I know this can be done using allowedComponents.  I'd prefer that this is a dynamic list, not a hardcoded list.  How can I add every part which has "xxxx_Machine" as its parent?

 

My attempt is here: edited

 

Any help would be appreciated.

 

Edited by
Discussion_Admin

 

*****************************
Win7 x64 - 16gb ram
i7 3610qm
FirePro M4000

Inventor 2013
ETO 6.1
9 REPLIES 9
Message 2 of 10
Jon.Balgley
in reply to: bsee1

If you're using allowedComponents, you can just say { :xxxx_machine } and that will allow you to insert new children using all designs that inherit from xxxx_machine.

 

It's not necessary to get the actual designs which inherit from that.  

 

Hope I am answering your question...

 

Edited by
Discussion_Admin


Jon Balgley
Message 3 of 10
bsee1
in reply to: Jon.Balgley

It does work, but I was hoping to have a bit more control over the selection.

 

Right now I have 2 parts directly under xxxx_Machine, then more parts under another Mixin(Also under xxxx_Machine).  Is there a way to display these parts all next to each other when making a selection?  

 

Currently, each part is hidden beneath its mixin, and the mixin has to be expanded to see the part. (The part I'm looking for is 2 levels beneath xxxx_Machine)

 

Edited by
Discussion_Admin

*****************************
Win7 x64 - 16gb ram
i7 3610qm
FirePro M4000

Inventor 2013
ETO 6.1
Message 4 of 10
Jon.Balgley
in reply to: bsee1

As far as I know, and given that mixin structure, you cannot use the built-in UI to get what you want.  You'll have to either write a custom UI (relatively big job) or change the mixin structure.  One thing you might try (I haven't tried it) -- add an extra mixin to exactly the designs you want to see.  It doesn't need to contain any rules.  Then use that mixin as the "allowedComponents".  Maybe the mixin will need to inherit from the "root" (project) design (which is also empty).


Jon Balgley
Message 5 of 10
bsee1
in reply to: Jon.Balgley

I'm now finally building a UI.  How can I do what I mentioned above in the UI?  You mentioned it was possible, but I haven't found a function I can use which will find the children of a Design in the Design Model tree.  

 

The ETO documentation has gotten better, but the UI documentation seems near nonexistant.

*****************************
Win7 x64 - 16gb ram
i7 3610qm
FirePro M4000

Inventor 2013
ETO 6.1
Message 6 of 10
Jon.Balgley
in reply to: bsee1

If you are "building a UI", you're probably using the Intent managed API (Autodesk.Intent namespace).  You can use "IntentAPI.GetDesigns" to get a DesignEnumerator, and then there are methods on that to get individual Design objects and certain subsets of Design objects. And/or you can use the properties of individual design objects ("mixins" property, "isKindOf" method) to search more carefully/specifically.

 

If you're not already using the Intent managed API, then I hope I am not leading you in the wrong direction.  Your question seems a bit vague to me.  Please consider the possibility that I am not understanding what you want to do.  Usually customers don't need to show the real Design (class) hierarchy in their end-user UI, except in limited cases ("show the user all the kinds of widgets she can create").  But maybe that's what you're doing, based on the questions earlier in the thread.


Jon Balgley
Message 7 of 10
bsee1
in reply to: Jon.Balgley

I'll try to explain better.  In the Design tree I have a design which has several parts under it.  In the UI, I'd like to allow the user to choose a part from a list of the parts which have that design.

The image isn't of the best quality due to company policy, but here is a small snippet of my design tree:  https://dl.dropbox.com/u/46698764/Capture.PNG

 

In that situation, I'd like to get a list of all parts/assemblies which use the design "_Transport".  If successful, I'd have a list of "_Drive_Motor", "_Stop", "_Intersection", "_Straight".

 

I wasn't sure if I should be looking for the parts which are children of the" _Transport" design, or I I needed to find all parts from the design model and use the isKindOf function on them.

*****************************
Win7 x64 - 16gb ram
i7 3610qm
FirePro M4000

Inventor 2013
ETO 6.1
Message 8 of 10
Jon.Balgley
in reply to: bsee1

Executive summary:  you probably do want use the API mechanisms I mentioned in my earlier message.

 

OK, we're getting somewhere, but it's not yet precise enough to give you an accurate answer.

 

There are two different hierarchies:  the Design "hierarchy" (which is really a graph, not a tree, due to multiple inheritance -- each Design can inherit from multiple Designs), and the part hierarchy (which is a strict tree, each part has one and only one parent).

 

Designs are like "classes".  Parts are like "instances".  

 

Or, in Inventor terms, an Intent Design is kinda analogous to an actual IPT file, while an Intent Part is kinda analogous to an occurrence of the IPT file in a parent IAM file.  Note use of "kinda".  If you're an Inventor user, it will be obvious that the things you do with an IPT file are vastly different from the things you do with an occurrence in an assembly.  Hence the need to be precise.

 

So it doesn't exactly make sense to ask about "looking for the parts which are the children of the ... design".  

 

It does make sense, albeit loosely, to speak of _DriveMotor, _Stop, and _Curve_Transport as designs which are children of _Transport (but not _Straight -- I think you meant _Straight_Transport in your question).  Usually we don't say "design A which is a child of design B" because of the two "hierarchies".  Usually we say, "designs (such as _Drive_Motor) which inherit from _Transport" or "designs which mix in _Transport".  The latter also clarifies, a bit, the fact that a design can inherit from more than one design (multiple inheritance, aka multiple parents, although, again, we don't like to use the term "parent" when talking about Designs).  On the other hand, we do say "part A which is a child of Part B" ... here we are talking about the actual Intent model, as instantiated from a set of Designs.  Parts can only have a single parent, so the parent/child terminology is unambiguous for Parts.

 

It looks from your image like you are talking about the Design hierarchy.  As a general rule, you have to use the Intent API to query the set of Designs, as opposed to using Intent-language rules (in other words, Intent doesn't support reflection (much)).  In that case, you probably do want use the API mechanisms I mentioned in my earlier message.  It's probably NOT the right thing to find the parts (instances, occurrences) in the model ... that will only tell you the ones that have already been created (although it's hard to know for sure from what I'm guessing here).

 

The API is documented in Inventor under the "?" button, under "Community Resources" -- "Programming Help (Intent API)".

 

Anyway, I'm trying not to be pedantic, just trying to be sure that I give you correct advice.  And it's easy for me to blather on and on...

 

--Jon

 

 


Jon Balgley
Message 9 of 10
bsee1
in reply to: Jon.Balgley

Sounds like I was mostly just using the wrong terminology.  I'm talking about the design heirarchy.

 

I understand what you're saying about designs having multiple inheritance, but the design heirarchy still displays the designs in a tree view.  In the screenshot I took, you can see how the _Transport design "appears" as if it is a parent to several other designs.

 

I'm looking for a list of the designs which use both IvAssemblyDocument and _Transport.  (The IvAssembly mixin changes the design's icon, which is why I incorrectly referred to Designs which use it as parts)

 

I'm unsure of which function to use to filter down the list of designs.  I have the following incomplete code below...

 

 

List<string> listOfTransports = new List<string> ();

Autodesk.Intent.DesignsEnumerator designList = Autodesk.Intent.IntentAPI.Instance.GetDesigns();

foreach(Autodesk.Intent.Design oDesign in designList)

{

   if(oDesign  //isOfType IvAssembly and isOfType _Transport)

   {

        listOfTransports.Add(oDesign.Name)

   }

}

 

I know about the intentAPI documentation, but without examples I've been unable to determine what some of them actually do.  The conveyor demo has been decently helpful so far, but compared to what I'm attempting to implement, the demo is very limited.

*****************************
Win7 x64 - 16gb ram
i7 3610qm
FirePro M4000

Inventor 2013
ETO 6.1
Message 10 of 10
Jon.Balgley
in reply to: bsee1

So close!  Try something like this (I haven't tested it).

 

List<string> listOfTransports = new List<string> ();

Intent.Design oTransport = Autodesk.Intent.IntentAPI.Instance.GetDesign("_Transport");

Autodesk.Intent.DesignsEnumerator designList = Autodesk.Intent.IntentAPI.Instance.GetDesigns();

foreach(Autodesk.Intent.Design oDesign in designList)

{

   if(oDesign.isKindOf(oTransport))  'maybe need to check that it isn't oTransport itself.  

   {

        listOfTransports.Add(oDesign.Name)

   }

}

 

Sorry for being so long-winded before.


Jon Balgley

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report