08-07-2022
11:29 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
08-07-2022
11:29 AM
You were almost there, you just needed to place the workplane object you just selected into the Sketches.Add method.
Just swap "oPlane" for the first plane "oDoc.ComponentDefinition.WorkPlanes.Item(1)"
Dim Sketch2 As PlanarSketch = oDoc.ComponentDefinition.Sketches.Add(oPlane,False)
Here is the rest of the rule cleaned up with declarations. Always best practice to declare the objects to gain access to there methods.
Dim filename As String = "F:\Work\DesingsHome\iLogic Rules\BOM\01.01.01-02 Деталь.ipt" Dim PartDoc As PartDocument = ThisApplication.Documents.Open(filename,False) Dim PartcompDef As PartComponentDefinition = PartDoc.ComponentDefinition Dim ExtFeature As ExtrudeFeature = PartcompDef.Features.ExtrudeFeatures.item(1) Dim ExtDef As ExtrudeDefinition = ExtFeature.Definition Dim ExtProfile As Profile = ExtDef.Profile Dim oSketchToCopy As PlanarSketch = ExtFeature.Definition.Profile.Parent Dim oDoc As PartDocument = ThisDoc.Document Dim oPlane As WorkPlane = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kWorkPlaneFilter, "") '-pick the WorkPlane Dim Sketch2 As PlanarSketch = oDoc.ComponentDefinition.Sketches.Add(oPlane,False)'oDoc.ComponentDefinition.WorkPlanes.Item(1) oSketchToCopy.CopyContentsTo(Sketch2)
If this solved a problem, please click (accept) as solution.
Or if this helped you, please, click (like)
Regards
Alan
Or if this helped you, please, click (like)
Regards
Alan