As the title says for some reason when i pass a detail drawing view object to a sub i can no longer access its properties. the odd part is this only seem to occur when first creating the view. if i go back and retireve an already existing view its able to get the properties correctly
these are the properties before i pass the object
and these are the properties in the sub i pass it too. At first i though it may have been converting it from a DetailDrawingView to just a drawing view but that didn't seem to make a difference.
could it be because just before i pass the view i switch it to a different sheet
I was correct in thinking that it was because it was moved to another sheet.
so i tried to create my own sub to move the view to another sheet
Friend Sub MoveViewToSheet(View As DrawingView, NewSheet As Sheet) 'required because just using the inventor move to sub destroys the object
Dim ViewName As String = View.Name
If View.Parent.Name = NewSheet.Name Then Exit Sub
View.MoveTo(NewSheet)
For Each pSheetView As DrawingView In NewSheet.DrawingViews
If pSheetView.Name = ViewName Then View = pSheetView
Next
End Sub
but for some reason this did the thing but then when passed again couldnt get the objects properties.
So this is the solution im currently using
Friend Sub Rescaler(ViewName As String, DrawDoc As DrawingDocument, Xwant As Double, Ywant As Double)
' function to rescale the size of a drawing view within a box of specified size
Dim ViewUsed As DrawingView
For Each pSheet As Sheet In DrawDoc.Sheets
For Each pView As DrawingView In pSheet.DrawingViews
If pView.Name = ViewName Then
ViewUsed = pView
Exit For
End If
If ViewUsed IsNot Nothing Then Exit For
Next
Next
I pass the required sub the view name and the drawing document and then find it with in the same sub i need those properties and need to do work on it( changing the scale) so im not entirely sure why the first sub dosent work i at least have a partial solution now
Can't find what you're looking for? Ask the community or share your knowledge.