
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello.
I am trying to make sweep function with section twisted sweep. (like Helical Gear)
I made below codes but got runtime error at last line.
(Commented lines are my challenges but not worked)
I attach twisted sweep feature result by manual operation.
Sketch3D oSketch3D = oPartDoc.ComponentDefinition.Sketches3D.Add();
Point stPoint = oTransGeom.CreatePoint(0, 0, 0);
Point endPoint = oTransGeom.CreatePoint(0, 0, 10);
SketchLine3D oLine = oSketch3D.SketchLines3D.AddByTwoPoints(stPoint, endPoint);
Path oPath = oCompDef.Features.CreatePath(oLine);
PlanarSketch oSketch = oCompDef.Sketches.Add(oCompDef.WorkPlanes[3]);
SketchEntitiesEnumerator oRectangle = oSketch.SketchLines.AddAsTwoPointRectangle(oTransGeom.CreatePoint2d(1, 1), oTransGeom.CreatePoint2d(4, 3));
Profile oProfile = oSketch.Profiles.AddForSolid();
SweepDefinition sweepDef = oCompDef.Features.SweepFeatures.CreateSweepDefinition(SweepTypeEnum.kPathAndSectionTwistSweepType, oProfile, oPath, PartFeatureOperationEnum.kJoinOperation);
sweepDef.TwistAngle = Math.PI / 2.0;
//ObjectCollection oCollectionPt = ThisApplication.TransientObjects.CreateObjectCollection();
//oCollectionPt.Add(stPoint);
//ObjectCollection oCollectionVec = ThisApplication.TransientObjects.CreateObjectCollection();
//UnitVector dirVec = oTransGeom.CreateUnitVector(0, 0, 1);
//oCollectionVec.Add(dirVec);
//sweepDef.SetSectionTwists(oCollectionPt, oCollectionVec);
oCompDef.Features.SweepFeatures.Add(sweepDef);
Is there anybody have solution?
Solved! Go to Solution.