Message 1 of 2
Not applicable
03-01-2019
02:23 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello everyone,
I want to check if a point collides with any body in a multibody assembly.
I would like to make a random point in an(y) assembly:
dim ivApp as Inventor.Application set ivApp = ThisApplication dim ivDoc as AssemblyDocument set ivDoc = ivApp.ActiveDocument dim ivComp as ComponentDefinition set ivComp = ivDoc.ComponentDefinition Randomize dim randomX as Double randomX = rnd() * (ivComp.RangeBox.MaxPoint.X - ivComp.RangeBox.MinPoint.X) dim randomY as Double randomY = rnd() * (ivComp.RangeBox.MaxPoint.Y - ivComp.RangeBox.MinPoint.Y) dim randomZ as Double randomZ = rnd() * (ivComp.RangeBox.MaxPoint.Z - ivComp.RangeBox.MinPoint.Z) dim ivTrans as TransientGeometry set ivTrans = ivApp.TransientGeometry dim randomPoint as Inventor.Point set randomPoint = ivTrans.createPoint(randomX, randomY, randomZ)
Then I want to check if these coordinates collide with any body in the active assembly:
dim boolCollision as boolean boolCollision = DoesPointCollide(randomPoint)
Function DoesPointCollide(ivPoint as Inventor.Point) as Boolean
'--> Insert code here <--
End Function
Can anyone help me with that? I don't know if Inventor provides a function that can return a true or a false with a point, or something comparable. Or where I can find a collection with a description of the body where I can deduct if there is a collision or not.
I do know that Inventor provides a collision detection in the animation, but I'm not sure if that would be something that I can use.
Kind regards
Solved! Go to Solution.