Change first view order

Change first view order

coreyparks
Advisor Advisor
2,128 Views
13 Replies
Message 1 of 14

Change first view order

coreyparks
Advisor
Advisor

Is there any way to modify the order of the views that have been placed on the drawing sheet?  We have a lot of times where we place an assembly view to drive the title block and then place the child components for detailing.  Too many time the assembly view gets forgotten until you are done detailing the other parts, now instead of the assembly name showing on that sheet it is the first part you inserted.  I would like to be able to select a view and tell Inventor that I would like this view to be the first view instead so I don't have to copy and past everything from one sheet to another.  I used to have some code that looked at that first view but I can't find it anymore, so I have nowhere to start from.  Any help would be geatly appreciated, thanks.

Please mark this response "Accept as solution" if it answers your question.
-------------------------------------------------------------------------------------
Corey Parks
2,129 Views
13 Replies
Replies (13)
Message 2 of 14

TONELLAL
Collaborator
Collaborator

Your code can choose by default the first created view, but you can add the possibilty to clic in the view you want to use.

0 Likes
Message 3 of 14

Anonymous
Not applicable
Was there an answer to this question? I am struggling with the same issue; I don't even know about a code to do this.
Message 4 of 14

MechMachineMan
Advisor
Advisor

I don't think it's likely.

 

The easiest is probably to write code to move the views and then move them back in the order you want.

 

Or use code to fetch the information from whatever view you want.


--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.

Justin K
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization


iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread

Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects

Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help

Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type
0 Likes
Message 5 of 14

coreyparks
Advisor
Advisor

     I have investigated several options and none of them worked.  I could get them to make the view I wanted to be first on the sheet but in doing so it would destroy the integrity of the detail by breaking all of the view alignment and changing all of the scetion view letter sequences.  In the end it comes down to, make sure you place the correct view first.  If you don't, start a new sheet and place the first view then copy all of the other views at one time to the sheet as needed.  Then go copy all text and BOM's and anything else required.  I hate doing it this way but no other automated option worked properly or safely.

Please mark this response "Accept as solution" if it answers your question.
-------------------------------------------------------------------------------------
Corey Parks
Message 6 of 14

TONELLAL
Collaborator
Collaborator

The best I found is create a VBA form like the title block, so you can have a button to select the view :

 

VBA form.png

 

See joined file for the class to use the Selectview button (rename the file with *.cls extension to import it in VBA)

 

 

0 Likes
Message 7 of 14

inventor4578
Advocate
Advocate
How to use this ? I imported the .cls but after how to call it ? Thank you very much
0 Likes
Message 8 of 14

TONELLAL
Collaborator
Collaborator

In a class module named Class1, insert : 



'Permet de sélectionner une vue à l'écran en la cliquant

Option Explicit


Private WithEvents oInteractEvents As InteractionEvents

Private WithEvents oSelectEvents As SelectEvents



' Declare a flag that's used to determine when selection stops.
Private bStillSelecting As Boolean


Public Function Pick(filter As SelectionFilterEnum) As Object
    ' Initialize flag.
    bStillSelecting = True

    ' Create an InteractionEvents object.
    Set oInteractEvents = ThisApplication.CommandManager.CreateInteractionEvents

    ' Ensure interaction is enabled.
    oInteractEvents.InteractionDisabled = False

    ' Set a reference to the select events.
    Set oSelectEvents = oInteractEvents.SelectEvents

    ' Set the filter using the value passed in.
    oSelectEvents.AddSelectionFilter filter

    ' Start the InteractionEvents object.
    oInteractEvents.Start

    ' Loop until a selection is made.
    Do While bStillSelecting
        ThisApplication.UserInterfaceManager.DoEvents
    Loop

    ' Get the selected item. If more than one thing was selected,
    ' just get the first item and ignore the rest.
    Dim oSelectedEnts As ObjectsEnumerator
    Set oSelectedEnts = oSelectEvents.SelectedEntities
    If oSelectedEnts.Count > 0 Then
        Set Pick = oSelectedEnts.Item(1)
    Else
        Set Pick = Nothing
    End If

    ' Stop the InteractionEvents object.
    oInteractEvents.Stop

    ' Clean up.
    Set oSelectEvents = Nothing
    Set oInteractEvents = Nothing
End Function

Private Sub oInteractEvents_OnTerminate()
    ' Set the flag to indicate we're done.
    bStillSelecting = False
End Sub

Private Sub oSelectEvents_OnSelect(ByVal JustSelectedEntities As ObjectsEnumerator, ByVal SelectionDevice As SelectionDeviceEnum, ByVal ModelPosition As Point, ByVal ViewPosition As Point2d, ByVal View As View)
    ' Set the flag to indicate we're done.
    bStillSelecting = False
