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: 

Auto Sweep Pipe from sketch

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
rp
Contributor
238 Views, 3 Replies

Auto Sweep Pipe from sketch

We now have a code to click a sketch and then click a 3d sketch line to sweep a pipe (see code below).

Is there a possibility to automate this.

Just clicking the rule to make the sweep (pipe) allong the 3d sketch.

The 2D sketch is a circle for the outside and a circle for the inside diameter.

The 3D sketch is a path from workpoint to workpoint.

 

 

Dim doc As PartDocument = ThisDoc.Document

Dim profile As Profile = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kSketchProfileFilter, "Select profile")
Dim curve As Object = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kSketch3DCurveLinearFilter, "Select sketch line")

Dim features = doc.ComponentDefinition.Features

Dim path As Path = features.CreatePath(curve)

Dim sweepFeatures = features.SweepFeatures
Dim sweepDefinition = sweepFeatures.CreateSweepDefinition(SweepTypeEnum.kPathSweepType, profile, path, PartFeatureOperationEnum.kNewBodyOperation)
sweepFeatures.Add(sweepDefinition)

 

rp_0-1688641949121.png

 

Thanks in advance,

 

Ricardo

 

3 REPLIES 3
Message 2 of 4
FINET_Laurent
in reply to: rp

Hi @rp,

 

What exactly do you want to automate? The sketches creation ? Or just removing the manual selection?

What would the workflow look like? 

 

Kind regards,

FINET L.

If this post solved your question, please kindly mark it as "Solution"

If this post helped out in any way to solve your question, please drop a "Like"

@LinkedIn     @JohnCockerill

Message 3 of 4
rp
Contributor
in reply to: FINET_Laurent

Hi @FINET_Laurent ,

 

The manual operation of clicking 1st the sketch and 2nd the 3D sketch.

What we want is, when we click the rule it will automaticly make the sweep of the pipe. 

So you don't have to click on the both sketches for the sweep.

 

Kind regards,

Ricardo

Message 4 of 4
FINET_Laurent
in reply to: rp

Hi @rp,

Asuming there is only one 2D sketch (for the profile), and there is only one 3D sketch (for the path), here is an exemple:

Dim doc As PartDocument = ThisDoc.Document
Dim PartCompDef As Inventor.PartComponentDefinition = doc.ComponentDefinition

Dim profile As Profile = PartCompDef.Sketches.Item(1).Profiles.AddForSolid()
Dim curve As Object = PartCompDef.Sketches3D.Item(1).SketchLines3D.Item(1)

Dim features = doc.ComponentDefinition.Features

Dim path As Path = features.CreatePath(curve)

Dim sweepFeatures = features.SweepFeatures
Dim sweepDefinition = sweepFeatures.CreateSweepDefinition(SweepTypeEnum.kPathSweepType, profile, path, PartFeatureOperationEnum.kNewBodyOperation)
sweepFeatures.Add(sweepDefinition)

 

Kind regards,

FINET L.

If this post solved your question, please kindly mark it as "Solution"

If this post helped out in any way to solve your question, please drop a "Like"

@LinkedIn     @JohnCockerill

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

Post to forums  

Technology Administrators


Autodesk Design & Make Report