Automatic exploded view

Automatic exploded view

GeorgK
Advisor Advisor
4,280 Views
12 Replies
Message 1 of 13

Automatic exploded view

GeorgK
Advisor
Advisor

Hello together,

 

is it possible to create an exploded view of an assmbly like in the good old days with VB.Net or iLogic?

 

https://knowledge.autodesk.com/support/inventor-products/learn-explore/caas/simplecontent/content/in...

 

Thank you

 

Georg

 

 

0 Likes
4,281 Views
12 Replies
Replies (12)
Message 2 of 13

chandra.shekar.g
Autodesk Support
Autodesk Support

Hello @GeorgK,

 

In Inventor API 2018, many objects, properties and events of presentation documents are added. Which are listed in the following link.
http://help.autodesk.com/view/INVNTOR/2018/ENU/?guid=GUID-36B1FFB5-5291-4532-8F11-90E912769B34


Currently, Inventor API still not allowed to add new scene (i.e, placing a assembly document an creating exploded view in presentation document).

 

Inventor API 2014 was supporting for querying exploded view only. Since Inventor 2017, there is a big change in the API related to presentation document. So, the old APIs for Inventor 2014 won't work.

 

Please log this wish list at ide station using below link.

https://forums.autodesk.com/t5/inventor-ideas/idb-p/v1232/tab/most-recent

 

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



0 Likes
Message 3 of 13

GeorgK
Advisor
Advisor

Hello @chandra.shekar.g,

 

do you have some sample code for Inventor 2018?

 

Thank you

 

Georg

0 Likes
Message 4 of 13

chandra.shekar.g
Autodesk Support
Autodesk Support

@GeorgK,

 

 

 

Currently, there is no sample code for presentation document of Inventor 2018. Please let me know the task that you are trying, I will try to create code for it.

 

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



0 Likes
Message 5 of 13

GeorgK
Advisor
Advisor

Hello @chandra.shekar.g,

 

the idea was to get the same result as in the old versions of Inventor. Start the program and each part moves away from it's position. Each part should be seen after the move. There should be a variable to set the distance for the parts.

 

Thank you

 

Georg

0 Likes
Message 6 of 13

AlexFielder
Advisor
Advisor

@GeorgK, I know the function you speak of, it being sorely missed in Inventor since it was removed with the update to the presentation environment.

 

I suppose the "explode" function present in the (online) model viewer would provide the same functionality; perhaps @chandra.shekar.g can find for us the code that does it and share it here? Then (and it would likely be no small task) it could in theory be re-engineered to work with Inventor once again?

0 Likes
Message 7 of 13

AlexFielder
Advisor
Advisor

Thinking about it further, I propose that you could calculate a collection of centre of mass point3D objects and move them apart by a set amount from the geometric centre of the assembly you are working within.

 

That sounds a lot easier than it probably is, as I suspect you would maybe need to calculate the geometric centre of each part/assembly instead and then perform a tweak on a vector away from the geometric centre of the parent assembly document.

 

You could I suppose also allow for an "explosion whilst respecting physical constraints" such that the assembly would dismantle in the way that it is physically able but again that's a lot of work.

Message 8 of 13

chandra.shekar.g
Autodesk Support
Autodesk Support

@AlexFielder,

 

I checked with Engineering team and confirmed that Inventor 2014 API was supporting exploded view for presentation document. Since Inventor 2017 does not exploded view for presentation document.

 

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



0 Likes
Message 9 of 13

GeorgK
Advisor
Advisor

Hello @chandra.shekar.g,

 

is there any workaround to get the same result with Inventor 2017 / 2018 and VB.Net?

 

Georg

0 Likes
Message 10 of 13

AlexFielder
Advisor
Advisor

Hi @GeorgK,

 

Here's the beginnings of a rule I worked up last week for this.

 

So far all it does is create workpoints at the boundingbox centre for each top-level occurrence. The next logical step would (I think) be to "explode" these points apart by a set distance.

 

Then of course it would need to be made to work in the Presentation environment and translate those exploded positions into Tweaks.

 

Which is some ways away I think.

 

Anyways, here's my code so far:

 

