2 Replies Latest reply on Jul 14, 2014 12:58 AM by roberto gennari

    Change Wire body Style is possible?

    roberto gennari


      i have write a simple macro for display a line in wire body, but the result is a line with a style "CONTINUOS".

      I wolud that the style line is "CHAIN", but i don't now if is it possible (swPart.SetLineStyle "CHAIN" dont works)

      Can you help me,please?


      This is my macro code:


      Sub main()

      Dim swApp As SldWorks.SldWorks
      Dim swPart As SldWorks.PartDoc
      Dim swCurve As SldWorks.Curve
      Dim trimmed_curve As SldWorks.Curve
      Dim swFeature As SldWorks.Feature
      Dim swModeler As SldWorks.Modeler
      Dim swBody As SldWorks.Body2

      Dim nPt(2) As Double
      Dim nPte(2) As Double
      Dim vPt As Variant
      Dim vDir As Variant
      Dim retval As Long
      Set swApp = CreateObject("SldWorks.Application")
      Set swPart = swApp.ActiveDoc
      Set swModeler = swApp.GetModeler
      nPt(0) = 0
      nPt(1) = 0
      nPt(2) = 0
      vPt = nPt
      nPte(0) = 0
      nPte(1) = 0
      nPte(2) = 0.0000001
      vDir = nPte
      Set swCurve = swModeler.CreateLine(vPt, vDir)

      Set trimmed_curve = swCurve.CreateTrimmedCurve2(0, 0, 0, 0, 0, 0.1)

      Set swBody = trimmed_curve.CreateWireBody()

      'swPart.SetLineStyle "CHAIN"
      retval = swBody.Display3(swPart, 255, swTempBodySelectable)


      End Sub