Inventor Engineer-to-Order

Reply
Mentor
bsee1
Posts: 211
Registered: ‎11-14-2011
Message 1 of 10 (295 Views)

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

295 Views, 9 Replies
06-25-2012 01:34 PM

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
Board Manager
Jon.Balgley
Posts: 243
Registered: ‎08-23-2006
Message 2 of 10 (289 Views)

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

06-25-2012 03:20 PM 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
Autodesk Configurator 360 / Inventor ETO team
Autodesk, Inc.

Mentor
bsee1
Posts: 211
Registered: ‎11-14-2011
Message 3 of 10 (275 Views)

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

06-26-2012 06:53 AM 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
Board Manager
Jon.Balgley
Posts: 243
Registered: ‎08-23-2006
Message 4 of 10 (271 Views)

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

06-26-2012 08:36 AM 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
Autodesk Configurator 360 / Inventor ETO team
Autodesk, Inc.

Mentor
bsee1
Posts: 211
Registered: ‎11-14-2011
Message 5 of 10 (240 Views)

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

08-03-2012 07:56 AM 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
Board Manager
Jon.Balgley
Posts: 243
Registered: ‎08-23-2006
Message 6 of 10 (229 Views)

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

08-03-2012 11:02 AM 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
Autodesk Configurator 360 / Inventor ETO team
Autodesk, Inc.

Mentor
bsee1
Posts: 211
Registered: ‎11-14-2011
Message 7 of 10 (227 Views)

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

08-03-2012 11:37 AM 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
Board Manager
Jon.Balgley
Posts: 243
Registered: ‎08-23-2006
Message 8 of 10 (223 Views)

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

08-03-2012 12:17 PM 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
Autodesk Configurator 360 / Inventor ETO team
Autodesk, Inc.

Mentor
bsee1
Posts: 211
Registered: ‎11-14-2011
Message 9 of 10 (220 Views)

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

08-03-2012 01:45 PM 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
Board Manager
Jon.Balgley
Posts: 243
Registered: ‎08-23-2006
Message 10 of 10 (216 Views)

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

08-03-2012 02:16 PM 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
Autodesk Configurator 360 / Inventor ETO team
Autodesk, Inc.

Announcements
Manufacturing Community
The Manufacturing Community provides additional access to tips, tutorials, blogs and networking with peers.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.