Community
Inventor Forum
Welcome to Autodesk’s Inventor Forums. Share your knowledge, ask questions, and explore popular Inventor topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Inventor - Component View Item Numbers – Methods and Suggestions

33 REPLIES 33
SOLVED
Reply
Message 1 of 34
Scotty87
8252 Views, 33 Replies

Inventor - Component View Item Numbers – Methods and Suggestions

Hi all,

After a bit of thought I’ve decided to do a write up on issues with item numbers in Inventor drawings. My reasons for this are that I want to know if there any ways to do what I want to do that I haven’t discovered, describe some current methods that some of you might find useful, and get support and/or criticism for a new feature that I am going to present.

 

As a draftsman with 4 years + experience with Inventor, I have come to know the program fairly well and regard it highly.

 

There is however one major flaw with the drawing environment: The inability (there are workarounds, which I will get to shortly) to attach an item number to component detail views that reference the BOM of their parent assembly.

This may seem trivial, but is a subject that keeps coming up, not just from Inventor users but also from other design office personnel, allocation staff and manufacturing workers.

 

I won’t rule out the possibility that this feature exists (if it does, please enlighten me!), but I would like to know why such an important feature has been omitted. Legal/copyright reasons? Marketing reasons? It’s not possible to program it that way? Not seen as important? In development?

 

Whatever the case, I will now discuss 3 workaround methods, followed by my own suggestion as to how I believe this feature could/should be included.

 

Method 1: iProperties Item Reference

Using this method, the item column and item bubbles reference an iProperty (such as Part Number or Stock Number) rather than the Item Number found in the BOM. A base view of an assembly is placed on a drawing, followed by base views of its parts. A parts list referencing the assembly is then created, and item balloons are attached to all parts on the assembly view and all component base views.

Advantages of this method include:

  • Ability to attach item balloons to each component base view.
  • Ability to include the item number in component view labels.

Disadvantages include:

  • Item numbers must be entered manually.
  • Item number is an iProperty; if a component is being used in multiple drawings, it retains its original item number. If the item number is changed to suit a new drawing’s BOM, the original drawing’s BOM will also update.
  • Does not allow for automatic renumbering in the parts list editor.

Method 2: Component View Representations

In the assembly, a new view representation is created for each component, in which visibility for every other component is switched off. A base view of the assembly is placed on a drawing with the relevant view representation selected for each part detail.

Advantages:

  • Allows ballooning of component views using BOM Item Number.
  • Quantity can be added to balloons and view labels.

Disadvantages:

  • Creation of view representations is time consuming.
  • A new view representation must be created for each new component.
  • Visibility of newly placed components must be manually deselected.
  • iProperties in view label reference parent assembly
  • Inability to detail flat pattern views.

Method 3: Weldment Detail

This method is similar to the view representation method, however the views are created automatically. It has the disadvantage that a weldment must be created for it to be of any use; as such it has no use for fastened assemblies that require component details.

 

These 3 methods all have their pros and cons, and really only appear to be workarounds for the problem at hand.

 

Now to my suggestion:

 

COMPONENT VIEWS

 

First, a standard base view of an assembly is placed on the drawing.

In the drawing environment, on the views panel of the drawing tab, there will be a button titled “Component Views”.

Pressing this button will bring up a prompt that says “select source view”.

The user then clicks on the base view on the assembly, and a dialogue box appears.

The box has a list of the assembly’s components, each next to a check box. The user then checks the required components, or checks “select all”.

The user then places each component view 1 by 1, selecting orientation as they go.

Item balloons can now be added to the component views; the number reflects the item number in the parts list of the parent view.

BOM data can also be added to the view label via “BOM Properties” in the drop down menu, and “Component Properties” references the iProperties of the component; Model Properties still allows the parent assembly to be referenced.

The component view can be turned into a standard base view by right clicking it and selecting “convert to base view”. I would also endorse the possibility of converting base views to component views.

 

I’m no expert on the programming side of things, but I don’t see why this isn’t possible; all the information is there, it seems like it’s a matter of getting it all in the one place.

 

Please let me know what you think about the component views idea. Preferably quote one of the following points

  • Great idea! Autodesk, take note.
  • Sounds good, but needs more thought.
  • Not that important, but it can’t hurt to have it.
  • Some good points, but lots of flaws; I am happy without it.
  • No good, completely unnecessary / totally flawed.

 

Thanks for reading, constructive criticism is greatly appreciated.

33 REPLIES 33
Message 21 of 34

Curtis,

 

I much enjoy and appreciate the rule you wrote to auto create view reps.

 

I do have one comment though.

 

Problem: After running the rule on the assembly and starting a drawing we need to add another part to the assembly. This issue is this new

part is now visible in each preious view rep. The work around is to make the unwanted part not visible. Is there a way this could be added to the rule?

 

