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: 

Creating a Part on the Fly ... makepart()?

5 REPLIES 5
Reply
Message 1 of 6
Anonymous
592 Views, 5 Replies

Creating a Part on the Fly ... makepart()?

Hallo All,

I am just trying to create an inventor-based part on the fly, whithin a rule.

I tried to use make part(), but as far as I see, this does not give any visible result.

Is a child list the only way, to do these kind of things? Or do I over see anything?

Sebastian
5 REPLIES 5
Message 2 of 6
Anonymous
in reply to: Anonymous

In general, makePart() is dangerous and shouldn't be used for parts that you need to actually be rendered in the model. You should be using normal Intent children, or creating dynamic children via the API.

It might help to understand what you are trying to do at a higher level.
Message 3 of 6
Anonymous
in reply to: Anonymous

hello gene,

i am working on a "linear" design, somewhat similar to a conveyor. the user shall be able, to add one section after another (dynamic childs): - - - -

now some of the section types have to be connected by connecting elements (+): - - -+- - -+-.

intent shall introduce these connectors (+) on its own by a rule. and the connectors themselfs shall have user driven parameters.

i can do that by childlists, but than, i do not get the correct order of the parts in the browser (++- - - - - - - in spite of - - -+- -+-). i can also do that by making the connectors subparts of the sections, but that's not, what i was looking for.

i would like to avoid api at this point as well.

sebastian
Message 4 of 6
Anonymous
in reply to: Anonymous

Sebastian,

The best way to do this is to use a feature of Intent that is not well documented (or at all!) called "Intent Events". It allows you to react to certain rule changes in Intent by creating, modifying, and/or deleting dynamic children and rules, all from within Intent code, and not needing the API. Changes to parameters in the Edit Part dialog actually make dynamic changes to the underlying rules, so you can use Intent Events without having any custom UI and without using the API. This is not typical but it works fine.

I have attached a document describing this feature. However, it is an old document, written in the old Intent syntax and using the old "Intent Developer" interface. I hope it is helpful.

-gene
Message 5 of 6
Anonymous
in reply to: Anonymous

Here is a simple example you could drop into a design and play around with. It adds a sphere (assuming you're using Inventor here) so maybe you should place it in an assembly design.

{code}
Method postCreateSelf() As List
Return {{:action, :createDynamicPart, _
:part, Me.NHA, _
:name, :TestSphere, _
:design, "IvSphere"}}
End Method
{code}
If you want to add a dynamic rule to a part, perhaps to set a mating part or something, you could add this to your design:
{code}
Method preCreateSelf() As List
Return {{:action, :createDynamicRule, _
:part, Me, _
:name, :MatingPart, _
:formula, ":TestSphere1"}}
End Method
{code}
The dynamic rule that is added will be of type Any. It may be possible to change that, though I don't know how.

Notice I have used both pre/post events. In this example I wasn't worried about which one was used, but your situation may require one or the other.

A couple other events I know of are preDeleteSelf and postDeleteSelf. I'm not sure what other events are available.

Hope this helps!
Message 6 of 6
Anonymous
in reply to: Anonymous

The specific problem of the order of parts in the browser can be tackled by
overriding the assemblychildren rule that feeds the browser its order.
Currently no attempt is made to sort the children, but it would not be hard
to include your own sort criteria.
Elly

wrote in message
news:6354694@discussion.autodesk.com...
hello gene,

i am working on a "linear" design, somewhat similar to a conveyor. the user
shall be able, to add one section after another (dynamic childs): - - - -

now some of the section types have to be connected by connecting elements
(+): - - -+- - -+-.

intent shall introduce these connectors (+) on its own by a rule. and the
connectors themselfs shall have user driven parameters.

i can do that by childlists, but than, i do not get the correct order of the
parts in the browser (++- - - - - - - in spite of - - -+- -+-). i can also
do that by making the connectors subparts of the sections, but that's not,
what i was looking for.

i would like to avoid api at this point as well.

sebastian

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

Post to forums  

Autodesk Design & Make Report