revolved cutout feature in assembly

Valued Contributor
Valued Contributor

I've never tried to work with assembly features before, but I have a need now.  Does anyone have a bit of code to get me started.  Haven't figured out how to begin the profile yet.  Thanks in advance.

Bob Reinkemeyer
CAD Integration developer
Martin Sprocket and Gear Inc.
5 REPLIES

Re: revolved cutout feature in assembly

Valued Contributor
Valued Contributor

Ok, following another thread I've managed to get the profile drawn.  There seems, however, to be a bug in the setaxisofrevolution method.  

 

SolidEdgeFrameworkSupport.Line2d oAxis = null;

SolidEdgePart.Profile oProfile = null;

SolidEdgeAssembly.Layouts oAssyLayouts = null;

SolidEdgeAssembly.Layout oAssyLayout = null;

SolidEdgeAssembly.AssemblyDocument oAssyDoc = null;

object status = 0;

 

oAssyLayouts = oAssyDoc.Layouts;

oAssyLayout = oAssyLayouts.Add(oAssyRefPlanes.Item(2),true, out status);

oProfile = (SolidEdgePart.Profile)oAssyLayout.Profile;

...

...

...

...

// set the axis of revolution
oAxis = oLines2d.AddBy2Points(-.0254, 0, .0254, 0);
oProfile.SetAxisOfRevolution(oAxis); // this is where it errors out.  

 

I believe it to be a bug in the API.  Can anyone confirm this?

Bob Reinkemeyer
CAD Integration developer
Martin Sprocket and Gear Inc.

Re: revolved cutout feature in assembly

Solution Partner Phenom Solution Partner Phenom
Solution Partner Phenom
Hi @martyman,
I tried to get this working with no success.
Like you I get an exception calling SetAxisOfRevolution.
I got Extruded cutout working.
But with RevolvedCutout I'm clueless. Tried the Axis parameter of the Add method with no success.
I think this is worth a IR at GTAC.
Please share the solution ( if any) here.
regards

JB
VS2015, SE ST10

Re: revolved cutout feature in assembly

Valued Contributor
Valued Contributor

many thanks for testing this.  I filed an IR this morning.   IR# 8960150

 

Bob Reinkemeyer
CAD Integration developer
Martin Sprocket and Gear Inc.

Re: revolved cutout feature in assembly

Solution Partner Phenom Solution Partner Phenom
Solution Partner Phenom

Hi, here is my example for a extruded assembly cutout:

open an existing assembly (here from Training directory):

            ' Build path to file.
            Dim filename As String = IO.Path.Combine(SolidEdgeCommunity.SolidEdgeUtils.GetTrainingFolderPath(), "carrier.asm")
            ' Open a new assembly document.
            assemblyDocument = documents.Open(Of SolidEdgeAssembly.AssemblyDocument)(filename)

 Then call this function:

    Shared Sub CreateExtrCutout(assemblyDocument As SolidEdgeAssembly.AssemblyDocument)

        Dim asmFeatures As SolidEdgeAssembly.AssemblyFeatures = Nothing
        Dim asmExtrCutouts As SolidEdgeAssembly.AssemblyFeaturesExtrudedCutouts = Nothing

        ' Get a reference to the assembly features collection.
        asmFeatures = assemblyDocument.AssemblyFeatures
        ' Get a reference to the assembly extrudes cutouts collection.
        asmExtrCutouts = asmFeatures.AssemblyFeaturesExtrudedCutouts
        ' arrays for the parameters
        Dim aParts(1) As Object
        Dim aProfiles(1) As Object
        ' the target part for the cutout
        aParts(0) = assemblyDocument.Occurrences.Item(3)

        ' Create Profile ...
        Dim RefPln As SolidEdgeAssembly.AsmRefPlane
        ' create RefPlane
        RefPln = assemblyDocument.AsmRefPlanes.AddParallelByDistance(assemblyDocument.AsmRefPlanes.Item(2),
                                                                       0, ReferenceElementConstants.igNormalSide, Nothing, Nothing, True)
        ' add the layout  = sketch
        Dim Lay As SolidEdgeAssembly.Layout
        Lay = assemblyDocument.Layouts.Add(RefPln)

        Dim Prof As SolidEdgePart.Profile = DirectCast(Lay.Profile, SolidEdgePart.Profile)

        'elements must be sorted to build a chain!!
        ' this is an open profile
        Prof.Lines2d.AddBy2Points(-0.002, 0.1, 0.05, 0.1)
        Prof.Lines2d.AddBy2Points(-0.002, 0.1, -0.002, 0.12)
        Prof.Lines2d.AddBy2Points(-0.002, 0.12, 0.05, 0.12)

        ' relation are not necessary...
        'Dim Relations As SolidEdgeFrameworkSupport.Relations2d = DirectCast(Prof.Relations2d, SolidEdgeFrameworkSupport.Relations2d)
        'Relations.AddKeypoint(
        '  Prof.Lines2d.Item(1), KeypointIndexConstants.igLineStart,
        '  Prof.Lines2d.Item(2), KeypointIndexConstants.igLineStart)
        'Relations.AddKeypoint(
        '  Prof.Lines2d.Item(2), KeypointIndexConstants.igLineEnd,
        '  Prof.Lines2d.Item(3), KeypointIndexConstants.igLineStart)

        Prof.End(SolidEdgePart.ProfileValidationType.igProfileSingle)
        ' assign to parameter array
        aProfiles(0) = Prof
        ' hide the profile
        Prof.Visible = False
        ' add new cutout
        asmExtrCutouts.Add(1, CType(aParts, System.Array),
                            1, CType(aProfiles, System.Array),
                            SolidEdgePart.FeaturePropertyConstants.igThroughAll,
                            SolidEdgePart.FeaturePropertyConstants.igBoth,
                            SolidEdgePart.FeaturePropertyConstants.igRight,
                            0,
                            Nothing, SolidEdgePart.KeyPointExtentConstants.igTangentNormal,
                            Nothing, Nothing)
    End Sub

I used an open profile, so the direction is critical, the cutout is made in both directions (igBoth)

This example is cuttion only one part.

regards

JB
VS2015, SE ST10

Re: revolved cutout feature in assembly

Valued Contributor
Valued Contributor

Ok, we finally got resolution on both items.  The setaxisofrevolution method is fixed and I convinced them to include it in ST10 MP1.  the assemblyextrudedcutout issue was me.  

 

from SE...

 

Make sure the

SolidEdgeConstants.KeyPointExtentConstants keypoint;

Is changed to

SolidEdgePart.KeyPointExtentConstants keypoint;

 

Make sure

keypoint = SolidEdgeConstants.KeyPointExtentConstants.igTangentNormal;

is changed to

keypoint = SolidEdgePart.KeyPointExtentConstants.igTangentNormal;

 

And make sure ref is put in front of the keypoint argument:

oAcutouts.Add(1, aOccurance, 1, aProfile, igThroughAll, igBoth, igLeft, 0, null, ref keypoint, null, null);

 

worked perfectly.  Thanks for the input!  You had it right JB, i just didn't see it.

Bob Reinkemeyer
CAD Integration developer
Martin Sprocket and Gear Inc.