AnsweredAssumed Answered

How to change Cosmetic Thread  value with API?

Question asked by Yong Ning on Jan 15, 2016

Sets the diameter for the dimension corresponding to the entity type with the cosmetic thread.

 

Now set  diameter methor change Parameter value.

 

      Set SwDim = SwModel.Parameter("D2@Cosmetic Thread1")

      Debug.Print SwDim.FullName, SwDim.Value

**********************************

Help, How to change diameter of cosmetic thread.?

**********************************

13.jpg

 

Follow code is  traverse feature, obtain dimenion.

''

Private Sub ll()

   Dim SwApp As SldWorks.SldWorks, SwModel As ModelDoc2

      Set SwApp = Application.SldWorks

      Set SwModel = SwApp.ActiveDoc

   Dim SwFeat As Feature, SwSubFeat As Feature

      Set SwFeat = SwModel.FirstFeature

      Do While Not SwFeat Is Nothing

          'Debug.Print SwFeat.Name

          Set SwSubFeat = SwFeat.GetFirstSubFeature

          Do While Not SwSubFeat Is Nothing

             'Debug.Print SwSubFeat.Name

             retuDispDim SwSubFeat

             Set SwSubFeat = SwSubFeat.GetNextSubFeature

          Loop

          Set SwFeat = SwFeat.GetNextFeature

      Loop

End Sub

''''''''

Function retuDispDim(SwFeat As Feature)

    Dim SwDispDim As DisplayDimension, SwDim As Dimension

       Set SwDispDim = SwFeat.GetFirstDisplayDimension

       Do While Not SwDispDim Is Nothing

           Set SwDim = SwDispDim.GetDimension

           With SwDim

               Debug.Print .FullName, .Value

           End With

           Set SwDispDim = SwFeat.GetNextDisplayDimension(SwDispDim)         

       Loop

End Function

 

Result is

 

S@Sketch1@Nut.Part           30

D@Sketch1@Nut.Part           20

D2@Cosmetic Thread1@Nut.Part               25

D1@Sketch3@Nut.Part          18

D2@Sketch3@Nut.Part          30

D1@Sketch4@Nut.Part          18

D2@Sketch4@Nut.Part          30

Attachments

Outcomes