Confused on How to Add a New Profile for Extrusion

Confused on How to Add a New Profile for Extrusion

btillman
Advocate Advocate
505 Views
1 Reply
Message 1 of 2

Confused on How to Add a New Profile for Extrusion

btillman
Advocate
Advocate

I just started using Inventor 2014 Professional and would like to add a new profile for an extrusion which will be used for parts and in the Frame Generator. The only notes I've found on this is for Inventor 2009 and obviously things have changed since then. Can anyone point me in the right direction?

0 Likes
506 Views
1 Reply
Reply (1)
Message 2 of 2

philippe.leefsma
Alumni
Alumni

Are you talking about a programming approach? Because this section of the forum focuses on the API. You should be able to find examples about how to generate an extrusion directly in the API Help Files (provided when you install the product - check the "Inventor VERSION\Local Help\admapi_VERSION.chm"), here is an example:

 

Public Sub EditExtrudeFeature()
    ' Create a new part document, using the default part template.
    Dim oPartDoc As PartDocument
    Set oPartDoc = ThisApplication.Documents.Add(kPartDocumentObject, _
    ThisApplication.FileManager.GetTemplateFile(kPartDocumentObject))

    ' Set a reference to the component definition.
    Dim oCompDef As PartComponentDefinition
    Set oCompDef = oPartDoc.ComponentDefinition

    ' Create a new sketch on the X-Y work plane.
    Dim oSketch As PlanarSketch
    Set oSketch = oCompDef.Sketches.Add(oCompDef.WorkPlanes(3))

    ' Set a reference to the transient geometry object.
    Dim oTransGeom As TransientGeometry
    Set oTransGeom = ThisApplication.TransientGeometry

    ' Draw a 4cm x 3cm rectangle with the corner at (0,0)
    Dim oRectangleLines As SketchEntitiesEnumerator
    Set oRectangleLines = oSketch.SketchLines.AddAsTwoPointRectangle( _
    oTransGeom.CreatePoint2d(0, 0), _
    oTransGeom.CreatePoint2d(4, 3))

    ' Create a profile.
    Dim oProfile As Profile
    Set oProfile = oSketch.Profiles.AddForSolid

    ' Create a base extrusion 1cm thick.
    Dim oExtrudeDef As ExtrudeDefinition
    Set oExtrudeDef = oCompDef.Features.ExtrudeFeatures.CreateExtrudeDefinition(oProfile, kJoinOperation)
    Call oExtrudeDef.SetDistanceExtent(1, kNegativeExtentDirection)
    Dim oExtrude1 As ExtrudeFeature
    Set oExtrude1 = oCompDef.Features.ExtrudeFeatures.Add(oExtrudeDef)

    ' Get the top face of the extrusion to use for creating the new sketch.
    Dim oFrontFace As Face
    Set oFrontFace = oExtrude1.StartFaces.Item(1)

    ' Create a new sketch on this face, but use the method that allows you to
    ' control the orientation and orgin of the new sketch.
    Set oSketch = oCompDef.Sketches.AddWithOrientation(oFrontFace, _
    oCompDef.WorkAxes.Item(1), True, True, oCompDef.WorkPoints(1))

    ' Determine where in sketch space the point (0.5,0.5,0) is.
    Dim oCorner As Point2d
    Set oCorner = oSketch.ModelToSketchSpace(oTransGeom.CreatePoint(0.5, 0.5, 0))

    ' Create the interior 3cm x 2cm rectangle for the pocket.
    Set oRectangleLines = oSketch.SketchLines.AddAsTwoPointRectangle( _
    oCorner, oTransGeom.CreatePoint2d(oCorner.X + 3, oCorner.Y + 2))

    ' Create a profile.
    Set oProfile = oSketch.Profiles.AddForSolid

    ' Create a pocket .25 cm deep (using distance extent).
    Set oExtrudeDef = oCompDef.Features.ExtrudeFeatures.CreateExtrudeDefinition(oProfile, kCutOperation)
    Call oExtrudeDef.SetDistanceExtent(0.25, kNegativeExtentDirection)
    Dim oExtrude2 As ExtrudeFeature
    Set oExtrude2 = oCompDef.Features.ExtrudeFeatures.Add(oExtrudeDef)

    ' Move the end of part above this extrude feature since the edit
    ' we are going to perform on this feature involves BREP input.
    Call oExtrude2.SetEndOfPart(True)

    ' Get the back face of the first extrusion to use as termination plane.
    Dim oBackFace As Face
    Set oBackFace = oExtrude1.EndFaces.Item(1)

    ' Change the extent type of the feature.
    Call oExtrude2.Definition.SetToExtent(oBackFace, False)

    ' Move the end of part back to bottom of the feature tree.
    Call oCompDef.SetEndOfPartToTopOrBottom(False)

    ' The following edit of the feature does not involve BREP input.
    ' Hence, no need to move the end of part.
    Call oExtrude2.Definition.SetDistanceExtent(0.25, kNegativeExtentDirection)
End Sub

Otherwise, if you are not talking about the API please log a thread in the product section of the forum.

 

Thanks,

Philippe.

 



Philippe Leefsma
Developer Technical Services
Autodesk Developer Network

0 Likes