We were unable to load Disqus. If you are a moderator please see our troubleshooting guide.

franz nidder • 5 years ago

Good day,
First of all, let me tell you that your work with macros is exceptional, very good work.

I'm a stupid programmer ... & i need your help & knowledge
little knowledge of VBA ...

My problem is the selection of a feature, in the tree, in a drawing file, of an assembly.

I will like to show the hidden edges of a selected feature through a script:

Sub main ()
Set swApp = Application.SldWorks

Set swModel = swApp.ActiveDoc ' i tried DrawingDoc too

Set swSelMgr = swModel.SelectionManager

Set swModelExt = swModel.Extension

bRet = swModelExt.SelectByID2 ("Feature@Assembly1-1@Drawing_View1/Part@Assembly1", "BODYFEATURE", 0, 0, 0, False, -1, Nothing, swSelectOptionDefault) 'in the tree, only the feature is selected, but

swApp.RunCommand 808, "Show_Hidden" 'This shows all the hidden edges of all features .... -> Result KO

End Sub

when i select, manually, in the tree the desired feature (sometimes not easy to find it in the tree),

and i run the script :

Sub main ()
Set swApp = Application.SldWorks

swApp.RunCommand 808, "Show_Hidden"

End Sub

only the edges of the selected feature are shown -> Result OK.

i tried other solutions to select the desired feature,
like:
TraverseFeatureManager
TraverseNode
GetParent
GetChildren
FeatureByName
FeatureByPositionReverse

everytime, all the part's edges are shown...

what is wrong?
What am I doing wrong?

can you help me, please?

thank you

Franz

sorry 4 poor ENG