This content has been marked as final. Show 2 replies
My company has changed how we do flat pattern drawings such that it requires the "mergeface" feature of the flat pattern feature to be turned off.
This is not a problem going forward for new parts and components, but if we want to reuse old components or parts, I want to make a macro so it makes the require changes to be updated to the new standard (merge face change being one of a few).
Where I am getting hung up on is that the API doesn't offer a "SetMergeFace" method for the flat pattern interface.
Being new to VBA and the solidworks API I assume I can change the parts flat pattern public property MergeFace, but it does not seem to make any changes.
Dim swApp As Object
Dim Part As Object
Set swApp = _
Set Part = swApp.ActiveDoc
Part.FeatureByName("Flat-Pattern1").GetDefinition.MergeFace = False
This effectively produces no change to the flat pattern feature
Breaking it out doesn't do anything:
Set swFeat = Part.FeatureByName("Flat-Pattern1")
Set swFlatPattern = swFeat.GetDefinition
swFlatPattern.MergeFace = False
Not knowing better, I assumed I am missing something with the access selection. I don't really understand the purpose of the .IAccessSelection2 method of the flat pattern interface. I assume it unlocks editing to the flat pattern feature? But when I have the code below I get "run time error '61836': Unable to read write-only property."
Dim Component As Component2
boolstatus = swFlatPattern.IAccessSelections(Part, Component)
Is there a way to edit the mergeface option of the flat pattern feature in a macro?