IDW DrawingView Visibility

IDW DrawingView Visibility

Anonymous
Not applicable
462 Views
4 Replies
Message 1 of 5

IDW DrawingView Visibility

Anonymous
Not applicable
I want to only show a view on my IDW when a Drill&Tap Hole is present and hide it at other times.

There are 2 named views on this particular drawing sheet:
"View1" , the base view
"TapEndView", the projected view of the shaft end of "View1"

Why does this code set not work? I assume that I'm setting the Object wrong for the Get/SetVisibility.

Dim oDrawingView As DrawingView

Select Case oUOM.GetValueFromExpression oTableParams.Item("Style").Value, kUnitlessUnits)
Case 1
'Debug.Print "Turn on IDW Sheet 1"
oSheet(1).Activate
If oUOM.ConvertUnits(oTableParams.Item("tapholediameter").Value, kDatabaseLengthUnits, kInchLengthUnits) > 0 Then
'Set Tap End View as Visible
For i = 1 To oSheet(1).DrawingViews.Count
If oSheet(1).DrawingViews(i).Name = "TapEndView" Then
Set oDrawingView = oSheet(1).DrawingViews(i)
Call oSheet(1).DrawingViews(i).GetVisibility(oDrawingView)
Call oSheet(1).DrawingViews(i).SetVisibility(oDrawingView, True)
End If
Next

Thanks,
Brian
0 Likes
463 Views
4 Replies
Replies (4)
Message 2 of 5

Anonymous
Not applicable
The GetVisibility and SetVisibility methods on a drawing view can only be
used to control the visibility of certain objects (sketches, 3d sketches,
components and surface features) within a drawing view. They do not control
the visibility of the drawing view itself. The API does not provide the
ability to hide the entire view (this functionality doesn't currently exist
in the product either).

A possible workaround, if you are on R11, is to get all the drawing curves
in the view and turn their visibility off. You would also need to turn off
the visibility of drawing dimensions and weld symbols. There aren't formal
APIs to hide dimensions and symbols, but you may be able to workaround that
by driving the UI command via the API.

Sanjay-

wrote in message news:5330543@discussion.autodesk.com...
I want to only show a view on my IDW when a Drill&Tap Hole is present and
hide it at other times.

There are 2 named views on this particular drawing sheet:
"View1" , the base view
"TapEndView", the projected view of the shaft end of "View1"

Why does this code set not work? I assume that I'm setting the Object wrong
for the Get/SetVisibility.

Dim oDrawingView As DrawingView

Select Case oUOM.GetValueFromExpression oTableParams.Item("Style").Value,
kUnitlessUnits)
Case 1
'Debug.Print "Turn on IDW Sheet 1"
oSheet(1).Activate
If oUOM.ConvertUnits(oTableParams.Item("tapholediameter").Value,
kDatabaseLengthUnits, kInchLengthUnits) > 0 Then
'Set Tap End View as Visible
For i = 1 To oSheet(1).DrawingViews.Count
If oSheet(1).DrawingViews(i).Name = "TapEndView" Then
Set oDrawingView = oSheet(1).DrawingViews(i)
Call
oSheet(1).DrawingViews(i).GetVisibility(oDrawingView)
Call
oSheet(1).DrawingViews(i).SetVisibility(oDrawingView, True)
End If
Next

Thanks,
Brian
0 Likes
Message 3 of 5

Anonymous
Not applicable
Bummer. I guess I'll have to resort to removing the view and adding it back in when I actually need it through the API.

Since my IDW already contains the view I want to make, I will add the existing view data to a new collection containing the parts required for the AddProjectedView function.

Then delete the view when not needed and add it back when needed by using the collection data.

I plan on using this to add the view back:
Public Function AddProjectedView( _
ByVal ParentView (from collection) As DrawingView, _
ByVal PlacementPoint(from collection) As Point2d, _
ByVal ViewStyle(from collection) As DrawingViewStyleEnum, _
Optional ByVal Scale(from collection) As Variant _
) As DrawingView

Do you see any flaw in my logic or have a better recommendation on how to resolve this?

Thanks,
Brian
0 Likes
Message 4 of 5

Anonymous
Not applicable
Deleting and recreating the view does mean that you'll lose any annotations
(dimensions, centermarks, feature control frames, etc.) attached to the
view. If this is acceptable to you, it seems like you should be able to use
this approach for now. If this is not acceptable, you'll need to look into
hiding drawing edges, dimensions, etc. as I mentioned before.

Sanjay-


wrote in message news:5332467@discussion.autodesk.com...
Bummer. I guess I'll have to resort to removing the view and adding it back
in when I actually need it through the API.

Since my IDW already contains the view I want to make, I will add the
existing view data to a new collection containing the parts required for the
AddProjectedView function.

Then delete the view when not needed and add it back when needed by using
the collection data.

I plan on using this to add the view back:
Public Function AddProjectedView( _
ByVal ParentView (from collection) As DrawingView, _
ByVal PlacementPoint(from collection) As Point2d, _
ByVal ViewStyle(from collection) As DrawingViewStyleEnum, _
Optional ByVal Scale(from collection) As Variant _
) As DrawingView

Do you see any flaw in my logic or have a better recommendation on how to
resolve this?

Thanks,
Brian
0 Likes
Message 5 of 5

Anonymous
Not applicable
One other option might be to just move the view off of the sheet. It will
be ignored for most purposes and can just be moved back if you need it
again.
--
Brian Ekins
Autodesk Inventor API

"Sanjay Ramaswamy (Autodesk)" wrote in
message news:5336298@discussion.autodesk.com...
Deleting and recreating the view does mean that you'll lose any annotations
(dimensions, centermarks, feature control frames, etc.) attached to the
view. If this is acceptable to you, it seems like you should be able to use
this approach for now. If this is not acceptable, you'll need to look into
hiding drawing edges, dimensions, etc. as I mentioned before.

Sanjay-


wrote in message news:5332467@discussion.autodesk.com...
Bummer. I guess I'll have to resort to removing the view and adding it back
in when I actually need it through the API.

Since my IDW already contains the view I want to make, I will add the
existing view data to a new collection containing the parts required for the
AddProjectedView function.

Then delete the view when not needed and add it back when needed by using
the collection data.

I plan on using this to add the view back:
Public Function AddProjectedView( _
ByVal ParentView (from collection) As DrawingView, _
ByVal PlacementPoint(from collection) As Point2d, _
ByVal ViewStyle(from collection) As DrawingViewStyleEnum, _
Optional ByVal Scale(from collection) As Variant _
) As DrawingView

Do you see any flaw in my logic or have a better recommendation on how to
resolve this?

Thanks,
Brian
0 Likes