I am trying to change a ConfigurationName in a LibraryFeature.
this my code:
Dim swApp As SldWorks.SldWorks
Dim swModel As ModelDoc2
Dim boolstatus As Boolean
Dim longstatus As Long, longwarnings As Long
Dim swSelmgr As SelectionMgr
Dim swLibFeat As LibraryFeatureData
Dim swFeat As Feature
Sub main()
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
swModel.ClearSelection2 True
boolstatus = swModel.Extension.SelectByID2("Point56@Sk_Segment", "EXTSKETCHPOINT", 0, 0, 0, False, 0, Nothing, 0)
boolstatus = swModel.Extension.SelectByID2("Plane_Seg", "PLANE", 0, 0, -0.02, True, 1, Nothing, 0)
boolstatus = swModel.Extension.SelectByID2("Line35@Sk_Segment", "EXTSKETCHSEGMENT", 0#, 0#, 0, True, 2, Nothing, 0)
swModel.InsertLibraryFeature "K:\China Library Featuers\WIRE GUARD\Tube_Segment.sldlfp"
boolstatus = swModel.SelectedFeatureProperties(0, 0, 0, 0, 0, 0, 0, 1, 0, "segment4")
Set swSelmgr = swModel.SelectionManager
Set swFeat = swSelmgr.GetSelectedObject6(1, -1)
Set swLibFeat = swFeat.GetDefinition
swModel.EditRebuild3
swLibFeat.AccessSelections swModel, Nothing
swLibFeat.ConfigurationName = "40X40X15"
boolstatus = swFeat.ModifyDefinition(swLibFeat, swModel, Nothing)
swLibFeat.ReleaseSelectionAccess
swModel.ClearSelection2 True
End Sub
the Red words can change the LibraryFeature ConfigurationName ,but the size is wrong. The Right size is 40(not 80).
my code is wrong ?help me
SolidworksApi macros