1 ImportsSolidWorks.Interop.sldworks2 ImportsSolidWorks.Interop.swconst3 ImportsSystem.Runtime.InteropServices4 ImportsSystem5 6 Partial ClassSolidworksmacro7 8 Public SubMain ()9 Ten One DimSwdoc asMODELDOC2 = Nothing A DimSwpart asPartdoc = Nothing - DimSwdrawing asDrawingdoc = Nothing - Dimswassembly asAssemblydoc = Nothing the DimBoolstatus as Boolean=false - DimLongstatus as Integer=0 - DimLongwarnings as Integer=0 -Swdoc =CType(SWAPP.ACTIVEDOC,MODELDOC2) +Boolstatus = SwDoc.Extension.SelectByID2 ("Air_up_sketch","SKETCH",0,0,0,False,0, Nothing,0) - Swdoc.editsketch () +Swdoc.clearselection2 (True) A at DimThesketch asSketch -Thesketch =SWDOC.GETACTIVESKETCH2 - DimVsketchseg as Object -Vsketchseg =thesketch.getsketchsegments - DimSwsketchseg assketchsegment - DimK =0 in If not IsNothing(VSKETCHSEG) Then - forK =0 to UBound(VSKETCHSEG) toSwsketchseg =vsketchseg (k) +Swsketchseg.selectbymark (True,0) - Nextk the End If * $ Panax Notoginseng - End Sub the + " " <summary> A " "The sldworks swapp variable is pre-assigned for you. the " " </summary> + PublicSwapp asSldworks - $ $ End Class
SolidWorks Two Development Learning (1) How to select a sketch and traverse all the lines in the sketch