Sub Main()
	Dim points As New List(Of KeyValuePair(Of String, Point))
	Dim thisAssy As AssemblyDocument = ThisApplication.ActiveDocument
	Dim originMatrix As Matrix = ThisApplication.TransientGeometry.CreateMatrix
	Dim destinationMatrix As Matrix = ThisApplication.TransientGeometry.CreateMatrix
	Dim originPoint As WorkPoint = thisAssy.ComponentDefinition.WorkPoints.Item(1)
	originPoint.Visible = True
	Dim occurrenceYNormal As UnitVector = Nothing

	For Each occ As ComponentOccurrence In thisAssy.ComponentDefinition.Occurrences
		Dim oTransform As Matrix = occ.Transformation
		Dim occDatum As WorkPoint = Nothing
		If TypeOf (occ.Definition.Document) Is PartDocument Then
			Dim IsAPart As PartDocument = occ.Definition.Document
			Dim partXYWorkPlane As WorkPlane = IsAPart.ComponentDefinition.WorkPlanes(1)
			Dim normalPlane As Plane = partXYWorkPlane.Plane
			occurrenceYNormal = ThisApplication.TransientGeometry.CreateUnitVector(normalPlane.Normal.X, normalPlane.Normal.Y, normalPlane.Normal.Z)
			occDatum = IsAPart.ComponentDefinition.WorkPoints(1)
			occDatum.Visible = False
		Else
			Dim IsAnAssembly As AssemblyDocument = occ.Definition.Document
			Dim assyXYWorkPlane As WorkPlane = IsAnAssembly.ComponentDefinition.WorkPlanes(1)
			Dim normalPlane As Plane = assyXYWorkPlane.Plane
			occurrenceYNormal = ThisApplication.TransientGeometry.CreateUnitVector(normalPlane.Normal.X, normalPlane.Normal.Y, normalPlane.Normal.Z)
			occDatum = IsAnAssembly.ComponentDefinition.WorkPoints(1)
			occDatum.Visible = False
		End If
		Dim compdef As ComponentDefinition = occ.Definition
		originMatrix.SetTranslation(originPoint.Point.VectorTo(occDatum.Point))
		Dim originYVector As Vector  = ThisApplication.TransientGeometry.CreateVector(0, 1, 0)
		originMatrix.SetToRotateTo(originYVector, occurrenceYNormal.AsVector())
		Dim tmpPoint As Point = getBoxCentreFromOccurrence(occ)
		points.Add(New KeyValuePair(Of String, Point)(occ.Name, tmpPoint))
	Next

	For Each pnt As KeyValuePair(Of String, Point) In points
		Dim point As Point = pnt.Value
		Dim wp As WorkPoint = thisAssy.ComponentDefinition.WorkPoints.AddFixed(ThisApplication.TransientGeometry.CreatePoint(point.X, point.Y, point.Z))
		wp.Name = "Work Point: " & pnt.Key
	Next

End Sub

Function getBoxCentreFromComponentDefinition (thiscompDef As ComponentDefinition) As Point
	Dim centrepoint As Point = ThisApplication.TransientGeometry.CreatePoint((thiscompDef.RangeBox.MaxPoint.X - thiscompDef.RangeBox.MinPoint.X) / 2, 
	(thiscompDef.RangeBox.MaxPoint.Y - thiscompDef.RangeBox.MinPoint.Y) / 2,
	(thiscompDef.RangeBox.MaxPoint.Z - thiscompDef.RangeBox.MinPoint.Z) / 2)
	Return centrepoint
End Function

Function getBoxCentreFromOccurrence(thisocc As ComponentOccurrence) As Point
	Dim centrepoint As Point = ThisApplication.TransientGeometry.CreatePoint((thisocc.RangeBox.MaxPoint.X - thisocc.RangeBox.MinPoint.X) / 2 + thisocc.RangeBox.MinPoint.X, 
	(thisocc.RangeBox.MaxPoint.Y - thisocc.RangeBox.MinPoint.Y) / 2 + thisocc.RangeBox.MinPoint.Y,
	(thisocc.RangeBox.MaxPoint.Z - thisocc.RangeBox.MinPoint.Z) / 2 + thisocc.RangeBox.MinPoint.Z)
	Return centrepoint
End Function

Incidentally, this forms part of my iLogic github repo here: https://github.com/AlexFielder/iLogic

 

Maybe I'm overthinking it (It has been known to happen) so please, anyone who has a better idea do speak up. 

 

🙂

 

PS. @chandra.shekar.g I perhaps wasn't clear in my suggestion to speak to your team; I meant to ask them if the "explode" javascript function available in the Autodesk web viewer could be repurposed into iLogic to save us the trouble? I had a look around myself to see if I could find what it was based upon but to no avail, although I have one other avenue left to explore.

Message 11 of 13

chandra.shekar.g
Autodesk Support
Autodesk Support

@GeorgK,

 

Suggestion by @AlexFielder would be a workaround to explode occurrence in assembly.

 


@AlexFielder wrote:

 

 

PS. @chandra.shekar.g I perhaps wasn't clear in my suggestion to speak to your team; I meant to ask them if the "explode" javascript function available in the Autodesk web viewer could be repurposed into iLogic to save us the trouble? I had a look around myself to see if I could find what it was based upon but to no avail, although I have one other avenue left to explore.


"explode" javascript function is from Forge API (web service API).

 

Thanks and regards,

 

 


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



0 Likes
Message 12 of 13

mjkoushik
Explorer
Explorer

Pretty interesting approach. Has anyone worked on this to complete the automation of exploded view.??. Does inventor 2021 have the capability to automate exploded view using Presentation API

0 Likes
Message 13 of 13

Maxim-CADman77
Advisor
Advisor
I know this is an old thread but I wonder if somebody moved any further with this?

Please vote for Inventor-Idea Text Search within Option Names