iLogic Lesson #14: Creating a Sketch with iLogic
For a complete iLogic course, beginner to intermediate, visit: https://design-automation.teachable.com/ Contact: [email protected] LinkedIn: https://www.linkedin.com/in/5428086/ More content on Instagram: https://www.instagram.com/designautomationsolutions/ iLogic Tutorials: https://www.youtube.com/playlist?list=PLQVQ8nYBZdlNF1Quc6_kMo0vM1Mxr_XPJ iLogic For Beginners Playlist: https://www.youtube.com/playlist?list=PLQVQ8nYBZdlOUl1opOmoihuRdBkXwfCjW iLogic Automation Examples: https://www.youtube.com/playlist?list=PLQVQ8nYBZdlPid5lM-ocZ5xw0X1ItSXjJ This YouTube Channel and Design Automation Solutions LLC. is not affiliated with Autodesk or Autodesk Inventor. Sub Main Dim oAsm As AssemblyDocument = ThisApplication.ActiveDocument Dim oAsmComp As AssemblyComponentDefinition = oAsm.ComponentDefinition Dim oOcc As ComponentOccurrence oOcc = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kAssemblyLeafOccurrenceFilter, "Select part with sketch") Dim oPartComp As PartComponentDefinition oPartComp = oOcc.Definition If oOcc Is Nothing Then Return Dim oSketch As Sketch = Nothing Dim SketchList As New ArrayList For Each oSketchTemp As Sketch In oPartComp.Sketches SketchList.Add(oSketchTemp.Name) Next If SketchList.Count = 0 Then Return Dim sSketch As String = InputListBox("Sketches found on the selected part", SketchList, "", "Select Sketch To Copy", "Sketches Found") If sSketch = "" Then Return oSketch = oPartComp.Sketches.Item(sSketch) Dim oOcc2 As ComponentOccurrence oOcc2 = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kAssemblyLeafOccurrenceFilter, "Select part to copy sketch to") Dim oPartComp2 As PartComponentDefinition oPartComp2 = oOcc2.Definition Dim WPList As New ArrayList For Each oWP As WorkPlane In oPartComp2.WorkPlanes WPList.Add(oWP.Name) Next Dim WP As String = InputListBox("Work planes found on the selected part", WPList, "", "Select a work plane to create sketch", "Work Planes Found") If WP = "" Then Return Dim oWP2 As WorkPlane' = oPartComp2.WorkPlanes.Item(WP) oWP2 = oPartComp2.WorkPlanes.Item(WP) '''Dim oSketches2 As PlanarSketches = oPartComp2.Sketches Dim oSketch2 As Sketch ' = oSketches2.Add(oWP2) oSketch2 = oPartComp2.Sketches.Add(oWP2) oSketch2.Name = "New Sketch" oSketch.CopyContentsTo(oSketch2) End Sub
Download
0 formatsNo download links available.