This is the rule i am refering to : 

 

'create a design view representation for each unique part in the assembly 

'define current document
Dim openDoc As Document
openDoc = ThisDoc.Document

'set a reference to the assembly component definintion.
'this assumes an assembly document is open.
Dim oAsmCompDef As AssemblyComponentDefinition
oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition

'look at all of the components in the assembly
Dim oCompDef As Inventor.ComponentDefinition = openDoc.ComponentDefinition

'define the first level components collection
Dim oCompOcc As Inventor.ComponentOccurrence 

'define view rep 
Dim oViewRep As DesignViewRepresentation

'define an arraylist to hold the list of  view rep names
Dim NameList As New ArrayList()

'Look at the view reps in the assembly
For Each oViewRep In oAsmCompDef.RepresentationsManager.DesignViewRepresentations
'set the list of names to the array list
NameList.add(oViewRep.Name)
Next

'check for a Default view rep and create it if not found
If Not NameList.Contains("Default") Then
	'create Default view rep 
	oViewRep = oAsmCompDef.RepresentationsManager.DesignViewRepresentations.Add("Default") 
	oViewRep.ShowAll
	oViewRep.Activate
End If

'zoom all
ThisApplication.CommandManager.ControlDefinitions.Item("AppIsometricViewCmd").Execute

