How can I tell if an arc curves inwards or outwards?

How can I tell if an arc curves inwards or outwards?

johnPGNFG
Enthusiast Enthusiast
326 Views
3 Replies
Message 1 of 4

How can I tell if an arc curves inwards or outwards?

johnPGNFG
Enthusiast
Enthusiast

How can I tell if an arc curves "into" a part or "out of" a part using the edge?  

 

For example, how could I identify the curve on the left (curving in) as -1 and the curve on the right (curving out) as +1?

 

I extracted the ArcData but can't seem to find a way I can use this to tell which way the arc curves.

 

Arc3d curve = edge.Geometry; 

curve.GetArcData(....);

cirinout.png

0 Likes
327 Views
3 Replies
Replies (3)
Message 2 of 4

Michael.Navara
Advisor
Advisor

It depends on reason. here is few aproaches

  1. Check tangential faces of cylinder face: arcEdge.Faces.TangentiallyConnectedFaces.Count > 0
  2. Check center point of arc is inside of surface body: SurfaceBody.IsPointInside 
  3. Check the tangent of arc on one of the endpoint and line direction:  CurveEvaluator.GetTangent

and so on...

0 Likes
Message 3 of 4

johnPGNFG
Enthusiast
Enthusiast

1. I tried this on a part with multiple curves that are in and out and I got the count to be 1 on both the ins and outs.

 

2.  Originally this was the method I was using but then I came across a part that it did not work on. The pic attached is an example. Both the in and out curve have a center point that is not on the face.

 

3.  This works for the part I posted but say if both sides curved outward, the tangent point on the starting point of one curve would point in the opposite direction of the tangent of the starting point on the other curve.

 

1.

johnPGNFG_1-1654106591129.png

 

2.

johnPGNFG_0-1654106559449.png

 

3.

johnPGNFG_2-1654106682515.png

 

 

0 Likes
Message 4 of 4

Curtis_Waguespack
Consultant
Consultant

Hi @johnPGNFG 

 

Here is an iLogic example, based on the "Is cylindrical face interior or exterior?" API Help files Sample

 

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

 

 

Dim oDoc As PartDocument
oDoc = ThisApplication.ActiveDocument

Dim oHLSet As HighlightSet
oHLSet = oDoc.CreateHighlightSet
Dim oRed As Color
oRed = ThisApplication.TransientObjects.CreateColor(255, 0, 0)
oRed.Opacity = 0.1
oHLSet.Color = oRed

Dim oHLSet2 As HighlightSet
oHLSet2 = oDoc.CreateHighlightSet
Dim oGreen As Color
oGreen = ThisApplication.TransientObjects.CreateColor(0, 255, 0)
oHLSet2.Color = oGreen

For Each oSolid In oDoc.ComponentDefinition.SurfaceBodies
	Dim oFace As Face
	For Each oFace In oSolid.Faces

		If Not oFace.SurfaceType = SurfaceTypeEnum.kCylinderSurface Then Continue For
		If oFace.Edges.Count = 2 Then Continue For 'skip holes or full circle cuts

		Dim oCylinder As Cylinder
		oCylinder = oFace.Geometry

		Dim params(1) As Double
		params(0) = 0.5
		params(1) = 0.5

		' Get point on surface at param .5,.5
		Dim points(2) As Double
		Call oFace.Evaluator.GetPointAtParam(params, points)

		' Create point object
		Dim oPoint As Point
		oPoint = ThisApplication.TransientGeometry.CreatePoint _
			(points(0), points(1), points(2))

		' Get normal at this point
		Dim normals(2) As Double
		Call oFace.Evaluator.GetNormal(params, normals)

		' Create normal vector object
		Dim oNormal As Vector
		oNormal = ThisApplication.TransientGeometry.CreateVector _
			(normals(0), normals(1), normals(2))

		' Scale vector by radius of the cylinder
		oNormal.ScaleBy(oCylinder.Radius)

		' Find the sampler point on the normal by adding the
		' scaled normal vector to the point at .5,.5 param.
		Dim oSamplePoint As Point
		oSamplePoint = oPoint

		oSamplePoint.TranslateBy(oNormal)

		' Check if the sample point lies on the cylinder axis.
		' If it does, we have a hollow face.

		' Create a line describing the cylinder axis
		Dim oAxisLine As Line
		oAxisLine = ThisApplication.TransientGeometry.CreateLine _
		(oCylinder.BasePoint, oCylinder.AxisVector.AsVector)

		'Create a line parallel to the axis passing thru the sample point.
		Dim oSampleLine As Line
		oSampleLine = ThisApplication.TransientGeometry.CreateLine _
		(oSamplePoint, oCylinder.AxisVector.AsVector)


		If oSampleLine.IsColinearTo(oAxisLine) Then
			oHLSet.AddItem(oFace)
			MsgBox("Interior face.", , "iLogic")
		Else
			oHLSet2.AddItem(oFace)
			MsgBox("Exterior face.", , "iLogic")
		End If

	Next
Next

 

EESignature