Command Manager - Trim Surface

Command Manager - Trim Surface

llorden4
Collaborator Collaborator
752 Views
9 Replies
Message 1 of 10

Command Manager - Trim Surface

llorden4
Collaborator
Collaborator

A forum search has revealed that the Surface feature tools are not currently supported in the API, and as the sheet metal features are failing where the surface features are not, I appear to be forced down the path of using the Command Manager to attempt to automate a process, and the CM is a new beast to me.  (My Autodesk rep has already looked over the sheet metal failures and has pointed me to surfaces, please avoid the desire to try and solve the sheet metal issues I haven't provided details on).

 

I'm currently at a loss on how to make selections via the CM and was hoping that someone might provide some example code, I should be able to figure out how to apply it to my routines from there.

 

The command requires that I pick the 2d sketch to define the Cutting Tool (a pre-select failed to work here), then select the faces to remove, and then finally to accept the choices to complete the command.

 

I do know the 3d points for any of the edges I wish to choose and would be a snap to just pick a UCS point to select an item; but again here I need a crash course on how to make these selections and advance the command progression.

 

Anyone able to provide some pointers, and preferably an example I could adapt?

 

llorden4_0-1643036241743.png

 

Autodesk Inventor Certified Professional
0 Likes
Accepted solutions (1)
753 Views
9 Replies
Replies (9)
Message 2 of 10

WCrihfield
Mentor
Mentor

Just to clarify...are you talking about using the CommandManager.Pick() method here, or are you talking about using the CommandManager to execute a command that initiates the 'Trim Surface' user interface tool, ...or both?

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 3 of 10

llorden4
Collaborator
Collaborator

I've already got the command successfully executed, I need picking & advancing details; thanks.

Autodesk Inventor Certified Professional
0 Likes
Message 4 of 10

llorden4
Collaborator
Collaborator
To be very clear, I'm attempting to make the selections "without" user input (mouse activity). If this isn't an option, then that'd be good to know too.
Autodesk Inventor Certified Professional
0 Likes
Message 5 of 10

WCrihfield
Mentor
Mentor

@llorden4 & @J.Oye 

I see now that there doesn't appear to be an API method for creating a new TrimFeature object, not even from the TrimFeatures object, or the PartFeatures object.  I don't think I've ever attempted to create one by code before.  It seems to progress automatically from 'cutting tool' selection to 'faces to remove' selection, without needing to click any button or keyboard key.  That little detail makes it even more challenging to imagine what we would need to do from a code standpoint to advance from the first selection to the next.  Would using a simple line of code like  oDoc.SelectSet.Select(oObject) or oDoc.SelectSet.SelectMultiple(oObjectCollection) cause it to move from one to the other I wander.

 

As far as identifying the entities/objects to select, have you considered using the oObject.AttributeSets property that most Inventor objects have to identify, then the oDoc.AttributeManager methods to find those items?  It's not always the most convenient process, but is a pretty popular technique in Inventor automation.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 6 of 10

llorden4
Collaborator
Collaborator

And for those curious as to why we're pursuing the surface feature route, the sheet metal loft path vomited up this flat layout after making needed end cuts for a coped fit.

thumbnail_image.png

Autodesk Inventor Certified Professional
0 Likes
Message 7 of 10

Michael.Navara
Advisor
Advisor
Accepted solution

Is it possible to use SplitFeature instead of TrimFeature? 

SplitFeature has API support and when you need to create sheet metal part finally, you can select appropriate faces for ThickenFeature. Finally you can hide the source surface body.

0 Likes
Message 8 of 10

llorden4
Collaborator
Collaborator

Will give that a try, I'm not making any headway with the the command manager option.

Autodesk Inventor Certified Professional
0 Likes
Message 9 of 10

llorden4
Collaborator
Collaborator

I manually went through the modelling process with Split Face and was able to make the cut, and while it did make the desired cut, it also leaves all the cut pieces/faces in the model.  I've now got to Delete Face for each piece that remains, what a mess but it does appear to give me a good flat pattern once it's all done.  Once I figure out a routine to separate & delete the junk faces from the desired faces I should be able to make this work.

 

It's a Frankenstein solution, but a solution none the less.

Autodesk Inventor Certified Professional
0 Likes
Message 10 of 10

llorden4
Collaborator
Collaborator

@Michael.Navara 

Running into a new obstacle with this suggestion, got time to take a quick look here this thread and share more of that experience?

https://forums.autodesk.com/t5/inventor-ilogic-api-vba-forum/delete-face-feature-v2022-2/td-p/109076...

Autodesk Inventor Certified Professional
0 Likes