When converting assembly to weldment, existing features become 'Preperations'

When converting assembly to weldment, existing features become 'Preperations'

waynehelley
Collaborator Collaborator
241 Views
3 Replies
Message 1 of 4

When converting assembly to weldment, existing features become 'Preperations'

waynehelley
Collaborator
Collaborator

Hi all,

 

I have a script which we have used for a long time.  Once of the functions of the script is to change the document sub type of an assembly to weldment...

 

oDoc.SubType = "{28EC8354-9024-440F-A8A2-0E0E55D635B0}"

 

We have just noticed that this script always converts any existing features as 'Preparations'.  Is there any way to get the features to be converted to 'Machining' features?

 

waynehelley_0-1696835321084.png

 

Many thanks

Wayne Helley
Inventor 2013 Certified Professional

Autodesk Inventor Professional 2023
Visual Studio 2022
Windows 10 Pro, 64-bit
0 Likes
242 Views
3 Replies
Replies (3)
Message 2 of 4

WCrihfield
Mentor
Mentor

Hi @waynehelley.  That is a good question.  I do not believe that I have ever seen any built-in API method for converting a regular assembly into a weldment type assembly, that allows us to specify those settings that you see in the dialog.  I know what the 'command' is that gets executed when you click that button ("AssemblyConvertToWeldmentDocCmd"), but executing that button will show that user interface dialog, which we do not have any intuitive control over by code.  It might be possible to develop workaround process to accompany executing the command though.  I know that we can sometimes navigate an Inventor dialog that we normally do not have any API access to, by using the System.Windows.Forms.SendKeys.SendWait() method, and 'sending' keyboard keystrokes to Inventor from the iLogic rule after launching the dialog, but that is usually not very safe or reliable.  Also, I am not sure if we would be able to utilize the ThisApplication.CommandManager.PostPrivateEvent() method along with that command, to aid in inputting the needed settings by code.  You could try doing some trial & error experimentation along those lines if you wanted.  This would be a good question for someone at Autodesk to look into for us.

And by the way, here are the other two common conversion commands ("PartConvertToSheetMetalCmd" & "PartConvertToStandardPartCmd").

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 3 of 4

waynehelley
Collaborator
Collaborator

Hi @WCrihfield,

 

Thankyou for your reply.  I have done some experimenting with the 'PostPrivateEvent' but I haven't manage to find any syntax that works.

 

One thing I though might be possible is to change the features from 'Preparation' to 'Machining' afterwards.  Unfortunately, I haven't managed to spot anything in the API for this. 

Wayne Helley
Inventor 2013 Certified Professional

Autodesk Inventor Professional 2023
Visual Studio 2022
Windows 10 Pro, 64-bit
0 Likes
Message 4 of 4

WCrihfield
Mentor
Mentor

Hi @waynehelley.  The task of transitioning what could potentially be a large number of features of various types from one weldment sub-environment, to another crossed my mind before too, but I did not fully explore that possibility.  If there was just 1 or two very basic features like extrude cut type features, then it might be manageable, but the thought of trying to write a code solution so dynamic that it could handle an unknown number of every other possible type of feature boggles the mind.  One of the very challenging aspects of that task would be that you can only 'edit' one of those sub-environments at a time.  What I mean by sub-environments are the Welds, Machining, & Preparations within a weldment type assembly.  Each must be activated (enter into its Edit mode) before changes can be made.

As for the PostPrivateEvents and/or SendKeys related codes...if that dialog that shows when you execute that command is Modal (retains top focus while it is open, so you can not do other things while it is open), which I believe that it is, then any code you try to 'send' to that dialog after it has been launched will ineffective.  The rule will likely remain paused while it is showing, which is what happens when you launch an iLogic Form as Modal, then continue after it is closed.  However, if it is modal, it may be possible to use the PostPrivateEvents lines before the command is launched, then maybe the command might use that data.  There are certain routines involving file dialogs that can work that way.  But realistically this is all just theoretical guessing.  Only the folks at Autodesk would actually know for sure if this is even possible, and if so, how to accomplish it.

If you figure something out that is working for you, please let us know about it.  This would definitely be useful.  In the mean time, you could search the Inventor Ideas forum and see if there are any existing ideas in there for making this process easier through the API, and if there are none, you could create a post there about this.  Then paste a link there to this forum topic, and past a link here to that Ideas post.  If the idea gets enough votes, it could get implemented in a future release of Inventor.  Some ideas get implemented without that many votes, if they are fairly easy to make happen.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes