Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

iLogic To Create Sweep

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
felix.cortes5K3Y2
959 Views, 4 Replies

iLogic To Create Sweep

Hi Forum,

 

I want to create a sweep from two sketches but I do not know how to work it out.

 

So far, here's what I got

 

	Dim oPartDoc As PartDocument = ThisApplication.ActiveDocument
	Dim oSketch1 As Sketch = "Sketch1"
	Dim oSketch2 As Sketch = "Sketch2"
	Dim oCompDef As PartComponentDefinition
	oCompDef = oPartDoc.ComponentDefinition
	oSweep = oCompDef.Features.SweepFeatures.Add.....???

 

I'd like to create the sweep from oSketch1 and oSketch2 but do not know how to follow up the syntax to do so.

 

Best regards,

Felix Cortes

4 REPLIES 4
Message 2 of 5

SweepDefinition is the missing link here.

Define a SweepDefinition object and use SweepFeatures.CreateSweepDefinition

Use that to create the sweep with the Add command.

jvj
Message 3 of 5

Hi, To create a swepp with a single line route, for example, you could use something like this. Sketch1 is the sketch of the profile, and sketch2 is the sketch of the route.

 

Dim oPartDoc As PartDocument = ThisDoc.Document
Dim oCompDef As PartComponentDefinition = oPartDoc.ComponentDefinition
' Create a profile.
Dim oSketch1 As Sketch = oCompDef.Sketches.Item("Sketch1")
Dim oProfile As Profile = oSketch1.Profiles.AddForSolid
' Create a path.
Dim oSketch2 As Sketch = oCompDef.Sketches.Item("Sketch2")
Dim oPath As Path = oCompDef.Features.CreatePath(oSketch2.SketchLines(1))

' Create the sweep feature.
Dim oSweep As SweepFeature = oCompDef.Features.SweepFeatures.AddUsingPath(oProfile, oPath, kJoinOperation)

 


Please accept as solution and give likes if applicable.

I am attaching my Upwork profile for specific queries.

Sergio Daniel Suarez
Mechanical Designer

| Upwork Profile | LinkedIn

Message 4 of 5

Thanks Sergio, this worked

Message 5 of 5

Hey Sergio,

 

I am trying to add a Rectangular pattern onto the newly created sweep but it doesn't seem to work. Here's what I've tried so far:

 

Dim oPartDoc As PartDocument = ThisDoc.Document
Dim oCompDef As PartComponentDefinition = oPartDoc.ComponentDefinition
' Create a profile.
Dim oSketch1 As Sketch = oCompDef.Sketches.Item("Sketch1")
Dim oProfile As Profile = oSketch1.Profiles.AddForSolid
' Create a path.
Dim oSketch2 As Sketch = oCompDef.Sketches.Item("Sketch2")
Dim oPath As Path = oCompDef.Features.CreatePath(oSketch2.SketchLines(1))

' Create the sweep feature.
Dim oSweep As SweepFeature = oCompDef.Features.SweepFeatures.AddUsingPath(oProfile, oPath, kJoinOperation)
oSweep.Name = "Test"

'Dim TestPattern As RectangularPatternFeature = oCompDef.Features.RectangularPatternFeatures.Add("TestPattern", 3, 20 in, Nothing, "X Axis")
'Dim TestPatter0 As RecantgularPatternFeature = oCompDef.Features.RectangularPatternFeatures
'TestPatter0.CreateDefinition("Test", "X Axis", True, 3, "20 in")
Dim TestPattern As RecantgularPatternFeature = oCompDef.Features.RectangularPatternFeatures.CreateDefinition("Test", "X Axis", True, 3, "20 in")

The code fails on the last line. 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Technology Administrators


Autodesk Design & Make Report