Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Cant get the proprieties on a detail view when passed to a sub

1 REPLY 1
Reply
Message 1 of 2
davidt162003
113 Views, 1 Reply

Cant get the proprieties on a detail view when passed to a sub

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 

davidt162003_0-1709739013246.png

these are the properties before i pass the object 

davidt162003_1-1709739102167.png

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 

HII
Labels (3)
1 REPLY 1
Message 2 of 2
davidt162003
in reply to: davidt162003

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 

 

HII

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Technology Administrators


Autodesk Design & Make Report