Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
WCrihfield
in reply to: ianteneth

You may be able to use this technique, but I haven't tried using it with a TransientGeometry object.  It would likely work for them too. 

In the example, I'm using a the coordinates of a WorkPoint's Point object, as the input within the 'IsPointInside' Property.  But you can just delete the Dim oPoint line and replace the oPoint.X etc with simple Double (numerical) values, if you want.  It works the same either way.  Getting the kOnContainment answer is a bit odd though.  Not entirely sure how this is calculated.

 

Dim oPDoc As PartDocument = ThisApplication.ActiveDocument
Dim oPDef As PartComponentDefinition = oPDoc.ComponentDefinition
Dim oBodies As SurfaceBodies = oPDef.SurfaceBodies
Dim oBody As SurfaceBody = oBodies.Item(1)
Dim oPoint As Point = oPDef.WorkPoints.Item(1).Point
Dim oCoords(2) As Double 'Use (2) for 3 doubles, because 0 is counted
oCoords(0) = oPoint.X
oCoords(1) = oPoint.Y
oCoords(2) = oPoint.Z
Dim oContEnum As ContainmentEnum = oBody.IsPointInside(oCoords,False)
Select Case oContEnum
	Case ContainmentEnum.kInsideContainment
		MsgBox("It is Inside the body.")
	Case ContainmentEnum.kOnContainment
		MsgBox("It is On the body.")
	Case ContainmentEnum.kOutsideContainment
		MsgBox("It is Outside the body.")
	Case ContainmentEnum.kUnknownContainment
		MsgBox("Its location is Unknown in relation to the body.")
End Select

 

 

I hope this helps.
If this solves your problem, or answers your questions, please click 'Accept As Solution".
Or, if this helps you reach your goal, please click 'LIKES" :thumbs_up:.

 

Also, if you're interested, here are a few of the 'Ideas' I'd like to get implemented.
If you agree with any of them, please vote for them.

  • Add more capabilities to the 'Customize' dialog box (exe. Add Tab & Add Panel) Click Here
  • MessageBox, InputBox, and InputListBox Size & Format Options Click Here
  • Constrain & Dimension Images In Assembly Sketches & Drawing Sketches (TitleBlocks & SketchedSymbols) Click Here
  • Save Section View Status In DesignViewRepresentation (So It Can Be Used In The Drawing) Click Here
  • Add SolidBodies Folder In iLogic Rule Editor Model Tab Click Here
  • Convert All Views To Raster Before Autosave Stores To 'OldVersions' Folder Click Here
  • SetDesignViewRepresentation - Fix limitations for DrawingView of a Part Click Here
  • Create DocumentSubTypeEnum Click Here

Inventor 2020 Help | Inventor Forum | Inventor Customization Forum | Inventor Ideas Forum

Wesley Crihfield

EESignature

(Not an Autodesk Employee)