cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Ability to choose which parts are referenced in dwg title block

Ability to choose which parts are referenced in dwg title block

I was working on a drawing of PartA. I brought in view of PartB. The title block automatically fills with model part number upon insertion, and so was filled with PartA's part number.

 

In this occasion I wanted PartB to be referenced, but still wanted PartA in the drawing.

 

I could not see a way to change the referenced model - other than (as was suggested in the forum) moving the views to a new sheet, then importing PartB, moving PartA back......etc. A bit of a laborious task.

 

So I'd like to see an option of choosing the referenced model when multiple models are shown on the drawing.

 

5 Comments
Curtis_Waguespack
Consultant

This would be very nice for us to do as well, we sometimes have a situation where there might be 15+ views, and for one reason or another the title block is looking at a view other than the we need it to be looking at.

 

Currently the options are to copy the views to another sheet manually, ensuring that the view we want is the first view, or re-create the sheet. Both options can be time consuming and error prone. 

 

Here is a similar idea:

https://forums.autodesk.com/t5/inventor-ideas/change-quot-main-view-quot-in-drawings/idi-p/6827444

Curtis_Waguespack
Consultant

Just for clarification, something like this is the option we're looking for:

 

 

Use View For Title Block.PNG

bengee5454
Collaborator

That would work! 🙂

ReneRepina
Collaborator

Hello everybody!

 

I came up with a solution to this problem. I tried to attach the whole iRule as a file here, but there is no option, so I copied whole code down below. I hope you will find it useful!

 

Similiar thread is also on this link (with this solution):
https://forums.autodesk.com/t5/inventor-ideas/change-quot-main-view-quot-in-drawings/idc-p/10173077/...

 

'######################
'iRule "IDW_SetFirstDrawingView" created by Rene Repina
'https://www.linkedin.com/in/renerepina/
'https://forums.autodesk.com/t5/user/viewprofilepage/user-id/5053305
'######################

'### IMPORTANT INFO ###
'Mouse has to be positioned on the drawing, otherwise PASTE does not work and it will cause an error!
'COPY-PASTE functions are used, because commands such as "CopyTo" (and others) break the aligning to the base views.
'All connections (alignings) are preserved.
'Letters of the sections view, details, ... are changed to the next ones of the sequence after the set (due to copy and delete).
'######################

'Run only on drawings
If ThisDoc.Document.DocumentType <> DocumentTypeEnum.kDrawingDocumentObject Then
	MessageBox.Show("Rule works only on drawings!", "Message", MessageBoxButtons.OK, MessageBoxIcon.Warning)
	Exit Sub
End If

'Objects
Dim oDrawDoc As DrawingDocument = ThisApplication.ActiveDocument
Dim oDrawingView As DrawingView
Dim mainSheet As Sheet = oDrawDoc.ActiveSheet
Dim tempSheet As Sheet
Dim firstDrawingView As DrawingView
Dim viewsForDeletion As New List(Of DrawingView)
Dim drawingViewsCountBefore As Integer = mainSheet.DrawingViews.Count
Dim drawingViewsCountAfter As Integer = 0
Dim oThread As System.Threading.Thread = System.Threading.Thread.CurrentThread
Dim oThreadTime As Integer = 100 'ms 'Needed to prevent errors (time for commands to process)

'Check if user selected a drawing view
Try
	firstDrawingView = oDrawDoc.SelectSet(1)
Catch
	MessageBox.Show("Select the main view and run again!", "Message", MessageBoxButtons.OK, MessageBoxIcon.Warning)
	Exit Sub
End Try

'Check if selected drawing view is NOT a parent view (parent view should be selected)
If firstDrawingView.ParentView IsNot Nothing Then
	MessageBox.Show("Selected view is NOT a parent view!" & vbLf & vbLf & "Select a parent view and run again!", "Message", MessageBoxButtons.OK, MessageBoxIcon.Warning)
	Exit Sub
End If

