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: 

DrawingView.MoveTo Method

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
jdkriek
412 Views, 3 Replies

DrawingView.MoveTo Method

What is the proper way to use this method? Not having any luck.

 

Also tried using oDoc.Sheets.Item(2) for Target Sheet.

 

Public Sub MoveViews()
    Dim oApp As Application
    Set oApp = ThisApplication
    Dim oDoc As DrawingDocument
    Set oDoc = oApp.ActiveDocument
    
    Dim oSheet As Sheet
    Set oSheet = oDoc.ActiveSheet
    
    ' Check to make sure a view was selected.
    If Not TypeOf oDoc.SelectSet.Item(1) Is DrawingView Then
        MsgBox "A drawing view must be selected."
        Exit Sub
    End If
    
    Dim oDrawingView As DrawingView
    Set oDrawingView = oDoc.SelectSet.Item(1)
    
    ' Test to see if we have the view
    oDrawingView.ShowLabel = True
    
    ' Move view to target sheet
    oDrawingView.MoveTo ("Sheet:2")
End Sub
Jonathan D. Kriek
MFG Solutions Engineer
KETIV Technologies, Inc.


3 REPLIES 3
Message 2 of 4
YuhanZhang
in reply to: jdkriek

Can you double check that the active sheet is Sheet:2 or not? You could not move a drawing view to the same sheet it is located in.



If this solves the problem please click ACCEPT SOLUTION so other people can find it easily.



Rocky Zhang
Inventor API PD
Manufacturing Solutions
Autodesk, Inc.

Message 3 of 4
jdkriek
in reply to: YuhanZhang

Rocky,

 

Yes Sheet:1 is active and I cannot move it to Sheet:2

 

Also the view is stand-alone, not a section or view with parent.

 

Tested in 2011, 2012, and 2013

Jonathan D. Kriek
MFG Solutions Engineer
KETIV Technologies, Inc.


Message 4 of 4
YuhanZhang
in reply to: jdkriek

Seems there is a code error, please use below updated code:

 

Public Sub MoveViews()
    Dim oApp As Application
    Set oApp = ThisApplication
    Dim oDoc As DrawingDocument
    Set oDoc = oApp.ActiveDocument
    
    Dim oSheet As Sheet
    Set oSheet = oDoc.ActiveSheet
    
    ' Check to make sure a view was selected.
    If Not TypeOf oDoc.SelectSet.Item(1) Is DrawingView Then
        MsgBox "A drawing view must be selected."
        Exit Sub
    End If
    
    Dim oDrawingView As DrawingView
    Set oDrawingView = oDoc.SelectSet.Item(1)
    
    ' Test to see if we have the view
    oDrawingView.ShowLabel = True
    
    ' Move view to target sheet
    oDrawingView.MoveTo oDoc.Sheets("Sheet:2")
End Sub

 



If this solves the problem please click ACCEPT SOLUTION so other people can find it easily.



Rocky Zhang
Inventor API PD
Manufacturing Solutions
Autodesk, Inc.

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

Post to forums  

Autodesk Design & Make Report