'look at all of the unique parts in the assembly
For Each docFile In openDoc.AllReferencedDocuments
	If docFile.DocumentType = 12290 Then '12290 is the part document enumurator
	'locate the last backslash position in the full file name
	Dim FNamePos As Long
	FNamePos = InStrRev(docFile.FullFileName, "\", -1) 
	'remove path from part file name 	
	Dim docFName As String
	docFName = Right(docFile.FullFileName, Len(docFile.FullFileName) - FNamePos)         
	'remove extension from part file name 
	ShortName = Left(docFName,  Len(docFName) - 4)   
		'check to see if the arraylist contains the desired view rep
		If Not NameList.Contains(ShortName) Then
		'create new View Rep 
		oViewRep = oAsmCompDef.RepresentationsManager.DesignViewRepresentations.Add(ShortName)
		oViewRep.Activate
		oViewRep.Locked = False	
		Else If NameList.Contains(ShortName) Then
		'reference existing View Rep 
		oViewRep = oAsmCompDef.RepresentationsManager.DesignViewRepresentations.Item(ShortName) 
		oViewRep.Activate
		oViewRep.Locked = False
		End If
		'look at all of the occurences
		For Each oCompOcc in oCompDef.Occurrences
		'locate the colon position in the occurence name
		oCompOccPos = InStrRev(oCompOcc.Name, ":") 
		'set occurence name to everything left of the colon
		oOccName = Left(oCompOcc.Name, oCompOccPos -1) 
			'set visible if name matches first occurence
	      	If oCompOcc.Name = ShortName & ":1"  Then
			oCompOcc.Visible = True
			ThisApplication.ActiveView.Update()
			Else
			oCompOcc.Visible = False
			ThisApplication.ActiveView.Update()
			End If
		Next
	End If
	'lock view rep
	oViewRep.Locked = True	
Next

'set Default View Rep active
oAsmCompDef.RepresentationsManager.DesignViewRepresentations.Item("Default").activate




thanks a lot

Rick Laney
Message 22 of 34
aldolingsma
in reply to: kenmorecars

The code will work if you have checked the associative checkbox when creating a view.

Message 23 of 34
Message 24 of 34

 

 

Hi @petr.foltan,

 

see this version.

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

 

'create a design view representation for each unique part in the assembly 

'define current document
Dim openDoc As Document
openDoc = ThisDoc.Document

'set a reference to the assembly component definintion.
'this assumes an assembly document is open.
Dim oAsmCompDef As AssemblyComponentDefinition
oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition

'look at all of the components in the assembly
Dim oCompDef As Inventor.ComponentDefinition = openDoc.ComponentDefinition

'define the first level components collection
Dim oCompOcc As Inventor.ComponentOccurrence

'define view rep 
Dim oViewRep As DesignViewRepresentation

'define an arraylist to hold the list of  view rep names
Dim NameList As New ArrayList()

'Look at the view reps in the assembly
For Each oViewRep In oAsmCompDef.RepresentationsManager.DesignViewRepresentations
	'set the list of names to the array list
	NameList.Add(oViewRep.Name)
Next

'check for a Default view rep and create it if not found
If Not NameList.Contains("Default") Then
	'create Default view rep 
	oViewRep = oAsmCompDef.RepresentationsManager.DesignViewRepresentations.Add("Default")
	oViewRep.ShowAll
	oViewRep.Activate
End If

'zoom all
ThisApplication.CommandManager.ControlDefinitions.Item("AppIsometricViewCmd").Execute

'look at all of the unique parts in the assembly
For Each docFile In openDoc.AllReferencedDocuments
	If docFile.DocumentType = 12290 Then '12290 is the part document enumurator
		'locate the last backslash position in the full file name
		Dim FNamePos As Long
		FNamePos = InStrRev(docFile.FullFileName, "\", -1)
		'remove path from part file name 	
		Dim docFName As String
		docFName = Right(docFile.FullFileName, Len(docFile.FullFileName) -FNamePos)
		'remove extension from part file name 
		ShortName = Left(docFName, Len(docFName) -4)
		
		'check to see if the arraylist contains the desired view rep
		If Not NameList.Contains(ShortName) Then
			'create new View Rep 
			oViewRep = oAsmCompDef.RepresentationsManager.DesignViewRepresentations.Add(ShortName)
			oViewRep.Activate
			oViewRep.Locked = False
		ElseIf NameList.Contains(ShortName) Then
			'reference existing View Rep 
			oViewRep = oAsmCompDef.RepresentationsManager.DesignViewRepresentations.Item(ShortName)
			oViewRep.Activate
			oViewRep.Locked = False
		End If
		
		'look at all of the occurences
		For Each oCompOcc In oCompDef.Occurrences.AllLeafOccurrences
			'locate the colon position in the occurence name
			oCompOccPos = InStrRev(oCompOcc.Name, ":")
			'set occurence name to everything left of the colon
			oOccName = Left(oCompOcc.Name, oCompOccPos - 1)
			
			'set visible if name matches first occurence
			If oCompOcc.Name = ShortName & ":1" Then
				oCompOcc.Visible = True
				ThisApplication.ActiveView.Update()
			Else
				oCompOcc.Visible = False
				ThisApplication.ActiveView.Update()
			End If
		Next
	End If
	'lock view rep
	oViewRep.Locked = True
Next

'set Default View Rep active
oAsmCompDef.RepresentationsManager.DesignViewRepresentations.Item("Default").activate

 

Message 25 of 34

Thank you from all of us.

 

What exactly does the "all leaf occurrences" do/change?

 

(Is that what's new? I copied and pasted side by side in notepad and could not see anything other than some indentation but then in the actual forum I saw the red.)

 

It's late in the day and I'm actually supposed to be somewhere else right now so I can't even figure out exactly which post you are responding to.

(Someone said something about the associative checkbox, I have a thread somewhere where I worked with an autodesk rep to try to deal with that and they came to the conclusion that that was no accessible through the API.)

[Sorry, I'll try to be more polite tomorrow, but I don't have time at this particular moment]

Message 26 of 34
johnsonshiue
in reply to: dan_inv09

Hi Dan,

 

Here is the Help page on the property, ComponentOccurrences.AllLeafOccurrences.

 

https://help.autodesk.com/view/INVNTOR/2023/ENU/?guid=GUID-86E425C0-69CD-4004-A6F6-ECB2878B499F

 

Many thanks!

 



Johnson Shiue (johnson.shiue@autodesk.com)
Software Test Engineer
Message 27 of 34

Hello @Curtis_Waguespack
works great, thank you really much!

 

One more question, do you know how to filter out parts with BOMStructure = reference (51970)?

 

best regards
Petr Foltán

Message 28 of 34


@dan_inv09 wrote:

Thank you from all of us.

 

What exactly does the "all leaf occurrences" do/change?

 

(Is that what's new? I copied and pasted side by side in notepad and could not see anything other than some indentation but then in the actual forum I saw the red.)

 

It's late in the day and I'm actually supposed to be somewhere else right now so I can't even figure out exactly which post you are responding to.

(Someone said something about the associative checkbox, I have a thread somewhere where I worked with an autodesk rep to try to deal with that and they came to the conclusion that that was no accessible through the API.)

[Sorry, I'll try to be more polite tomorrow, but I don't have time at this particular moment]


Hi @dan_inv09,

 

 

If we think of an assembly as a tree, the top level assembly is the trunk, and the sub assemblies are the branches, and each part ( whether in the top level assembly or a sub assembly ) is a leaf.

 

see this link for a more detailed explanation:

https://modthemachine.typepad.com/my_weblog/2009/03/accessing-assembly-components.html

 

Also, I wasn't replying to anyone in the thread, but rather I was posting to this thread to assist petr.foltan who had inquired elsewhere about the iLogic example posted here in the past.

 

As for the Associative Checkbox, I think what you stated is correct. From memory, we can set the associative checkbox for representations for a drawing view, but not at the assembly level. I was thinking it was exposed in the API, but just doesn't work properly??? but it's been a while since I've looked at that so, I could be mistaken.

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

 

 

Message 29 of 34

Hi @petr.foltan 

 

It would be something along these lines. I'm short on time at the moment, but post back if this isn't enough to get you what you're needing.

 

If oCompOcc.BOMStructure = BOMStructureEnum.kReferenceBOMStructure then....

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

Message 30 of 34

Thanks for reply @Curtis_Waguespack

I tried it, but without success.

I do not know where to put it right, it did nothing or I get "Object reference not set to an instance of an object"

 

Petr

Message 31 of 34

Hi @petr.foltan 

 

See this version , note red text.

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

 

'create a design view representation for each unique part in the assembly 

'define current document
Dim openDoc As Document
openDoc = ThisDoc.Document

'set a reference to the assembly component definintion.
'this assumes an assembly document is open.
Dim oAsmCompDef As AssemblyComponentDefinition
oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition

'look at all of the components in the assembly
Dim oCompDef As Inventor.ComponentDefinition = openDoc.ComponentDefinition

'define the first level components collection
Dim oCompOcc As Inventor.ComponentOccurrence

'define view rep 
Dim oViewRep As DesignViewRepresentation

'define an arraylist to hold the list of  view rep names
Dim NameList As New ArrayList()

'Look at the view reps in the assembly
For Each oViewRep In oAsmCompDef.RepresentationsManager.DesignViewRepresentations
	'set the list of names to the array list
	NameList.Add(oViewRep.Name)
Next

'check for a Default view rep and create it if not found
If Not NameList.Contains("Default") Then
	'create Default view rep 
	oViewRep = oAsmCompDef.RepresentationsManager.DesignViewRepresentations.Add("Default")
	oViewRep.ShowAll
	oViewRep.Activate
End If

'zoom all
ThisApplication.CommandManager.ControlDefinitions.Item("AppIsometricViewCmd").Execute

'look at all of the unique parts in the assembly
For Each docFile In openDoc.AllReferencedDocuments
	If docFile.DocumentType = DocumentTypeEnum.kPartDocumentObject Then
		docFName = IO.Path.GetFileNameWithoutExtension(docFile.FullFileName)

		'check to see if the arraylist contains the desired view rep
		If Not NameList.Contains(docFName) Then
			'create new View Rep 
			oViewRep = oAsmCompDef.RepresentationsManager.DesignViewRepresentations.Add(docFName)
		ElseIf NameList.Contains(docFName) Then
			'reference existing View Rep 
			oViewRep = oAsmCompDef.RepresentationsManager.DesignViewRepresentations.Item(docFName)
		End If

		oViewRep.Activate
		oViewRep.Locked = False

		'look at all of the occurences
		For Each oCompOcc In oCompDef.Occurrences.AllLeafOccurrences

			If oCompOcc.BOMStructure = BOMStructureEnum.kReferenceBOMStructure Then Continue For

			'locate the colon position in the occurence name
			oCompOccPos = InStrRev(oCompOcc.Name, ":")
			'set occurence name to everything left of the colon
			oOccName = Left(oCompOcc.Name, oCompOccPos - 1)

			'set visible if name matches first occurence
			If oCompOcc.Name = ShortName & ":1" Then
				oCompOcc.Visible = True
				ThisApplication.ActiveView.Update()
			Else
				oCompOcc.Visible = False
				ThisApplication.ActiveView.Update()
			End If
		Next
	End If
	'lock view rep
	oViewRep.Locked = True
Next

'set Default View Rep active
oAsmCompDef.RepresentationsManager.DesignViewRepresentations.Item("Default").activate

 

Message 32 of 34

Thanks for reply @Curtis_Waguespack

It works but not as I want.

I do not want even to create a view representation for this parts with reference BOM structure reference.

 

Petr

Message 33 of 34

Hello @Curtis_Waguespack,
I have a problem with "oCompDef.Occurrences.AllLeafOccurrences". It tooks parts from all sub assemblies, but when main assembly contains any Frame made by frame generator, it allways ends with this error:
Error in rule: CreateViewRepresentations, in document: assembly.iam
Argument Length must be greater than or equal to zero.
How to solve it?

Message 34 of 34
SER4
in reply to: petr.foltan

Yeah I had an error in line 67, and I think it's because I had manually renamed the component in the Assembly Model tree; so I added back in the ":1".

So now it creates view reps for all (albeit in backwards alphabetical order), but the each view is empty (all hidden parts)--guess I gotta manually unhide for now.

Dell Precision 5680 Laptop; Win11 Pro; 64GB RAM; i9-13900H CPU; Intel Iris Xe Graphics, NVIDIA RTX 3500 Ada Laptop GPU.
Vault Pro 2023.4.1 (28.4.20.0); Inventor Pro 2023.4.1 (418).

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

Post to forums  

Autodesk Design & Make Report