Since I had no answer (have you ?) I told him "Well, I'll do a macro for
this in no time". Now I'm stuck because I can't see how to find those edges
through the API ... Do you ?
"Edges" are AFAIK accessed through View::GetPolylines so I thought hidden
ones would have some kind of attribute or style to say they aren't visible,
but it turns out hidden edges aren't listed in polylines...
Any different idea ? Thanks!
--
Philippe Guglielmetti - www.dynabits.com
There is a topic "Show Hidden Edges" in the Regular (not API) SW Help file.
You could see if this will do what your customer needs.
If you want to do it through API: Can you select edges by traversing the
underlying model while in the context of the drawing, then call
DrawingDoc.ShowEdge for all selected edges? Sorry I haven't actually tested
this to see if it works in a reasonable timeframe (or if it even works at
all for that matter)... Just something else to try if you haven't yet.
-- Brenda
"Philippe Guglielmetti" <ne...@dynabits.com> wrote in message
news:405aa825$0$710$5402...@news.sunrise.ch...
Thanks Brenda. My problem is different than the one explained in "Show
Hidden Edges". I'll explain it better:
1) create a simple cube and put it in a (front) drawing view in HLR (Hidden
lines removed)
2) right click the upper edge of the square you get in the view and "Hide
Edge" : it disappears
3) to make it re-appear, you must over the cursor over the place where you
know the edge is : it becomes red so that you can right-click it and "Show
Edge" it back
The question is : how to find such edges when you don't know where they are
? My customer has dozens all over large drawings...
Following the "Show Hidden Edges" help topic, all I could do was to make the
edges hidden by the 3D -> 2D projection visible (the edges which are on the
back of the cube), not the visible ones that I manually hid as described
above (which are in the front).
In other words, there are 2 kinds of "hidden edges" which doesn't make
things simpler: if you "Hide Edge" manually, the edge doesn't become an
hidden edge in the 3D sense (it would appear dashed in HLS mode) but it is
simply not rendered in 2D, whatever the mode.
I don't know how to detect this "invisibility bit" in API... I asked
apisupport, just can't wait...
Two thoughts. Can you compare the set of all visible edges to the set that's
created after all hidden edges are shown? Secondly, could this aspect of
edge status have something to do with fonts or line types. In other words is
it possible that swx handles hiding edges by assigning a font (one that's
not exposed to the user) that essentially makes the edge white or something
like that.
-Jason S.
"Philippe Guglielmetti" <ne...@dynabits.com> wrote in message
news:405aa825$0$710$5402...@news.sunrise.ch...
I think the DrawingDoc.ShowEdge is the API equivalent of the manual process
you were describing...It's just the selection of those edges that gets to be
tricky. What I was actually suggesting in the second part of my earlier
response was the comprehensive-edge-selection-by-brute-force method. In
other words, traverse all the faces in the part (or all the faces of all the
parts of all the assemblies, if need be) and for each face select all its
edges, then do a "ShowEdge" on them. It has no effect if the edges are
already showing, but it will unhide those that might be lurking in hiding.
I did try the code below, and it seems to work. You would just need to add
the part that cycles through the faces. Again, I have not tested to see if
this would work in real time for a drawing of a large assembly. So this may
or may not be practical.
For what it's worth,
Brenda
---------------------
Sub main()
Dim swApp As SldWorks.SldWorks
Dim swDwg As SldWorks.DrawingDoc
Dim varEdges As Variant
Dim lEdgeCount As Long
Dim swEdge As SldWorks.Edge
Dim swEntity As SldWorks.entity
Dim bRet As Boolean
Dim bAppend As Boolean
Dim i As Long
Set swApp = Application.SldWorks
Set swDwg = swApp.ActiveDoc
Dim swFace As SldWorks.face2
'-----------------------
' Add code to cycle through faces
' For each face do the following
'-----------------------
lEdgeCount = swFace.GetEdgeCount
varEdges = swFace.GetEdges
If Not IsEmpty(varEdges) Then
For i = 0 To lEdgeCount - 1
Set swEdge = varEdges(i)
If Not swEdge Is Nothing Then
Set swEntity = swEdge
bAppend = (i <> 0)
bRet = swEntity.Select2(bAppend, 0)
End If
Next i
swDwg.ShowEdge
End If
End Sub
-----------------------------------------------
"Philippe Guglielmetti" <ne...@dynabits.com> wrote in message
news:405d4ead$0$717$5402...@news.sunrise.ch...
Yes, and my brain was somehow locked on this problem.
Thanks for your "brute force" but working code. I'll start with this and
will make it more subtle when I'll know how.
Actually it's for a famous swiss watchmaker,
and those definitely don't like "brute force", so I won't tell them ;-)