Re: edit an extrude feature (what is wrong with this vb api)

Please remember that manually, you would first need to select the component,
Edit Part to set the focus from the assembly to the part and then proceed
with the edits.
Regards,
Reply to
Robert V. Hanson
Loading thread data ...
the following code works when a face is selected in one part and an extrude feature is selected in another part. but the line: myextrude.SetEndConditionReference True, myentity does not work when myentity was a refplane. how do you get a refplane as an entity or how do you use SetEndConditionReference when you have a refplane as the end condition.
Sub main()
Dim selection As SelectionMgr Dim MyModeldoc As ModelDoc2 Dim swapp As SldWorks.SldWorks Dim bret As Boolean Dim myentity As entity Dim myfeature As feature Dim myextrude As ExtrudeFeatureData2 Dim myassembly As AssemblyDoc Dim SelectedComponent As Component2
Set swapp = CreateObject("SldWorks.Application") Set MyModeldoc = swapp.ActiveDoc Set myassembly = swapp.ActiveDoc
Set selection = MyModeldoc.SelectionManager
Set myentity = selection.GetSelectedObject4(1)
Set myfeature = selection.GetSelectedObject4(2)
Set SelectedComponent = selection.GetSelectedObjectsComponent(2)
SelectedComponent.Select2 False, 1
bret = myassembly.EditPart2(True, True, 0)
Set myextrude = myfeature.GetDefinition
bret = myextrude.AccessSelections(myassembly, SelectedComponent) Debug.Print bret myextrude.SetEndConditionReference True, myentity
bret = myfeature.ModifyDefinition(myextrude, myassembly, SelectedComponent) Debug.Print bret
myassembly.EditAssembly
End Sub
Reply to
Sean Phillips

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.