Changing DisplaySettings for ComponentOccurence in Assembly - Inventor API

Changing DisplaySettings for ComponentOccurence in Assembly - Inventor API

Anonymous
Not applicable
547 Views
5 Replies
Message 1 of 6

Changing DisplaySettings for ComponentOccurence in Assembly - Inventor API

Anonymous
Not applicable

I am trying to set the DisplaySettings for a part in an assembly through the API. Right now, I'm getting the selected ComponentOccurence, then from that it's PartDocument, then from that it's DisplaySettings. I then try to change the SolidLinesForHiddenEdges Property for that Occurrence but nothing changes. Do I have to do a refresh of the part or assembly for the changes to take effect? I've tried making the document is driving the display settings and not the application, but that didn't work.

 

Any suggestions would help, thanks.

0 Likes
548 Views
5 Replies
Replies (5)
Message 2 of 6

Mark.Lancaster
Consultant
Consultant

@Anonymous

 

Welcome to the Autodesk User's Community..

 

Programming needs and questions about programming for Inventor should be asked in the Inventor Customization forum for best results.  I will ask the moderator to relocate your posting there.

 

https://forums.autodesk.com/t5/inventor-customization/bd-p/120

Mark Lancaster


  &  Autodesk Services MarketPlace Provider


Autodesk Inventor Certified Professional & not an Autodesk Employee


Likes is much appreciated if the information I have shared is helpful to you and/or others


Did this resolve your issue? Please accept it "As a Solution" so others may benefit from it.

0 Likes
Message 3 of 6

Anonymous
Not applicable

Thanks, I was looking for an API/Programming forum and didn't see one. 

0 Likes
Message 4 of 6

tdant
Collaborator
Collaborator

Can you post your code? It's a little difficult to diagnose without seeing it. Also, what environment are you working in? VBA, C#, iLogic?

0 Likes
Message 5 of 6

Anonymous
Not applicable

Hello tdant, 

 

I'm working in VB.net.

Dim doc As AssemblyDocument = m_inventorApplication.ActiveDocument
Dim selection As SelectSet = doc.SelectSet
For Each selected As Object In selection
	Try
		Dim selectedPart As ComponentOccurrence = CType(selected, ComponentOccurrence)
		Dim partDef As PartComponentDefinition = selectedPart.Definition
		Dim partDoc As PartDocument = partDef.Document
		Dim settings As DisplaySettings = partDoc.DisplaySettings

		settings.SolidLinesForHiddenEdges = True
		settings.DisplaySilhouettes = False

	Catch ex As Exception
		MsgBox(ex.Message)
	End Try
Next
0 Likes
Message 6 of 6

BrianEkins
Mentor
Mentor

I don't believe Inventor supports what you're trying to do.  I think the display setting that's set for the top-level assembly is used to display everything in the assembly.  If you change the display setting for the assembly to wireframe, everything will display as wireframe.  The display setting defined within any part is ignored.

---------------------------------------------------------------
Brian Ekins
Inventor and Fusion 360 API Expert
Website/Blog: https://EkinsSolutions.com