Extrusion and Sketch created from API sometimes doesn't extrude all Profiles

Extrusion and Sketch created from API sometimes doesn't extrude all Profiles

logan.andersonD3CSK
Contributor Contributor
563 Views
2 Replies
Message 1 of 3

Extrusion and Sketch created from API sometimes doesn't extrude all Profiles

logan.andersonD3CSK
Contributor
Contributor

I am trying to use a rule to create a sketch and extrude the profiles in the sketch to create a feature all using the API. I am trying to add slots to the side of a part and there can be between 1 and 4 slots. To reduce lines of code, I created the sketch in a way that it automatically builds in all four slots and then overlaps the profiles depending on the number of slots input by the user (see attached file for reference). This works great except in the case that I choose 2 slots where it only extrudes one of the two overlapping sets of profiles. Is there something I am missing that is affecting the extrusion for this specific scenario?

 

I am using Inventor 2021.3.1 on Windows 10.

0 Likes
Accepted solutions (1)
564 Views
2 Replies
Replies (2)
Message 2 of 3

WCrihfield
Mentor
Mentor
Accepted solution

My best guess is that you need to study the available options that you can set within the Profiles.AddForSolid() method.  It can get complicated when dealing with a complex sketch containing overlapping geometry, where you might normally manually select certain areas within the sketch that you are wanting to work with.  Since you're creating all the geometry within the rule, instead of editing an existing sketch, this may be easier to deal with.

 

Also, I would highly recommend that you incorporate a Transaction into your rule, so you can bundle all those actions into one item in the UNDO list, for easier managament, at least while testing.  That will make it way easier to quickly undo a botched run that did a bunch of stuff, but didn't do some of it right.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 3 of 3

logan.andersonD3CSK
Contributor
Contributor

I had tried digging into that before, but something clicked when I was going through the help page the second time. It took me little fiddling around with it, but I finally figured out how to get it to work. Thanks for your help!

 

I've attached the updated file/code in case anyone else has this type of problem in the future.

 

I didn't add a transaction into the rule as I don't particularly like using undo. I usually just delete the sketch/feature after each test rather than using undo. I can see where it would definitely be helpful though!