Reply
Solved! Go to solution

Extrusion fails until manual refresh

I'm recently new to VB and am expanding on some examples. I've written code to extrude an angle-iron shape and it works perfectly. However, I changed the cross section to a simple box beam (rectangle inside a rectangle), and the extrusion is entered into the feature tree as a failed feature. If I then manually open the sketch in question and exit the sketch without making any changes, Solid Edge recomputes the profile and creates the extrusion without a problem.

 

I'm sure the problem is in the profile (which is closed and constrained)...something to do with the geometry not being solid, but having a hole in the middle. Is there some special check I need to do? I was looking through the constants and I saw "igProfileAllowNested", which sounds somewhat related, but I don't know what it's used for.

 

3 REPLIES

Re: Extrusion fails until manual refresh

Can anyone shed any light on this? I know that I could do an extrude and then a cut, but for learning purposes, why does this happen? What am I missing?

 

Thanks.

Solution
Solution
Accepted by topic author Natedogg
‎08-26-2015 04:32 AM

Re: Extrusion fails until manual refresh

The following code is working for me:

'----------------------------------------------------------------------
' PAR: Create a protrusion from a rectangular hollow profile
'----------------------------------------------------------------------
Dim objDoc As PartDocument = objApp.ActiveDocument
objDoc.ModelingMode = ModelingModeConstants.seModelingModeOrdered
Dim objProfSets As SolidEdgePart.ProfileSets = objDoc.ProfileSets
Dim objProfSet As SolidEdgePart.ProfileSet = objProfSets.Add()
Dim objProf As SolidEdgePart.Profile = objProfSet.Profiles.Add(objDoc.RefPlanes.Item(1))
' Create the external rectangle
Dim L1 As SolidEdgeFrameworkSupport.Line2d = objProf.Lines2d.AddBy2Points(-0.05, -0.1, 0.05, -0.1)
Dim L2 As SolidEdgeFrameworkSupport.Line2d = objProf.Lines2d.AddBy2Points(0.05, -0.1, 0.05, 0.1)
Dim L3 As SolidEdgeFrameworkSupport.Line2d = objProf.Lines2d.AddBy2Points(0.05, 0.1, -0.05, 0.1)
Dim L4 As SolidEdgeFrameworkSupport.Line2d = objProf.Lines2d.AddBy2Points(-0.05, 0.1, -0.05, -0.1)
Dim objRels As SolidEdgeFrameworkSupport.Relations2d = objProf.Relations2d
objRels.AddKeypoint(L1, SolidEdgeConstants.KeypointIndexConstants.igLineEnd, L2, SolidEdgeConstants.KeypointIndexConstants.igLineStart)
objRels.AddKeypoint(L2, SolidEdgeConstants.KeypointIndexConstants.igLineEnd, L3, SolidEdgeConstants.KeypointIndexConstants.igLineStart)
objRels.AddKeypoint(L3, SolidEdgeConstants.KeypointIndexConstants.igLineEnd, L4, SolidEdgeConstants.KeypointIndexConstants.igLineStart)
objRels.AddKeypoint(L4, SolidEdgeConstants.KeypointIndexConstants.igLineEnd, L1, SolidEdgeConstants.KeypointIndexConstants.igLineStart)
' Create the inner rectangle
L1 = objProf.Lines2d.AddBy2Points(-0.047, -0.097, 0.047, -0.097)
L2 = objProf.Lines2d.AddBy2Points(0.047, -0.097, 0.047, 0.097)
L3 = objProf.Lines2d.AddBy2Points(0.047, 0.097, -0.047, 0.097)
L4 = objProf.Lines2d.AddBy2Points(-0.047, 0.097, -0.047, -0.097)
objRels.AddKeypoint(L1, SolidEdgeConstants.KeypointIndexConstants.igLineEnd, L2, SolidEdgeConstants.KeypointIndexConstants.igLineStart)
objRels.AddKeypoint(L2, SolidEdgeConstants.KeypointIndexConstants.igLineEnd, L3, SolidEdgeConstants.KeypointIndexConstants.igLineStart)
objRels.AddKeypoint(L3, SolidEdgeConstants.KeypointIndexConstants.igLineEnd, L4, SolidEdgeConstants.KeypointIndexConstants.igLineStart)
objRels.AddKeypoint(L4, SolidEdgeConstants.KeypointIndexConstants.igLineEnd, L1, SolidEdgeConstants.KeypointIndexConstants.igLineStart)
' Close the profile
objProf.End(ProfileValidationType.igProfileAllowNested)
' Hide all profiles (SE automatically creates a Profile object for each closed profile)
For Each objProf In objProfSet.Profiles
  objProf.Visible = False
Next
' Only pass the first profile to the AddFiniteExtrudedProtrusion method
Dim profs() = New Object() {objProf}
objDoc.Models.AddFiniteExtrudedProtrusion(1, profs, igLeft, 0.8)

 

Re: Extrusion fails until manual refresh

Thank you, you're suggestions worked. What my problem boiled down to was including igProfileAllowNested instead of igProfileClosed. Now there is no issue! I wasn't sure what that constant meant/when to use it because the documentation seems sparse sometimes.

 

Thanks.