Inventor Customization

Reply
Valued Contributor
ROBTRONIX
Posts: 81
Registered: ‎11-19-2008
Message 1 of 4 (217 Views)
Accepted Solution

Sweep with Guide Rail using API ??

217 Views, 3 Replies
06-29-2012 10:36 AM

Hi Guys,

 

We are developing an equation driven 3d spline using VBA.

It generates a 3D spline, guide rail, and tool profile, but we're having trouble figuring out how to do the actual "sweep with guide rail" using the API.

 

Attached is an .ipt of the shapes our program is generating automatically.  

The problem is we are having to manually create the sweep after the geometry is created.

 

How can we automate the sweep with guide rail process?  Can someone point me in the right direction on how to do something like this?

 

 

 

 

 

Autodesk Inventor 2012 Certified Assosicate
Autodesk Inventor 2012 Certified Professional
Valued Contributor
ROBTRONIX
Posts: 81
Registered: ‎11-19-2008
Message 2 of 4 (216 Views)

Re: Sweep with Guide Rail using API ??

06-29-2012 10:38 AM in reply to: ROBTRONIX

BTW still using Inventor 2011

Autodesk Inventor 2012 Certified Assosicate
Autodesk Inventor 2012 Certified Professional
Distinguished Contributor
thomaskennedy
Posts: 112
Registered: ‎09-27-2010
Message 3 of 4 (193 Views)

Re: Sweep with Guide Rail using API ??

07-03-2012 01:37 AM in reply to: ROBTRONIX

This should get you going, it will do your first sweep feature :

 

Public Sub SweepFeature()

'reference the part doc
Dim oPartDoc As PartDocument
Set oPartDoc = ThisApplication.ActiveDocument

'reference to the sketches
Dim oSketches As PlanarSketches
Set oSketches = oPartDoc.ComponentDefinition.Sketches

'get the TOOL 1 sketch
Dim oSketch As PlanarSketch
Set oSketch = oSketches.Item("TOOL 1")

' Create a profile from oSketch (TOOL 1)
Dim oProfile As Profile
Set oProfile = oSketch.Profiles.AddForSolid

'get the PATH sketch
Dim oSketch2 As PlanarSketch
Set oSketch2 = oSketches.Item("PATH")

'get the first line in the sketch
Dim oSketchLine1 As SketchLine
Set oSketchLine1 = oSketch2.SketchLines.Item(1)

'set oSketchLine1 as the path
Dim oPath As Path
Set oPath = oPartDoc.ComponentDefinition.Features.CreatePath(oSketchLine1)

'get the RAIL 1 sketch (a 3D sketch in this case, not a planar sketch)
Dim oSketches3D As Sketches3D
Set oSketches3D = oPartDoc.ComponentDefinition.Sketches3D
Dim oSketch3D As Sketch3D
Set oSketch3D = oSketches3D.Item("RAIL 1")

'get the first spline in the sketch
Dim oSketchSpline As SketchSpline3D
Set oSketchSpline = oSketch3D.SketchSplines3D.Item(1)

'set the spline as the guide path
Dim oGuide As Path
Set oGuide = oPartDoc.ComponentDefinition.Features.CreatePath(oSketchSpline)

'do the sweep feature with Path and Guide Rail
Dim oSweep As SweepFeature
Set oSweep = oPartDoc.ComponentDefinition.Features.SweepFeatures.AddUsingPathAndGuideRail(oProfile, oPath, oGuide, PartFeatureOperationEnum.kCutOperation, SweepProfileScalingEnum.kNoProfileScaling)

End Sub

 

 

If you search in the API help ( ? > Additional Resources > Programming Help ) for 'sweep' you will find some help in there. Theres also some sample code in the help to create a sweep feature.

 

Hope this helps

 

Tom

Valued Contributor
ROBTRONIX
Posts: 81
Registered: ‎11-19-2008
Message 4 of 4 (170 Views)

Re: Sweep with Guide Rail using API ??

07-19-2012 08:03 AM in reply to: thomaskennedy

Tom,

 

Thanks a bunch, that worked out great!  

Would you know how to go about doing a circular pattern of the swept features?  

 

 

Rob

Autodesk Inventor 2012 Certified Assosicate
Autodesk Inventor 2012 Certified Professional

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community


Inventor Exchange Apps

Created by the community for the community, Autodesk Exchange Apps for Autodesk Inventor helps you achieve greater speed, accuracy, and automation from concept to manufacturing.

Connect with Inventor

Twitter

Facebook

Blogs

Pinterest

Youtube