Adding multiple RuledSurfaceFeatures throws error

Adding multiple RuledSurfaceFeatures throws error

johnPGNFG
Enthusiast Enthusiast
169 Views
2 Replies
Message 1 of 3

Adding multiple RuledSurfaceFeatures throws error

johnPGNFG
Enthusiast
Enthusiast

Hi all!

I'm having trouble adding a RuledSurfaceDefinition to RuledSurfaceFeatures.  I make a list of ruledSurfaceDefinitions and then I use a foreach loop to add each one to the RuledSurfaceFeatures.  I have no problem adding the first one but then I get an error when it tries to add the next one.  This doesn't happen all the time though.  Sometimes the code runs fine and others times it freezes when it tries to add the second one.  It also works fine if I put a breakpoint on the foreach loop and step through it.  I'm repeating this on the same part so everything is the same each time. Thoughts?

 

RuledSurfaceFeatures rsf = oCompDef.Features.RuledSurfaceFeatures;

 

foreach(RuledSurfaceDefinition rsd in ruledSurfaceDefinitionList)
{
rsf.Add(rsd);

}

 

johnPGNFG_0-1663632173780.png

 

 

0 Likes
170 Views
2 Replies
Replies (2)
Message 2 of 3

Michael.Navara
Advisor
Advisor

Perhaps this may occur when the first RuledSurface changes the inputs for the next one. For example you drill hole to the box. The drilled face is not the same as the source face (before drill).

Try to create definition and use them immediately. Then create the new one and repeat this steps.

0 Likes
Message 3 of 3

johnPGNFG
Enthusiast
Enthusiast

I did a little more searching and came across a different post that you answered that helped me figure it out.

 

https://forums.autodesk.com/t5/inventor-ilogic-and-vb-net-forum/inventor-api-oruledsurfacefeature-kn...

 

I was creating a RuledSurfaceEdgeFacePairs for each edge in the edgeloop I was looking at.  I created the RuledSurfaceEdgeFacePairs before my foreach loop and it worked fine.

0 Likes