'Only 1 drawing view should be selected
If oDrawDoc.SelectSet.Count <> 1 Then
	MessageBox.Show("Multiple drawing views are selected!" & vbLf & vbLf & "Select only ONE drawing view and run again!", "Message", MessageBoxButtons.OK, MessageBoxIcon.Warning)
	Exit Sub
End If

'Mouse cursor MUST be on the drawing, otherwise it will cause an error due to PASTE function not working outside drawing borders
MessageBox.Show("The mouse cursor MUST be on the drawing, otherwise it will cause an error!", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information)

'Clear select set (to deselect user selected view)
oDrawDoc.SelectSet.Clear()

'Select all views except the main (selected) ones
For Each oDrawingView In mainSheet.DrawingViews

	If oDrawingView IsNot firstDrawingView AndAlso 
		oDrawingView.ParentView IsNot firstDrawingView Then
		
		oDrawDoc.SelectSet.Select(oDrawingView)
		viewsForDeletion.Add(oDrawingView)

	End If

Next

'Undo transaction to reverse changes in case of an error (or user undo command)
Dim undo As Transaction = ThisApplication.TransactionManager.StartTransaction(oDrawDoc, "Set First Drawing View")
'undo.End 'Needed at the end of where you want to end


ThisApplication.CommandManager.ControlDefinitions.Item("AppCopyCmd").Execute() 'Copy views
'oThread.Join(oThreadTime) 'OPTIONAL IF NEEDED

oDrawDoc.Sheets.Add() 'Add temp sheet
tempSheet = oDrawDoc.ActiveSheet 'Save temp sheet for the reference
oThread.Join(oThreadTime) 'Needed to properly switch to the sheet

ThisApplication.CommandManager.ControlDefinitions.Item("AppPasteCmd").Execute() 'Paste view
oThread.Join(oThreadTime) 'Needed to give time to paste

'Delete all views on main sheet except main (selected) views
For Each oDrawingView In viewsForDeletion
	
	'Try-Catch is needed in case depended views get deleted before for loop can delete them
	Try
		oDrawingView.Delete()
	Catch
		'View is already deleted, go to the next one
	End try

Next

tempSheet.Activate() 'Activate temporary sheet
oThread.Join(oThreadTime) 'Needed to properly switch to the sheet

'Select all views on temporary sheet
For Each oDrawingView In tempSheet.DrawingViews

	oDrawDoc.SelectSet.Select(oDrawingView)

Next

ThisApplication.CommandManager.ControlDefinitions.Item("AppCopyCmd").Execute() 'Copy views
'oThread.Join(oThreadTime) 'OPTIONAL IF NEEDED

mainSheet.Activate() 'Go to main sheet
oThread.Join(oThreadTime) 'Needed to properly switch  to the sheet

ThisApplication.CommandManager.ControlDefinitions.Item("AppPasteCmd").Execute() 'Paste views
oThread.Join(oThreadTime) 'Needed to give time to paste

tempSheet.Delete(False) 'Delete temporary sheet
'oThread.Join(oThreadTime) 'OPTIONAL IF NEEDED

'Get the final count number of the views to compare it to start count number of the views
drawingViewsCountAfter = mainSheet.DrawingViews.Count


undo.End 'End undo transaction


If drawingViewsCountBefore <> drawingViewsCountAfter Then
	MessageBox.Show("Something went wrong!" & vbLf & "Number of views before the set is not the same to the number of views after!" & vbLf & vbLf & 
		"State will be reversed. Try again!" & vbLf & "(Mouse cursor MUST be on the drawing!)", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
	
	'Undo the current transaction (to reverse changes)
	ThisApplication.TransactionManager.UndoTransaction()
	
	Exit Sub
	
End If

 

Example run:

ReneRepina_0-1616281424770.png

ReneRepina_1-1616281429251.png

 

Yijiang.Cai
Autodesk
Status changed to: Implemented

This idea has been implemented within Autodesk Inventor 2023. Please review the Inventor 2023 What's New article here. For more information regarding how you may leverage the feature, please review this page. Special thanks to everyone who cast a vote for it.

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

Submit Idea