Announcements

Starting in December, we will archive content from the community that is 10 years and older. This FAQ provides more information.

Automatic alignment between reference planes

DamianoTasca
Enthusiast
Enthusiast

Automatic alignment between reference planes

DamianoTasca
Enthusiast
Enthusiast

Making reference to this post:

 

https://forums.autodesk.com/t5/inventor-programming-ilogic/constrain-two-selected-parts-together-usi... 

 

where a script had been created that automatically constrain the planes of two selected objects to each other.

 

It would be very useful to be able to develop an integration with a window in which you can choose which reference planes to align with each other.

 

This way it would be much quicker to apply constraints.

 

Would anyone be able to do something similar?

 

0 Likes
Reply
238 Views
5 Replies
Replies (5)

mat_hijs
Collaborator
Collaborator

I've made this tool for myself: 

mat_hijs_0-1721729014610.png

I can optionally enter a sub component name in case I want to constrain a subassembly using the planes in a sub component of that subassembly. Further I can enter the names of the work features in the first and second component that should be constrained together, the constraint type and the offset. When clicking OK I get prompted to select component 1, then component 2 and the constraints are made. Then it prompts me to select component 1 again, then component 2 and so on until I press Esc.

 

So it is definitely possible to make something like this. I would suggest to start by creating some ilogic rules to become familiar with constraining components by code and then moving it over to an add-in where you can add a user interface to make it easy to use.

0 Likes

DamianoTasca
Enthusiast
Enthusiast

Hi, @mat_hijs,

thanks for your reply!

 

Unfortunately I'm not that expert to be able to create a similar program on my own.

If you could share this tool or the related script, it would be very useful to all other Inventor users.

 

It would be very kind of you...

Thanks in advance!

0 Likes

mat_hijs
Collaborator
Collaborator

Since what I've made is part of an add-in it's not just one piece of code that you can copy and paste. I'm also not keen on sharing the whole add-in.

I think the best way for you to create something similar is to take it step by step and then try to combine everything into something that works for you. Here are some things you'll need:

  • User Interface (I wouldn't worry about UI too much when starting out and do this when you've figured out most of the other steps)
  • Selecting the components
  • Getting the necessary work features from the selected components
  • Creating proxies of the work features (basically a representation of the selected work feature in the context of the assembly)
  • Creating the constraints
  • Error handling

And here are some samples that may help you get started:

Feel free to ask for further help should you get stuck.

0 Likes

DamianoTasca
Enthusiast
Enthusiast

Hello @mat_hijs

thank you again for your interest and technical support which I really appreciate.

 

The sequence of steps you indicated does more or less the same thing as the initial script I was referring to (see link in the first post of this discussion) which constrains the work plans together.

 

Now I would need the user interface where I can select the reference planes. This is my main problem that I would like to find a solution to.

 

Do you have any suggestions?

0 Likes

mat_hijs
Collaborator
Collaborator

Regarding user interface the first option is ilogic forms, but those are very limited in what you can do and I don't think they'll be your best choice for this.

Here's more info on that: https://help.autodesk.com/view/INVNTOR/2025/ENU/?guid=GUID-223E9090-5118-406D-9D80-EC247997A7F4

 

The second option is creating a windows form in visual studio, which will give you a lot more freedom to do what you want, but is also a bit more difficult. If you read a bit about it or do a quick youtube search, creating the form itself shouldn't be too much of a problem as it's quite simple. However, if you want to use a windows form you'll need to create an add-in that contains the form and the functionality that you want behind the form.

Here's some info about windows forms, but you'll be able to find a lot more with a quick search: https://learn.microsoft.com/en-us/dotnet/desktop/winforms/?view=netdesktop-8.0

Here's a guide to create your first add-in: https://www.autodesk.com/support/technical/article/caas/tsarticles/ts/29mPk2V7aweIo6eLckSF1k.html

 

Your third option would be to create a windows form in visual studio and have it called from an ilogic rule. I'm not sure why you would use this approach over creating an add-in but maybe someone else here can give their opinion on that.

Here's a little bit of info about that: https://help.autodesk.com/view/INVNTOR/2025/ENU/?guid=GUID-32B66838-22E4-4A0A-B5BB-862350C76B36

0 Likes