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)
Thanks in advance,
Ricardo
Solved! Go to Solution.
Solved by FINET_Laurent. Go to Solution.
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"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
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"Can't find what you're looking for? Ask the community or share your knowledge.