End Sub

 

In a standard module, insert :

Sub SelectView()

Dim clsSelectView As Class1
Dim oSelectedView As DrawingView

Set clsSelectView = New Class1

Set oSelectedView = clsSelectView.Pick(kDrawingViewFilter)

MsgBox ("Selected view =  " & oSelectedView.Name)

End Sub

 

Run SelectView, then switch on a drawing and click in a view : the name of the view is displayed.

 

This is just a way to get any drawing view property, just by selecting it.

For example, if you want to select the view whose scale is to be displayed in the title block, you can run this code to get the view scale, write it in a custom property, and use this custom property in the title block.

 

Hope this helps !

0 Likes
Message 9 of 14

dwilmerN5339
Explorer
Explorer

I found you can copy the view you want to move in the task tree then immediately paste. This will create a copy of the view in the exact same location but at the bottom of the tree for that drawing sheet. You can then delete the original view. It's tedious but if you want to shift the tree around to get a certain view to be at the top of the tree for the title block to read its much quicker to copy and paste all other views and delete the originals to shift the desired view to the top than to have to redo the drawing or make a script.

0 Likes
Message 10 of 14

WCrihfield
Mentor
Mentor

Hi @dwilmerN5339.  I don't know if you are aware of these relatively new Inventor API code resources that became available in the 2023 release of Inventor or even if they may be helpful or not, but they seem like something that may help to solve some issues here.

The Sheet object now has a Read/Write String type property (Sheet.TextPropertySource), which we can set the value of to the name of an already existing base view on that sheet, so that it will look to that base view for the source of some 'linked' property data being shown on that sheet.

Then the DrawingView object also has a similar Read/Write Boolean type property (DrawingView.IsTextPropertySource), which we can set to True, but only for base views, to achieve a similar result.  So, even if you placed an ISO view on the sheet first (just as an example), then the base view was placed second, then the projected views last, you can specify the base view as the source for properties on that sheet, instead of the ISO view.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 11 of 14

coreyparks
Advisor
Advisor

Actually, this has been fixed at as of the 2023 version and is built directly into the software now.  If you select the sheet in the browser and right click to edit the sheet, it can now be changed in the dialog box that opens up.  As long as there is a view on the sheet of what you want to drive the title block information.  If I don't want the specific part to show up visually on that sheet, I just insert a view and then suppress it.  You can still slect it as the view to drive the title block text.

 

First view order.png

Please mark this response "Accept as solution" if it answers your question.
-------------------------------------------------------------------------------------
Corey Parks
Message 12 of 14

WCrihfield
Mentor
Mentor

Yep.  I knew about the manual way to do it, but figured folks on the iLogic forum might only be interested in how to do it by code.  It is good that you posted the manual process with visual aids though.  More documentation is usually always better than less.

This ability is honestly not something that I really utilize that much, because probably 99% or more of our drawings are focused on one model file, even if they are multiple sheets long.  Each part has its own separate drawing, and each assembly has its own drawing that just focusses on how everything goes together, assembly level features, overall resulting size & shape expectations, final finish, and so on.  Seeing how everyone else all over the word does things differently from each other juts adds to the fun, and complexity of it all.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 13 of 14

coreyparks
Advisor
Advisor

Yeah, we all have different workflows for sure.  Here we do a fair number of weldment style drawings, and we create one IDW file that has all of the assemblies and individual piece parts, but we want the title block to always show the finished weldment information.  We need to have a view of the overall inserted on each sheet to drive the title block info and, not infrequently, we will forget to insert that view first forcing us to redirect to a different first view.  

Please mark this response "Accept as solution" if it answers your question.
-------------------------------------------------------------------------------------
Corey Parks
0 Likes
Message 14 of 14

WCrihfield
Mentor
Mentor

Interesting.  This made me think of another set-up that may be of interest to you.  You can manually set the template drawing settings to copy iProperties from 'the model' to the drawing when the first view of a model is placed into the drawing.  Then, the 'Linked' stuff in the title block can be pointing to the drawing's own iProperties.  That way every sheet's title blocks are pointing to the same, original information.  And if any properties change on the model side after the drawing exists, we can click the button on the Manage tab, Update panel named "Update Copied Properties", which I believe re-copies those same properties from the model to the drawing.  The settings I am talking about are within the 'Document Settings' (Tools tab > Options panel), on the Drawing tab, when you click on the 'Copy Model iProperty Settings...' button, within that pop-up dialog.  In addition to that very handy button, I also created my own external iLogic rule button that copies all 'custom' iProperties from the model to the drawing, but that rule is designed to get them from just one model.

Setting things up that way may help avoid the need for the ghost view of the assembly on each sheet, followed by setting that one setting about the property source on each sheet.  Just some thoughts.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes